Why do compass chips in cellphones require frequent calibration?

3 Axis magnetometers have 3 channels all of which have an offset and gain. The offset changes with temperature and can change over time. This is caused by the sensor and the analog electronics that get the signal into the ADC. Not only are you calibrating the Magnetometer but the Accelerometer and\or Gyro as well. This is because all of the data from the sensors is fed into a Kalman filter which is a statistical filter. In short it updates its state based on the best information from the sensors. It's easy to calibrate if you have different information. It is easier (but not necessary) to calibrate 2 axes at a time so most phone calibration routines have you conduct two axis motions.

For information on drift and calibration in magnetic sensors see this. Kalman filters are interesting and also when applied to Degree of Freedom (DOF) sensors. Other sensors (not just the magnetometer) are subject to drift.


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....