Search code examples
sensorsmagnetometersensor-fusion

What is magnetometer tilt compensation and why is it required?


When reading about magnetometer / magnetic field / "compass" sensors it is often said that sensor tilt compensation e.g. by using an accelerometer is required in order to get correct measurements. (Note that I am not talking about hard iron and soft iron effects here.) All these sources make use of the two-dimensional compass for clarification which, when tilted, would not work.

When using a 3D magnetometer (e.g. HMC5883L), my understanding is that they provide a 3D vector pointing in (or along) the direction of the strongest magnetic field, which - in case of the earth - should be towards magnetic north.

I was under the impression that I could use the cross product of a gravity vector measured by an accelerometer and the magnetometer "north" vector to get all axes required for determining a reference frame and from that, local orientation.

Then, what is tilt compensation and why would it be required?


Solution

  • Before the question is going to be closed, in the comments Matt gave me a pointer to a discussion that helped answering the question.

    It states that with 3D devices, tilt compensation is not per se required for making sense of the sensor data. What's more important though, it gave the crucial insight that the perception of the earth's magnetic field is wrong when assuming that it runs perpendicular to the earth (i.e. sensor's 3D vector somehow pointing towards north pole) as quite a lot graphics show it, when it actually enters earth at an angle at any point exluding the equator.