So I know that the APM has Magnetometer Calibration(finding the offsets) built into the code but the ArduIMU v3 does not. Does anyone have the link to that snippet of code that calibrates the offsets?
Thanks,
Daniel
You need to be a member of diydrones to add comments!
I just went through this whole pain to figure out the magnetometer this weekend. You basically should rotate the device in a circle and plot the values coming off on the X and Y axis. They will look like sinusoidal sweeps that are offset by a 90 deg phase. You need to offset (bias) each sweep signal up or down such that it is sweeping around 0. Doing this will allow the arctan to be taken to determine a reasonable heading angle. You can then flip the unit on its side and do the same with the Z axis. I personally found that my X axis median was pretty near zero by my Y and Z both needed biasing. Additionally I found that the amplitude that my z axis was making was smaller than the other axes so I threw a gain on just the Z axis in the code. Afterward I compared my heading calculations with a $5 compass I bought at the store. I found the compass app on my iphone was an absolutely horrible truth source to try and check with.
Replies
Daniel,
I just went through this whole pain to figure out the magnetometer this weekend. You basically should rotate the device in a circle and plot the values coming off on the X and Y axis. They will look like sinusoidal sweeps that are offset by a 90 deg phase. You need to offset (bias) each sweep signal up or down such that it is sweeping around 0. Doing this will allow the arctan to be taken to determine a reasonable heading angle. You can then flip the unit on its side and do the same with the Z axis. I personally found that my X axis median was pretty near zero by my Y and Z both needed biasing. Additionally I found that the amplitude that my z axis was making was smaller than the other axes so I threw a gain on just the Z axis in the code. Afterward I compared my heading calculations with a $5 compass I bought at the store. I found the compass app on my iphone was an absolutely horrible truth source to try and check with.
See the MagMaster programm for the magnetometer calibration.
http://diydrones.com/profiles/blogs/advanced-hard-and-soft-iron-mag...