cancel
Showing results for 
Search instead for 
Did you mean: 

6-point Calibration of Magnetometer

CGrov.1
Associate II

I am trying to calibrate a magnetometer using the 6-point tumble calibration described here: https://www.st.com/resource/en/design_tip/dm00253745-6point-tumble-sensor-calibration-stmicroelectronics.pdf

I am getting confused when that method is applied to the magnetometer. I have measured the ambient magnetic field in the X, Y, and Z, directions. +X = 177miligauss, +Y = +11miligauss, and +Z = +446miligauss.

When I apply this to the formulas, for position 1 (+X) I can put my values as Xactual=177, Yactual=11, and Zactual=446. When I go to put it in position 2 (-X) I can either rotate around the Y-axis, and get Xact = -177, Yact=11, and Zact =-446. Or I can rotate around the z-axis and get Xact=-177, Yact= -11, and Zact=446. Both methods will yield different results and this problem is persistent for all six positions.

I think that the solutions for the matrix values should be the same for both sensors. So that the X1 + X2 = 2Xoff which is true for the accelerometer, should also be true for the magnetometer. But I have not been able to prove that on paper.

Any insight would be greatly appreciated.

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @CG.1roves​ , which specific magnetic sensor are you using? Usually, for the magnetic sensor calibration. Procedure are described in the DT0059 app note. This because for 6-tumble calibration, positioning the sensor accurately is required. However, for the ellipsoid fitting described there, there is no need to know the true stimulus of the sensor, as the only requirement is that the modulus of the true stimulus be constant (square root of sum of squares of X, Y, and Z). And this procedure should better fit the magnetometer calibration. I suggest you to check also the MotionMC magnetometer calibration library in X-CUBE-MEMS1 function pack, dealing with the real-time magnetometer calibration using hard iron (HI) and scale factor coefficients to correct magnetometer data. Suggested also the lis2mdl_hard_iron.c on Github fyi. Regards