I was wondering if anyone knew how to calibrate the compass when used with the ArduIMU. I saw Bill Premerlani's code for the UAV DevBoard, it is very interesting and it would be really cool to calibrate the compass in flight by sending a signal, but it's not quite the same with the ArduIMU in the arduino code that is on google code I think.
Any idea?
Thank you in advance,
Christophe
Replies
Hi everyone,
I can see it's been a while since there's been activity on this topic. Has anyone successfully accomplished ArduIMU magnetometer calibration as John describes?
When the magnetomter is initialized, it is run thru a self test as desribed in the HMC5843 datasheet. This should output a specific set of numbers. The difference between these readings and their theoretical value (715 the way I set up the magnetometer) is the scale factor that must be applied to every set of magnetometer readings. This is done once at the beginning of each power up sequence.
The bias calculation is done every frame. I can't recall all the terms at the moment, but I believe this is referred to as the soft iron correction. The reason for doing this every frame is that the magnetic environment can vary with the varying loads on the motor/battery system, for example. This alleviates the need to do the mag cal swing you referred too.
If I understand everything correctly, this is the whole point of the algorithm described in Bill P's post., and what I tried to implement in this code.
John
Not the cleanest code, I've been away from C programming for a while, but I believe it's working as intended.
myRazorAHRS.zip
John
I've implemented the HMC 5843 scale factor adjustment and bias adjusments to the Sparkfun Razor IMU code. Should port to the arduIMU fairly easily. I just need to figure out how to post the code.....
John