2
\$\begingroup\$

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?

\$\endgroup\$
  • 1
    \$\begingroup\$ What frequency are you sampling it at, and is AC mains a harmonic of that frequency? \$\endgroup\$ – Brian Drummond Apr 17 '15 at 13:57
  • \$\begingroup\$ Ah I'm sorry, with 'embedded' I meant it is actually embedded in a mobile (Android) device! I am not doing the low-level programming myself so the sampling frequency is not known to me. \$\endgroup\$ – Soulrot Apr 17 '15 at 14:09
  • \$\begingroup\$ then another way of asking the question: ... does the same problem appear, outdoors, as far from power lines as you can get? \$\endgroup\$ – Brian Drummond Apr 17 '15 at 14:15
2
\$\begingroup\$
  • 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.

\$\endgroup\$
  • \$\begingroup\$ I did not realize there could be automatic hard-iron offset correction. It appears that this is the case, it just does not seem to work too well. Thanks. \$\endgroup\$ – Soulrot Apr 28 '15 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.