Easy magnetometer calibration

Firmware/software/electronics/mechanics
Post Reply
aholler
Beginner
Posts: 4
Joined: Thu Jan 02, 2014 10:55 pm

Easy magnetometer calibration

Post by aholler »

Hello,

having read the readme of the magnetometer of calibration (as proposed by Anton Krasovsky) the first thing I thought was that I don't want to go through the pain of installing Java and Processing. So I did a little search and sailboat people come to the help:

https://sites.google.com/site/sailboati ... ementation

I already have tested it, and it works great. Usage is actually pretty simple. Just put the raw values (as they come from the magnetometer) into a file called mag.txt, call Magneto (it's pretty simple to compile the c source) and it will display the necessary values needed for calibration. To use them one just need a vector addition and a simple matrix x vector multiplication (Magneto will display a ready to use matrix, no need to calc the inverse).

Works pretty good and is really easy to use (at least compared with the stuff which uses Processing).

What's left is to add some calibration in regard to the motor power (I've seen the heading changes a few degree when the motors are powered).

Have fun,

Alexander Holler

PS: Using Magneto to calibrate the accelerometer values can be done too, but I have to read a bit more about that.
Dave
Beginner
Posts: 9
Joined: Sun Nov 03, 2013 9:30 pm

Re: Easy magnetometer calibration

Post by Dave »

aholler wrote: I already have tested it, and it works great. Usage is actually pretty simple. Just put the raw values (as they come from the magnetometer) into a file called mag.txt, call Magneto (it's pretty simple to compile the c source) and it will display the necessary values needed for calibration. To use them one just need a vector addition and a simple matrix x vector multiplication (Magneto will display a ready to use matrix, no need to calc the inverse).
When you say it works great what do you mean?
Why not do the calibration in real time on the crazyflie itself?
aholler wrote:PS: Using Magneto to calibrate the accelerometer values can be done too, but I have to read a bit more about that.
You can get the code for AHRS from here - it looks very similar to the code in senfusion6.c

http://www.x-io.co.uk/open-source-imu-a ... lgorithms/
aholler
Beginner
Posts: 4
Joined: Thu Jan 02, 2014 10:55 pm

Re: Easy magnetometer calibration

Post by aholler »

Dave wrote:When you say it works great what do you mean?
That the calibrated values are looking fine afterwards and are directly usable to calculate the heading.
Dave wrote:Why not do the calibration in real time on the crazyflie itself?
The amount of available (free) RAM isn't enough. You need to collect a bunch of values and you need additional RAM for the calculations too. Don't forget, the crazyflie only has 20kb RAM. To give you some values, the files with values I've produced for calibration are having about 1000 lines, each with 3 values. That already makes about 6kb, just for the collected values.

With some fiddling it might be be possible (e.g. reusing large parts of the RAM just for the calibration phase), but ...
Dave wrote:
aholler wrote:PS: Using Magneto to calibrate the accelerometer values can be done too, but I have to read a bit more about that.
You can get the code for AHRS from here - it looks very similar to the code in senfusion6.c

http://www.x-io.co.uk/open-source-imu-a ... lgorithms/
I didn't speak about using a 9-axis sensor fusion algorithm, but about calibrating the accelerometer values too. I'm not sure if it would make a difference when calibrated accelerometer values are used, but maybe.

Of course, using a 9-axis sensor fusion algorithm is something I want to test too, but I assume first some additional correction is needed to get rid of the influence of the motor power on the magnetometer values. As said, the magnetometer values still do change when the motors are powered (the calibration is made for a static environment) . I'm not sure if the changing values (through motor power) will really influence the fusion algorithm, but that needs testing (and spare time ;) ).

Alexander Holler
Post Reply