Today’s electronic compasses are built to withstand harsh environments – mechanical shocks, extreme temperatures and battlefield conditions. Yet the most challenging environment for electronic compasses is transitory magnetic field distortion encountered in everyday situations.

Materials that distort the Earth’s magnetic field surround us. Ferrous material (e.g. rebar in floors, beams in walls), batteries, automotive parts, magnets in speakers, electric motors, cell phones, DC currents in wires can create either permanent or transitory distortions to the local magnetic field. With recent software advancements, both of these kinds of distortions can be compensated for in the modern electronic compass.

Correcting for permanent local field distortions
“Permanent distortions” are caused by magnetic distortion sources placed near the electronic compass within a user’s system. Such items (mounting brackets, batteries, screws, nearby electronic components, etc) can distort the field either by adding a magnetic field vector to Earth’s field (hard iron distortion) and/or by distorting the local field (soft iron distortion). 

PNI - Fig 1

A standard 2-axis compass measures the magnetic field strength in one horizontal direction (x axis) and in the horizontal direction orthogonal to the x axis (y axis). When rotated through 360°, the compass maps a circle of points as shown in the “Undistorted Field” diagram in Figure 2a. When a hard iron distortion is introduced which rotates with the compass, the center of the circle is offset (figure 2b); introducing an additional soft iron distortion results an ellipse (figure 2c). 

PNI - Fig 2

To maintain accurate heading information, one must transform the “Field with Distortion” offset ellipse back to the “Undistorted Field” centered circle. This is done with a calibration routine performed while the compass is fixed relative to the host system. And getting this right is non-trivial. At PNI, we have been refining our calibration algorithms for 20 years, such that we can now reduce calibrated heading error to <0.3° in real world conditions with our TCM electronic compass.

Correcting for transient local field distortions
A more challenging scenario is when the local magnetic field temporarily changes – when a vehicle passes close by, or the compass momentarily passes close to a magnetic distortion. In this case, the source of distortion is not a permanent part of the user’s system, so recalibration is usually infeasible.

To address this challenge, a gyroscope can be integrated into the compass to recognize when motion occurs. Generally speaking, if the gyroscope indicates no motion is occurring, but the magnetic sensors show the heading is changing, this is recognized as a transient magnetic distortion. Sophisticated software algorithms, which are available in some gyro-stabilized compasses and attitude and heading reference systems (AHRS), can correct for these situations, thus providing continuous, reliable heading data.

PNI has recently developed the FieldForce Trax, an AHRS module which provides an accurate heading even when encountering magnetic distortion and experiencing erratic motion. It employs a refined Kalman filtering algorithm that intelligently fuses PNI's patented Reference Magnetic Sensors output with gyro and accelerometer outputs to overcome errors due to motion and changes in the local magnetic field. Figure 3 provides heading information for a standard 2-axis compass and for the Trax AHRS as each travels in a straight line (constant heading) and is twice brought close to a source of magnetic distortion. 

PNI - Fig 3

For further information, please see

About the Author: Andrew Leuzinger is VP of Technical Marketing at PNI Sensor Corporation. PNI is the established leader in magnetic ?eld sensing technology, with 23 years of experience serving mass market and high-function clients such GM, Ford and the US Military. Its team of physicists, engineers and researchers has deep understanding of the complexities of magnetism, and proven experience in the creation of complex Kalman ?ltering algorithms for real-world applications.