Openxsensor magnetometer calibration

Development & General Chat for the superb openxvario project.

Moderator: rainer

Post Reply
Drashiel
Posts: 8
Joined: Sun Nov 22, 2015 8:12 pm
Country: -

Openxsensor magnetometer calibration

Post by Drashiel »

Hi,
How can I calibrate my compass on a GY-86 module? URL comes on description to parse samples are not available.
I get those values on debug:
-326 , -54 , 423 - -169 -15 71 ==> 176
-325 , -57 , 422 - -168 -31 -58 ==> 51
-325 , -56 , 422 - -168 71 18 ==> -134
-324 , -55 , 420 - -168 -17 54 ==> 175
-326 , -57 , 420 - -168 74 -6 ==> -134
-326 , -57 , 420 - -168 35 -30 ==> -125
-327 , -58 , 418 - -168 53 33 ==> -139
Is the last value on every row heading?
I did ACC calibration prior enable debug on compass.
Thanks.
Regards.

ChrisOhara
Posts: 34
Joined: Mon Feb 01, 2021 11:56 am
Country: Germany

Re: Openxsensor magnetometer calibration

Post by ChrisOhara »

Hello
do you still need support?
I've just done the procedure and think I could help.
(did found a easy to use software/code to)
regards Chris
ChrisOhara
Posts: 34
Joined: Mon Feb 01, 2021 11:56 am
Country: Germany

Re: Openxsensor magnetometer calibration

Post by ChrisOhara »

Hello

First step is to uncomment this line in the oXs_config_advanced.h file

//#define GENERATE_MAG_CALIBRATION_DATA // uncomment this line when HMC5883 calibration has to be performed.

Then you get in the serial monitor something like this.

1815 5760 -4107
1665 5720 -4082
1672 5740 -4112
1712 5665 -4127

You have to revolve the Sensor slowly around (like a ball, all possible positions)
You should have at least 1000 measurements, the more the better.
You copy the data from the serial monitor into a text file (use editor for example).
Keep in mind that the magnet field at a given point is a stable vector.
(Please avoid to be near something that generates technical magnet fields, best is to be outside).
Theoretical what you get with a perfect sensor would be points that describe a sphere with the center (0,0,0). In fact you now need a program that moves the center to (0,0,0) (axis calibration) and calculates a matrix so that the ellipsoid shape is calibrated to a ball.
The best known program for this Magcal , but the URL is no more available in the net.
I found this Site: https://sites.google.com/site/sailboati ... ementation
The site offers different links were you could download all necessary C source files to put together the program.
But you should be familiar with C and need a C-compiler.
It doesn't have a graphic interface but it works (at least for me)
And it reads the date as provided by openXsensor with the result as required.

Example (copied from screen)

-1380.142081
5135.376362
-963.853420
0.000097 -0.000000 -0.000001
-0.000000 0.000096 -0.000000
-0.000001 -0.000000 0.000098

Regards Chris

Post Reply

Return to “OpenXVario - an open source vario supported by the open source firmwares!!”