Calibrating an Electronic Compass
Once an electronic compass like the Revolution is mounted in its target location, the detrimental effects of local magnetic fields, both permanent and induced, can be largely compensated. An advantage of an electronic compass over its mechanical predecessor is that the compensation can be performed without additional hardware. A strap-down electronic compass can be compensated more precisely than a mechanically gimbaled compass because the magnetometer remains fixed in its surroundings.
Compensation for permanent and induced fields is generally separated and referred to as hard-iron and soft-iron calibration. Hard-iron errors are usually most severe and have the effect of shifting the center of a sphere from the origin within a 3 dimensional coordinate system. The purpose of a hard-iron calibration procedure is to determine where the center of the sphere lies so that appropriate X, Y, and Z offsets can be subtracted from the corresponding magnetometer signals to return the center to the origin.
In algebraic form, hard-iron is represented by the a, b, and c coefficients in:
(x – a)2 + (y – b)2 + (z – c)2 = r2,
where x, y, and z are orthogonal components of the earth’s magnetic field and r is the total field strength, which is an unknown constant.
Soft iron effects distort the shape of the sphere into an ellipsoid. The purpose of a soft-iron calibration procedure is to determine parameters of the ellipsoid, such as the relative lengths of the 3 axes and their orientation in space, so that an appropriate transformation can be generated that will reshape the ellipsoid into a sphere.
In both hard and soft-iron cases, it can be difficult or impossible to get good calibration data. The compass must remain fixed in its environment (vehicle, robot, boat, etc.) and everything must be rotated together in the earth’s magnetic field, ideally in all three dimensions. By rotating everything attached to the compass with the compass, the effects of local magnetic fields remain fixed relative to the magnetometer, so they can be determined and compensated.
Since a boat or vehicle of any size cannot be inverted, True North uses a two-step calibration that relies on first acquiring a vertical reference outside the influence of the vehicle, then performing a simple, two-dimensional rotation while roughly level to determine all three components of hard iron. The rotation can be performed continuously, or individual samples can be captured. In both cases, the data collection algorithms are designed to ensure that in-range data from a complete rotation is collected before being analyzed.
True North’s PC and on-board calibration software implement least squares algorithms that determine both hard-iron and two-dimensional soft-iron compensation coefficients. A minimum of 7 sampled data points or one complete rotation is required. After data is collected and new coefficients are calculated, the variation in total magnetic field is calculated using both old and new coefficients to determine which are best. Results are presented with suggested best choices for the user to accept or override.
Receive A Free Quote