Electronic – Why do compass chips in cellphones require frequent calibration


Most cell phones offer digital compass functionality which uses a 3-axis magnetometer chip for data. Phones (some more than others?) frequently require the user to "recalibrate", which involves rotating the phone in a "swirly" or other pattern to populate readings over some fraction of a sphere representing the various orientation with respect to the local field.

The discussion in this answer as well as the 3D plots of data give an excellent overview of what is happening mathematically. Roughly speaking, six parameters – a gain and an offset for each of the three axes – are fit to a dataset collected over a cloud of data points that at cover at least a chunk of that sphere.

I've done this myself with a magnetometer attached to an Arduino and fitting offline. The low cost chip I used seemed to drift a lot (being careful to do this outdoors and away from more obvious sources of error or gradients like nearby ferrous materials or other possible fields). I noticed that the offsets seemed to be contributing as much to the drift as the gains, if not more.

Question: What exactly is drifting within the magnetometer sensors in newer, high-end cell phones that still requires frequent recalibration? Is it simply temperature? If so, why wouldn't the magnetometers be internally temperature stabilized? Is it too hard to do in analog and the magnetometers don't have any ability to calculate offsets?

enter image description here

above: After paying a zillion dollars for a very nice phone, I feel like an idiot doing this (from here) while balancing on a bicycle on a busy street corner, or enjoying some beautiful view on a hike. My iPhone makes me go through a much longer, silly video-game-like task before it will even begin to tell me anything useful. I cary a normal compass sometimes because it just simply works.

enter image description here

above: Screen shot from this nice discussion of the principles and mathematics behind magnetometer based compass calibrations. Here is another.

Best Answer

Well, while the earth's magnetic field is fairly constant short term, the environment that you are moving through may not be.

Every electrical current in the vicinity is generating a magnetic field around it. Much of this electromagnetic field generation is AC, switching direction 60 (or 50) times a second. When the power is being carried in pairs of wires routed close together (in the same wireway/conduit, for instance) the fields in the two wires tend to cancel each other. DC currents, however can and do flow through the earth, and this can affect the local magnetic field. (The ground potential between buildings can be large enough to damage electronic devices connected between buildings, which is why optical isolation is recommended for these instances.)

Every ferrous object in the vicinity can locally "warp" the earth's magnetic field. Lamp posts, steel-frame building, sheet-metal buildings, iron rebar, etc., can all affect the local measurement of the earth's magnetic field.

Even iron ore deposits under your feet can locally alter the earth's magnetic field somewhat.

Because of all the potential local interference to the earth's magnetic field, it is not uncommon to require recalibration when moving through it. And, if you recalibrate in an area of interference, when you move out of that area, you'll need to recalibrate again....

Related Topic