# How does accelerometer calibration work?

Inside a MEMS accelerometer there are some miniature spring-mass structures that displace under gravity or external force (acceleration). These forces are proportional to or can be indirectly quantified by capacitive changes due to their displacements. If an accelerometer is made ideal (perfect) and is laid flat on a surface, it would theoretically read $$\ A_x = 0g \$$, $$\ A_y = 0g \$$, and $$\ A_z = 9.81 m/s^2 = 1g \$$. In reality, we have to calibrate it, but I can't think of any sensible way of offsetting (calibrating) theses g values other than comparing the accelerometer values against a known mechanical design (pendulum of known inertia, free falling from a known height, rails of known direction and length etc.) then offset the measured values against a known physical values. Like calibrating a weight scale, we compare the reading against a physical, calibrated mass then either tune the bridge balance or hardcoding it in the firmware.

But in countless tutorials I found on google or youtube (e.g. Calibrating the BNO055 9-axis Inertial Measurement Sensor), the accelerometer calibration are carried out just by leveling and holding the accelerometer at different angles. If $$\ A_z = 10.1 m/s^2\$$ to begin with, in a minute or less of calibration, $$\ A_z \$$ then will magically correct itself to $$\ 9.81 m/s^2 \$$.

How is that possible? How does an accelerometer correct itself just by having it positioned at different angles? And if the accelerometer can correct itself, why do we need calibration in the first place (it may as well calibrate itself in operation)?

Calibration is frequently done on a centrifuge also. This allows precise acceleration to be applied.

• Interesting. So the concept of the centrifuge is to provide a constant force in the direction facing the center of rotation? Great if you can edit and provide some links or reference materials, thanks!
– KMC
Dec 8, 2021 at 15:02
• @KMC -- constant force PLUS the 1-g downward vector. Dec 8, 2021 at 16:22

The accelerometer controller knows that, when held stationary, it should see an acceleration of 9.81 in one direction, and zero in the two directions orthogonal to the 9.81 reading.

If held at an arbitrary angle, all three axes may read something, but the combined magnitude of those three readings should always be 9.81. If it isn't, the sensor needs to adjust itself.

If you take multiple readings at different angles, the controller can work out an offset and multiplier to apply to each of the three axes to get an answer of 9.81 every time. There are six unknowns to solve.

You can't constantly calibrate the sensor while it's moving, because there may be other accelerations going on.

• I was confused at first on how the accelerometer "knows (it's being) held stationary", how does it know it's sitting on flat or angled to a specific degrees. So my understanding is that there's a hardcoded routine burned into the accelerometer's processor - we start with 9.81 in one direction and through each angle the accelerometer calculates if all g's summed to 9.81 or otherwise changes some values in its registers, or something like that....
– KMC
Dec 8, 2021 at 14:57
• It looks like that device has a clever proprietary self calibration mode. It must be detecting periods where it detects no movement, and the acceleration is constant for several seconds. At that point, it knows it's being held steady, and can check if its accelerometers give a reading of 9.81. Dec 8, 2021 at 16:15

Doesn't it do something like this: -

Internally, the device knows that $$\9.81 \text{ m/s²}\$$ is the gravitational constant for earth. It has this value burnt in to hardware (so to speak). So, when you calibrate a particular axis, you need to align the accelerometer to "receive" the maximum effects of gravity on that axis. You need to do this with care and accuracy (if you want accuracy). So, now, it can take the number it was producing and fix the gain of that axis so that it then reads $$\9.81 \text{ m/s²}\$$.

For the other two axis (if you have done this carefully) there are no gravity pulls and these can be zeroed. Step and repeat for the other axes and you should be good to go. This method of course does not work on any other celestial body in our solar system other than earth.

if the accelerometer can correct itself, why do we need calibration in the first place (it may as well calibrate itself in operation)?

The accelerometer has no idea what angle the device is at nor whether it is actually accelerating.

• aha that sort of make sense now. So the calibration procedure has a fixed routine that steps through a specific range of angles, and likely the provided software manages this process to check for the g values one after the other then probably average the errors. I was mislead by the video thinking that the accelerometer magically knows which angle it's in then magically corrects the g values.
– KMC
Dec 8, 2021 at 14:53