MPU6050 gyro readings don't start at 0

Hello! I am making a TVC rocket, and I am getting the orientation of the vehicle using the MPU6050. But I have a problem. When I initialize my program, the first reading I get, even while the MPU6050 is stationary, is not zero. If I was printing the x gyro, y gyro, and z gyro, an example of these values could be 1.9, -8.2, 0.88. These values change every time I start it. I cannot have this happen, as I am using PID and the values would need to be at 0. I am using the MPU6050_tockn library and am using the getGyroX() functions. I have verified that it is the fault of the sensor, not my code. The code is a bit long, so I cannot post it on here. Thanks for the help in advance!

Readings will very rarely be zero, and normal device noise ensures that the values will change from reading to reading.

There is always an offset that must be determined and subtracted, as well. Look up gyro calibration.

With the tockn library, there is a function to calculate offsets, and I have used that.

Cool.

Is this what you were talking about??

The rate gyro appears to be working correctly and as expected.

You just need to learn how to interpret the results.
What is the physical rotation rate in degrees per second that corresponds to gyroX = 1.9?
What is the average of 10 successive readings of gyroX?

https://www.youtube.com/watch?v=UxABxSADZ6U&t=178s

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.