Calibrating the Magnetometer

Why trim the magnetometer (MAG)?

The magnetometer is a digital compass and is used in the MAG and HEADFREE flight features. A properly calibrated MAG will ensure these features work properly. The MAG cannot be calibrated at the factory because the earth magnetic lines vary depending on where you live and even changes from year to year.

The digital compass on the quadrino has 3 axii but fortunately all 3 axii are easily calibrated together. Why is the compass 3 axii? Well, when you were back in scouts you used a compass that was a single axis, it worked in only one orientation. You had to lay the compass flat on the ground, or level in the air in order to get a proper reading. If you held it straight up or banked sideways it wouldnt work! However, our 3 axii compass will and must work in any orientation. Thus, our digital compass is like having 3 regular compasses at 90 degrees to each other. No matter what the orientation one of those compasses will work properly.

Perform your acc calibration first! 

Before continuing through this tutorial ensure you have already calibrated your accellerometer (ACC). The ACC is already calibrated by us as part of the testing process so if held flat on a table the ACC reading for Z axis should be around either 256 or 512 (+/- 6 points) and the ROLL and PITCH should be near zero. Given that tables are not perfectly level being a little off is normal.

CALIBRATION

In the ACC calibration you want to hold the board very still while the calibration process is performed. With MAG calibration the complete opposite is true, you want to reach every possible orientation possibly within the 30 second calibration time frame. this is the biggest mistake new users make in MAG calibration, they keep the Quadrino perfectly still and 30 seconds later the compass heading starts behaving very strangely, ...strangely indeed. I'll explain more...

[inset side="right" title="The biggest mistake"]new users make in MAG calibration is keeping the Quadrino perfectly still and 30 seconds later the compass heading starts behaving very strangely.[/inset]

When you are ready hit the CALIB_MAG button. This starts the calibration process and you now have 30 seconds to orientation the board in as many positions as possible. Notice the yellow light blinks very fast to indicate the MAG calibration is in progress. The calibration process is not picky as to which way you move about through the different orientations, but here is a good step by step to achieve good calibration:

  1. Begin by rotating the copter 360 degrees passing through North, East, South and West.
  2. Now flip the board over 360 degrees in the roll axis, then undo the flip back to normal.
  3. Now flip the board end-over-end in the pitch axis a complete 360 degrees, then undo the flip back to normal
  4. Now wave the board around in the air as if you were actually flying around outside, back and forth, side to side, up and down.
  5. Stop when the yellow light stops blinking and returns to normal, 

You are now fully calibrated! :)

VERIFYING YOUR CALIBRATION

Now that you are calibrated, the compass indicator in the MultiWii Config should operate smoothly and accurately as you rotate your copter through North, East, South and West. Try it. There should be no twitching, quick jumps in heading, or reversals, just exactly how you would expect a normal compass to perform. Even if you snap from (say) North to East, or North to West the indicator should immediately snap to the new heading without any post drift.

How the magnetometer sensor works

In our real world there is a sea of magnetic interference. Within this sea of magnetic interference is the weak earth magnetic lines we are trying to detect. We are talking a typical magnetic reading of 0-250 within a static reading of 10'000. In other words, the compass will read a value between 10'000 and 10'250 and we want to remove the unwanted 10'000. The calibration process can detect and remove this static magnetic reading but we must orientate the copter in every pitch and roll angle so that it can determine what is static and what is the earth (North).