AN-MPU-x000A-01
Document Number: AN-MPU-x000A-01
Page 5 of 14
Revision: 1.1
Date: 06/12 /2015
Magnetic fields decay quickly with distance. Typically, the best resolution to either hard or soft iron distortion will be achieved when
locating the compass as far away from sources of distortion as is practical, and/or substituting alternatives to “soft iron” materials in
the product. It is recommended to keep the magnetometer at least 10mm away from permanently magnetized materials in order to
reduce the likelihood of device saturation. Figure 3 provides an example of magnetometer location with respect to sources of hard
and soft iron distortion in a finished product.
Figure 3. Typical Handset Components Causing Hard/Soft Iron Effects and Magnetometer Location
Care should be taken in order to avoid introducing soft or hard iron effects to the magnetometer based on current device
configuration. Folding or rotating devices such as clamshell phones, dual-screen tablets, laptops, convertible notebooks; or critical
accessories, such as smart cases, port adapters, docking stations, should be analyzed for magnetic interference for all possible
orientations of the device. Magnetic or “soft iron" materials should not be placed near the magnetometer when the device in any
configuration as it will invalidate the current calibration and require an immediate recalibration for best performance.
3.2.
CALIBRATION OF HARD AND SOFT IRON DISTORTION
Hard iron distortion can be corrected through a sensor bias estimation. The bias introduced by hard iron distortion may be
calculated by measuring the magnetometer at known orientations and estimating a fixed offset, or applying a spherical model to
magnetometer data and computing the center of magnetic sphere.
Compensation of soft iron distortion is more difficult, as the warping of the magnetic field causes a non-uniform reduction in angle
sensitivity. A distortion matrix, ellipsoid fitting, or other characterization of sensitivity vs. orientation must be employed.
Both hard and soft iron distortion may vary over time, as parts become magnetized, or introduced by the surroundings. InvenSense
utilizes “in-use” calibration algorithms to adjust for changes during run-time, providing best performance for a variety of
environments.
As of eMPL 5.1, InvenSense compass calibration algorithms include:
-
Soft Iron Correction: A module which generates a mapping of spherical magnetometer data: tracking center shift, and
scaling axes according to sensed data. This correction reduces the effect of soft iron distortion introduced by device design,
and may be triggered to recalibrate based on device configuration changes.
-
Hard Iron Correction: A compass vector calibration module continuously estimates the compass bias and radius during run
time.