Electronic – What can cause magnetometer offset to be variable

magnetometer

I'm a using a embedded MEMS 3-axis magnetometer. With 'embedded' I mean that I am using an Android device with a magnetometer. I am not doing the low-level control myself, only retrieving measurements. From the information I have already found, I know that a magnetometer can suffer from a hard-iron offset and soft-iron distortion.
As far as I understand, hard-iron offset is caused by magnetic fields that have a constant position relative to the magnetometer, so for example other electronics in the same device. This would make the offset (almost) constant.

Soft-iron will cause the measured magnetic strength to warp into a ellipse instead of a circle, and is caused by nearby materials that don't generate a magnetic field by themselves, but to change the 'direction' of the local field.

My magnetometer shows a near-perfect circle with an offset when turning 360 degrees while holding the device parallel to the floor (I am only interested in 'yaw/azimuth') and plotting the vectors that represent the measured magnetic 'direction'. This would, as far as I know, indicate a hard-iron offset.

My problem is that the direction of the offset vector seems to randomly change every time I run my program, the center of the circle can be in all 4 quadrants of the plane parallel to the floor and I haven't figured out any consistency yet!

Am I misunderstanding how hard-iron offsets work, and is it normal that it can change direction? If so, what can be the cause of these changes?

Best Answer

  • External iron objects, such as desks, chairs, building structures, etc. will also warp the Earth's magnetic field. You should be a few meters away from these objects when calibrating the sensor, as they may be causing the interference.
  • Some magnetometers (e.g. FXOS8700) can automatically perform hard-iron offset using a simple max-min algorithm. If the field is varying between tests it may be the sensor / phone is automatically calculating new offsets.

Try doing the experiment outside away from any iron.