Compass calibration Issue

cancel
Showing results for 
Search instead for 
Did you mean: 

Compass calibration Issue

2,041 Views
kishorepoojari
Contributor III

Hello All,

 

   I am using Three-Axis Digital Magnetometer (MAG3110) and 3-Axis Digital Accelerometer (MMA8451Q) for my COMPASS ,

As per freescale provided algorithm, compass calibration data ( hard and soft iron) is not stored anywhere and hence requires recalibration for each power on .

Is their in way to store the calibrated values and apply these values on successive power ON? If it is possible, what values should be stored ?

 

Regards,

Kishore P

Labels (1)
Tags (2)
3 Replies

585 Views
michaelestanley
NXP Employee
NXP Employee

Kishore,

Great question!  I queried the engineer who wrote the code, and the following is his reply:

The decision not to (by default) save the calibration parameters in the reference software was made for two reasons:

  1. From a marketing perspective, Freescale felt that it was more valuable to demonstrate the operation of the calibration algorithms after a cold start rather than using pre-stored values.
  2. Calibration coefficients are temperature dependent and coefficients stored at the last power down will be non-optimal if the ambient temperature or electronics' temperature has changed in the meantime.

The safest approach is therefore to recompute the calibration whenever the electronic compass is powered up.

If this is inconvenient, then the following approach should be used:

  • The hard iron calibration vector (fV), the inverse soft iron matrix (finvW) and the geomagnetic field strength (fB) from the
    MagCalibration structure should be stored on power down and copied into the structure on next power up. The logic here is that these parameters may be inaccurate due to temperature changes since the last power down but are still better than a null calibration.
  • The contents of the magnetic buffer should not be stored. The logic here is that these measurements may have been captured at a different operating temperature and will simply get in the way of computing a new calibration after power up at the new operating temperature.
  • The percentage Fit Error (fFitErrorpc in the MagCalibration structure) should not be stored but should be initialized on power up to a value such as 10% (corresponding to 3 green bars on the Freescale demonstration user interface) or 12% (corresponding to 2 green bars). This ensures that the previously stored calibration is quickly replaced once new measurements are captured into the magnetic buffer. This avoids the problem of an excellent calibration with, say, 1% fit error, being stored at power down with its fit error and then locking out a new calibration which may be more accurate at the new operating temperature but only achieves a (still excellent) calibration fit of 2%.

I hope that helps.

Regards,

Mike Stanley

585 Views
vitaliysiplichu
Contributor III

Hi Michael!

I want to ask you about two magnetometers in one device. As I know some developers use two or even three magnetometers located in two or three different axises to avoid the need of calibration magnetometers after power on. I had one mag and implemented soft and iron calibration. But now I have two mags and I don't understand how to implement it in my algorithms.

What can you say about using several mags in one device? Does it make sense?

0 Kudos

585 Views
michaelestanley
NXP Employee
NXP Employee

Vitaliy,

Technically, a 3-axis magnetometer (which is what Freescale sells) is 3 separate sensors oriented 1 each in X, Y and Z sensing directions.  You need at least three axes to do magnetic calibration in three dimensions.  If you are asking about devices with more than 3 axes in one device - I'm not aware of anything like that.

You should understand that even if you have a perfect sensor, ferrous materials in the immediate vicinity can distort the magnetic field being measured.  The field itself becomes non-ideal.  Magnetic calibration effectively implements the inverse transfer function to that distortion.

Regards,

Mike

0 Kudos