motionApps mpu6050 DMP roll drift

been googling for an hour but had no luck.

I have built a small attitude indicator for use in an aircraft. For the attitude sensing I

am using the MPU6050 and the i2cdev mpu6050 library. I am using the DMPGetPitchRollYaw functiont to get the orientation.

The problem is that the gyro reading are corrected with the accellerometer readings. This is fine on the ground, but in an aircraft you can do a balanced turn, where the aircraft is rolled to say 30 degrees, but inside the aircraft, the gravity vector is straight down through the floor (internal reference). The value is then corrected because it thinks its level and hence displays an incorect value.

You might think well just use the gyros, but then over a long period of time it will drift. What i need to do is reduce the rate of which the accelerometer adjusts the reading. quickly within the first 30 seconds, then a very slow rate, just enough to correct drift, but not too much that it correctsd for turns.

Anyone know if this can be done?

The MPU-6050 is obsolete and does not perform as well as more modern IMUs, and the DMP is not under user control.

If you want to stick with the MPU-6050, ignore the DMP and do the rate gyro offset calibration and integration yourself. The gyro drift rate depends on temperature, age, power supply voltage and other factors, so it needs to frequently be recalibrated.

Thanks for the comment. Any modern sensors you can recommend?


The LSM6DSOX is a great (modern) one, but it will likely produce an error as well, though smaller. I think you'd be better off getting a 9-dof IMU and running a fusion algorithm like the mahony filter instead. Alternatively, use a BNO055 to get the data without needing to run the data onboard your microcontroller.