After receiving my replacement magnetometer I think I've finally got it working. However, when I try and calibrate the offsets in the CLI (by waving it every which way) only the x and y values change while the z stays at 4096. As a result my offsets are normally around 128, 86, -2048. Is this normal?



Views: 163

Reply to This

Replies to This Discussion

Thanks for your question.

I am a bit bemused by the calibration too.

Whenever I re-calibrate by twisting and turning I end up with a different set of values

I am not sure what the values mean - maybe someone can elaborate.

Glad I'm not the only one, John! Have you seen Jani's video where he demonstrates the calibration? It might help a bit:

I'm just worried I may have another damaged magnetometer.

I've also noticed the heading shown in the artificial horizon screen of the configurator seems to jump around a lot (+/- a degree or two), even with the mag enabled. Is that normal?


jumping around a degree or two is pretty normally actually.  You'll never notice once you're actually flying and heading and GPS pos hold should work fine.  I think magnetic fields are just a bit like that.


If you lean the quad over you'll likely see the heading change by 10~15 degrees.  You should only worry if you lean it over and it changes by a lot more (like 40 degrees) because this indicates that you've got your orientation set incorrectly in the code or haven't done the offset stuff correctly. 


good luck!

it shouldn't matter if the numbers are a bit different (i.e. a 20 value difference is no problem).  If they're off by more than 50 then it's likely that you didn't do the calibration correctly (i.e. didn't point each arm at magnetic north) or perhaps you've moved something metallic near the compass.


re the meaning of the calibration values... a bit of background that you may already's a 3-D compass so it returns a 3-D vector (i.e. an arrow) pointing at magnetic north (from it's point of view).  So if you pointed the front of the mag directly at magnetic north (which is likely nearly straight down into the ground) it's x,y,z values would likely return something like 0,400,0 (i think).  if you pointed the flat bottom of the mag at magnetic north it would return something like 0,0,400. 


now you'd think that if you pointed say the front at magnetic northa and it returned 0.400,0, then if you pointed the back of the compass at magnetic north (i.e. perfectly turned it around 180 degrees) it would return 0, -400, 0.  But it won't!  it will return somethign like 0, -380, 0.  This 20 point difference tells you that middle value (the Y value) has a 10 point bias.  so the offset would be -10.  if you set this to be your Y-offset then when you repeated the above test it would return 0,390,0 and 0,-390,0.


Another way to think about it is to ask what would the compass return if you put it off in space where there are absolutely no magnetic fields?  It wouldn't return 0,0,0.  it would return some small-ish values close to 0 like 30,-40,15.  In this case we would make this mag's offsets -30,40,-15 to correct this internal bias.


Reply to Discussion


© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service