Hi, I would like to know how to correct the tilt only to align X and Y.
I'm trying to use the HMC5883L just to detect the heading considering only rotations about Z axis. I'm not using accelerometer.
What can I do?
Thanks.
Hi, I would like to know how to correct the tilt only to align X and Y.
I'm trying to use the HMC5883L just to detect the heading considering only rotations about Z axis. I'm not using accelerometer.
What can I do?
Thanks.
The early electronic compasses all used 2D magnetometers, and the user was required to keep one level while taking a reading. In your case, just take the X and Y readings and compute the magnetic north vector. A bubble level would help to keep the X-Y plane level.
Of course you would want to make sure that the magnetometer is properly calibrated. Here is a link to my favorite procedure: Sailboat Instruments: Improved magnetometer calibration (Part 1)
I wrote a similar program for 2D magnetometers, but you have to have access to MATLAB to use it: HMC6352 2D magnetometer revisited - SparkFun Electronics