How to harness the most accuracy from an electronic compass
When harnessing the accuracy of an electronic compass, a number of factors, including magnetic conditions, can greatly impact performance. Here are two examples of these conditions and how to fix them.
1. Static Permanent Magnetism
The source of a local permanent magnetic field can be a piece of hard iron (hence the common name), a constant DC current, or some other type of magnet. This source of error can be significantly reduced by calibration. The curve in Figure 1 shows that a residual error of 0.1% of the earth’s magnetic field on both X and Y axes produces a peak accuracy error of 0.2° at 66° inclination (dip angle in middle US latitudes).
The error varies sinusoidally with direction and produces a single cycle for each rotation of the electronic compass. Phase depends on the signs and magnitudes of errors on each axis. The magnitude of the error depends on magnetic inclination because the residual hard iron error is expressed as a fraction of the total field strength.
Read more at: http://www.jewellinstruments.com/2-magnetic-conditions-that-affect-electronic-compass-accuracy/