Arduimu magnetometer calibration

Hi,

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

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

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?

  • Don't worry about it. The cod ewill handle it. The yaw axis is stabilized by the Magnetometer. Or else get a real compass and calibrate it with your eye. Right or left or only is up to you...:)
  • Christophe,

    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
  • Here's my code. I changed the formatting somewhat so I could read it easier. The matrix multiply routine and matrix storage method has been changed too. This was to accomodate matrix mulitplys in various dimensions. This also forced changes in the vector library.

    Not the cleanest code, I've been away from C programming for a while, but I believe it's working as intended.

    myRazorAHRS.zip

  • Didn't even see that that "Upload Files" link on the bottom of the page, will upload the code when I get home this evening.

    John
  • Christphe,

    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
This reply was deleted.

Activity