Kyneo MARG Unit Calibration Process


Have you ever attempted to use an uncalibrated sensor before? If the answer is yes, then you have probably seen that the measurements from an uncalibrated sensor do not necessarily match reality. The calibration process allows us to match a measurement with the real value of the magnitude measured. Let's see how this affects us!

Uncalibrated readings and need of calibration

In an ideal world, the sensor will produce an output that will be linear within the whole measurement range. The accelerometer uses a 16-bit register to store the accelerometer measurements for each axis, i.e. they can have 65536 different integer values within the full-scale setting. Therefore, when configured to +-2g, a reading on any axis should be "0" when the acceleration on that axis is 0g and, "-32768" when the acceleration is -2g, and "+32767" then the acceleration is +2g.
If we now go to the real world, we will probably see that the output for 0g is a non-zero value. This difference is called the "offset error". Also, if we steadily increase the acceleration on an axis, we should get proportional increases in the readings of that axis, which hardly ever happens, indeed. The ratio between the real increase in the magnitude and the increase obtained in the readings is called the "gain error" or the "scale factor", meaning the slope of the linear response is not exactly "1". By multiplying a reading by its scale factor, we can obtain the real acceleration.
As you can see in the image on the right, the uncalibrated readings of the accelerometer and magnetometer make an ellipsoid instead of the expected sphere and, the projections of this ellipsoid over the different plans defined by the axis are ellipses. This is due to the fact that the axis scale factors are not the same for each axis (if the scale factors where the same, we would be seeing a sphere here). In the same way the offsets are not the same for the different axis, the center of the ellipses are not 0.
I hope by now you have realized how important calibration is.
So, let's start the calibration process!

Calibration process

To calibrate Kyneo, we must rotate it in several directions to obtain the ellipsoid we were talking about. The board should be turn around the accelerometer to avoid axial accelerations from the turns but, as long as you do it slow enough, there is no problem on rotating it around a point that is a bit off the accelerometer. An ellipsoid is defined by three ellipses. The algorithm used during calibration takes the maximum ellipses that result of the projections of the ellipsoid on the plans and calculates the scale factor for each axis in order to transform the ellipsoid into the expected sphere. In order to obtain these ellipses, we need to rotate the Kyneo as shown in the image below. The more turns we do, the better precision we will get as we increase the number of samples.

Results after calibration

In the image on the right you can see the spheres we were talking about. Through the calibration process, we get the different offsets and scale factors. By applying those to the data we obtained for the calibration, we transform the ellipsoids into spheres, showing the transformation that any measurements would go through by using the calculated parameters. As you can see in the images below, the calibration drastically improves the quality of the data. Note that we got the scale factors to obtaining axis-normalized data (the radius of the spheres is now 1). If you need to use different units, you'd have to make a later conversion.

Link to software repository

You can find all the necessary software to replicate this and many more things on our github repository at GEKO Navsat Github's repository
Posted in Proyects, Tutorials.