This is the equation

angle += gyroRate * dt

Recently, I just bought the MPU 6050 and been no problem playing around with it. Until, i ran into the problem which i do not understand how to determine the "dt" in the equation of converting raw gyro data into angle. So, any Masters here can help a little bit on this?

This is the equation

This is the equation

angle += gyroRate * dt

dt is "delta time" meaning the change in time.

In this case it means how long has elapsed since the gyro reading was last taken. The value of this can either be calculated by recording the current time when you take a reading and comparing it to the last time or it can be a fixed value if your system reads the gyro consistently at 50Hz for example.

The gyro reads how far the unit has rotated as a measure of radians per second, this is the gyro rate. To calculate the angle you multiply the gyro rate by the amount of time elapsed (dt) and add the change in angle on to the last angle reading.

In this case it means how long has elapsed since the gyro reading was last taken. The value of this can either be calculated by recording the current time when you take a reading and comparing it to the last time or it can be a fixed value if your system reads the gyro consistently at 50Hz for example.

The gyro reads how far the unit has rotated as a measure of radians per second, this is the gyro rate. To calculate the angle you multiply the gyro rate by the amount of time elapsed (dt) and add the change in angle on to the last angle reading.

Electronic and Computer Engineer

Pi Interests: Home Automation, IOT, Python and Tkinter

Pi Interests: Home Automation, IOT, Python and Tkinter

Hi scotty101,In this case it means how long has elapsed since the gyro reading was last taken. The value of this can either be calculated by recording the current time when you take a reading and comparing it to the last time or it can be a fixed value if your system reads the gyro consistently at 50Hz for example.

Can i know how can i make the system reads the gyro consistently? Is it just to make a loop and limit it to 100 times?

Yep a loop will work. Could be an infinite loop or as your say you could just loop 100 times

(Or as many as you want)

If you put a small delay in the loop it will slow down how often the sensor is ready and increase dt.

(Or as many as you want)

If you put a small delay in the loop it will slow down how often the sensor is ready and increase dt.

Electronic and Computer Engineer

Pi Interests: Home Automation, IOT, Python and Tkinter

Pi Interests: Home Automation, IOT, Python and Tkinter

Hi scotty101,

If i use the infinite loop then what would be the "dt"? If i used a 100 times loop the "dt" would then be the time used for the loop right, so a timer is needed?

If i use the infinite loop then what would be the "dt"? If i used a 100 times loop the "dt" would then be the time used for the loop right, so a timer is needed?