# What is reason for electronic compass calibration?

Most GPS receivers and smart phones contain an "electronic compass", which I understand is generally a Hall effect magnetometer. These devices generally require "calibration", which involves waving the device in an 8-shaped figure. During the motion, the forward axis is tilted about 45 degrees in each direction and the sideways axis inverted there and back, initial direction does not matter. The device does not to be put in any special mode for the calibration. This calibration is needed each time the device is turned on. Why is it needed?

The Hall effect sensor should measure magnitude of the magnetic field in given direction. So I'd expect a pair of sensors to be able to measure direction and magnitude of magnetic field in horizontal plane consistently each time and a needle compass isn't doing anything more. I can understand the other kind of calibration, turning the compass around twice slowly, as needed to compensate for magnetic bias generated by the device itself, but that's only needed once as expected (the device generates same bias each time). So what is this every-time calibration compensating for?

-
BTW--This verges on being a technology question, but for the moment I am holding out hope for a physically insightful answer. – dmckee Nov 29 '11 at 1:47
Provided an answer below -- may be for others to judge if this is really a physical answer or an engineering one. – Mark Beadles Nov 29 '11 at 3:39

The Hall effect acts at right angles to the applied magnetic lines of force. We want to us this effect to determine true north. But the Earth's magnetic field can be considered to consist of multiple components in different directions. So we need some way to disambiguate these so we can eliminate all but the components that guide us to north. E.g. there is a radial (vertical) component that we don't want to use.

This is why we hold the device level and move it in a figure 8: from this motion the associated logic can tell which voltage corresponds to the vertical magnetic field component because its effect will be in the horizontal plane, which we defined for the device by holding it level. After calibration, the device knows to ignore that bit when determining true north. The figure 8 thing does this similarly for certain of the other components.

EDITED TO ADD: See this site for a video showing the figure 8 motion in three dimensions. According to the site, by waving the device through all three dimensions, the device can tell the orientation of the earth's field (since the strongest component will be the vertical). END EDIT

I think that this can vary depending on how accurate the device is and how many components it can measure. But I think you get the idea. We are giving the device inputs in a controlled fashion so that it can ignore them and focus on just the component we care about: in this case the declination.

So yes, this is an engineering answer - but it relies on at least two bits of science: 1. (physics) the Hall effect acts at right angles to the applied lines of force 2. (geological) Earth's field may be considered to have 3+ components of which the strongest is actually the vertical (radial).

wikipedia:Dipole Model of the Earth's magnetic field

NOAA has a site that is related and kind of fun !

-
I don't think this is right. If the purpose was to get rid of the effect from the vertical component of the field, then the calibration process would depend on the person's ability to wave it in the correct plane, which would be no better than their ability to hold it in the correct orientation. – Ben Crowell Nov 29 '11 at 4:36
What about declination? A GPS knows the coordinates and can look for declination of the place in a table, but what about this in a "smart"phone? (I operate old telephones, the one here in reach is a field phone from army. I glued a label on it reading: "Do You want Your phone being smarter than Youself?" – Georg Nov 29 '11 at 6:59
I understand that Hall effect acts at right angles to the applied magnetic field, but that's exactly why I dont understand the waving. Magnetic field is a vector. The component along the sensor chip won't exert any force on the charge carriers and the component across the chip will exert force, but in direction in which the carriers can't move, so neither should affect the sensor reading. Only the perpendicular component is measured. Two sensors measure the two components in horizontal plane (the compass only works when level) and the third is irrelevant. So why the waving? – Jan Hudec Nov 29 '11 at 7:26
@BenCrowell and JanHudec as I understand it from the video I added above, the trick is that the "figure 8" is actually a move that takes it through all three dimensions. This would allow the on-board logic to make a good educated guess about which vectors belong to which orientation based on their relative strength. – Mark Beadles Dec 14 '11 at 1:21
@Georg I operated communications systems including field phones int he Army once myself. Calling a TA-312 and an iPhone both a "telephone" is like calling both a chihuahua and a great dane a "dog" ;) – Mark Beadles Dec 14 '11 at 1:22

Here is a lengthy article on the topic: http://gge.unb.ca/Resources/gpsworld.september03.pdf In a forum posting elsewhere, the author of the article states that as of 2003, the magnetic sensors in Garmin GPS units were magnetoresistive: http://www.gps-forums.net/electronic-compasses-garmin-gps-receivers-not-fluxgates-t25216.html The gpsworld article says that the ones in many cars use magnetoinductive sensors. It sounds like the advantage of magnetoresistive ones is that they're very compact. The article describes a comprehensive list of techniques for sensing a magnetic field, and this list includes fluxgate and Hall effect sensors. He doesn't say explicitly, but it sounds like Hall effect sensors are not actually used in GPS units. The only application of fluxgate sensors he mentions is in marine applications.

The section of the article on calibration describes the physics involved. If I'm understanding correctly, the basic issue is that the compass can contain ferromagnetic materials, or it can be used near ferromagnetic objects such as the frame of a bike. If these materials are ones with lots of hysteresis ("hard" iron), they can have strong permanent magnetic fields, but these fields can change over time, so they aren't really permanent in that sense -- their effect on the sensors need to be recalibrated from time to time. Since the device has sensors on multiple axes, each axis also has some scaling error that needs to be eliminated. These scaling errors can be intrinsic to the sensors, or they can be due to nearby ferromagnetic materials with low hysteresis ("soft" iron). Rotating the device in a horizontal plane allows these errors to be calibrated away, since the presence of the errors causes the B vector to trace a path that is not a circle centered on the origin.

"This calibration is needed each time the device is turned on. Why is it needed?" The link you provided seems to confirm that the explanation is as stated in the gpsworld article; the presence of nearby ferromagnetic materials.

For comparison, my Garmin Foretrex 401 only wants to be calibrated when you put in fresh batteries. The calibration procedure it asks for is that you turn around twice slowly in a circle while holding it level. (It doesn't ask you to do a figure 8.) This is exactly as described in the gpsworld article.

-
Hm, I couldn't find definitive source which type of sensors are being used for compasses, but the site I linked mentions Hall-effect sensors, so I assume the figure-8 calibration applies to that type. And the fact Garmin devices only need the two turns before first use suggest it is specific to that type. So it seems like there is some intrinsic error in that type of sensors. – Jan Hudec Nov 29 '11 at 7:47

My impression was always that "calibration" had to happen to account for the angle between the magnetic vector and horizontal... Most electronic (especially old) ones have only 2D magnetic sensors and no accelerometers - so they need to be "calibrated" in a plane to correct for these problems. In other words, devices with 3D magnetic compasses AND 3D accelerometers (defining magnetic vector and gravity vector with 3DOF each) do not need calibration.

-
I believe I already heard that, but I still don't see why it needs to care about the angle from horizontal. Mechanical compasses certainly don't care. – Jan Hudec Dec 14 '11 at 7:45