MPU6050 z-axis gyro arrrrgghhhhh

Hi
Does anyone have any exp with the MPU6050?
I'm having problems getting the Z-axis on the gyro to behave.
I get good readings and have managed to get a repeatable stable reading on startup.
If I rotate the IMU slowly I get resonable accurate results. My problems start if I move the IMU quickly or with jerky movements. This throws my reaults out.

To get a value I apply the following:
Yaw = yaw + ((gz * dt/1000000) + mod)

Where :
Mod = value to account for start up reading error. Currently 0.84.
dt = change in time uS
gz = gyro z axis output ( this has been averaged over 2 readings) i.e (gz1 + gz2) /2 = gz

Thabks
Danny

Help me obe one kenobi .... :confused:

R2 ??

Does anyone know what one + two is?

try plotting (max serial speed) the raw gyro data to close in on the problem

Thanks for the help......

You are using the simplest and least accurate method of numerically integrating the gyro output, and it is likely that "dt" is not properly defined.

The errors that can crop up in the process depend on the sampling rate and the method of integration. This is very well understood, so I recommend some refresher reading.