HMC5843L and Fusion Algorithm

By alvaro_canivell , 17 October 2011

I'm using MPU6050 with magnetometer HMC5843L connected on the secondary I2C, so it is fully controlled by MPU.
I can read magnetometer data within main loop calling function "inv_get_external_sensor_data". Data looks to be correct.

Here i noticed the first strange behavior. I put the sensor on the horizontal plane with Z axis pointing down and I slowly rotate the device.
X magnetometer data keep decreasing slowly while I'm slowing rotating the device. When X reaches 0 magnetometer data stops to be updated so X, Y and Z remain freeze. I keep rotate slowly the device in the same direction and after around 175 degrees X starts again to increase from zero ti its maximum value (215 in my case) while rotating; then starts to decrease to zero then stops for the following 170 degrees. The same is true if MPU is positioned with Z axis point up.

Why magnetometer data are not updated in those 175 degrees?

In my second test I switched from reading magnetometer data to reading quaternion.
Here I have the second strange behavior which - I think - could be a consequence of the previous one.

In my 3D model I set the zero position for the device. If I shake the device with a maximum angle of 50 degrees in any direction (I did not tried with more), zero position is kept correctly. But if I rotate slowly the device on the horizontal plane, after 2 or 3 complete rotations I get an error offset of around 5 degrees with respect original device zero position.

Could anybody explain this?
While shaking fast doesn't have problem while rotating slowly produces absolute positioning errors?

Thanks for any suggestion.
Paolo.

phpbb Topic ID
13872