Sensor fusion z-axis inaccuracy

edited November 2018 in JavaScript

I am using javascript API to get sensor fusion quaternion orientation and rendering a cube, as well as the euler decomposition of rotation.

I realized that if I start turning the sensor in each axis and returning it to its starting position (i.e. making full 360º rotations in only one axis), I am not getting 0º as it should. There is an accumulative error of 3-4º, but only in the Z axis (the one pointing away from the sensor plane). The X and Y axis have <1º error.
By "accumulative error" I mean that if I turn the sensor 4 turns clockwise about the Z axis, I get between 12-16º of error, and if I turn again 4 turns counter-clockwise, it gives me again a reading of 0º approximately.

The sensors are calibrated and I tried with 2 different boards, with firmware 1.4.2, one gave 15º of accumulated error in 5 turns in the Z axis and the other gave 19º.

Making random movements (drawing an 8 in the air) with both boards on my hand for around 10-15 seconds and then returning to the exact starting position (I have 2 thick pieces of wood cut in 90º) gives me an average "error" of 4-5º in the Z axis and <1º in the X and Y axis.

I tried setting the acc and gyro range to 2,4,8G and 250, 500, 1000dps, respectively, with no noticeable effect on this issue.
I used both the mbl_mw_sensor_fusion_set_acc_range/mbl_mw_sensor_fusion_set_gyro_range and after configuring the sensor fusion, I also issued a mbl_mw_acc_set_range/mbl_mw_gyro_bmi160_set_range call with the same values to make it consistent.

I am also investigating some drift issues, which I think there are because sometimes I see that the 3D representation of rotations moved after I left the sensors static for a while, which is indicative of drifting. I don't know if they are due to the use of only acc/gyro. What do you think?


  • Do you see the same behavior if you use NDoF mode? The magnetometer can be used to correct for drift.

Sign In or Register to comment.