MPU6050's sample rate and I2C frequency

Hello,

I have a doubt about the setting of I2C speed and the sample rate in a sensor like MPU6050. Is there a relationship between them ? How to set them correctly ?

This doubt derives from a thread I have read on this forum:

http://forum.arduino.cc/index.php?PHPSESSID=oku5ugea6fa742b2oo00jjuis2&topic=102796.0

where the user says he reads data at a different sample rate than that setted (eg: with 400kHz of I2C he reads sample at about 2.8kHz.

My sensor (MPU6050) is similar to that about the maximum sample rate of 8kHz and the I2C protocol for communication. Thanks in advance.

Your MPU allows a sample rate of 8kHz only for the gyrometer, the accelerometer allows only 1kHz.

Given you use 400kHz I2C speed, the highest data rate to read all values is theoretically 2.61kHz, 2.96kHz if you omit the temperature reading (15 bytes must be transmitted, needing 9 clocks each). That's a theoretical maximum that is practically never reached. If you read only the gyro values (as the accelerometer values aren't that fast anyway) you may reach about 7kHz.

What do you want to do with these high speed readings? Do you really need them? What software do you use (standard libraries won't be near these maximum values)?

I am sorry I do not understand how do you have done that calculation: 400kHz ---> 2.61kHz or 2.96kHz, why 9 clocks each ? Thank you for the patience.

I am using python and smbus library

Gmork: I am sorry I do not understand how do you have done that calculation: 400kHz ---> 2.61kHz or 2.96kHz, why 9 clocks each ? Thank you for the patience.

400 / 17 / 9 = 2.61

To read out all values you need to transfer 17 bytes over the I2C bus if you use sequential read and transmitting one byte needs 9 clock cycles (8 bits and the acknowledge signal)

I am using python and smbus library

Hmmh, so I guess you took the wrong forum. Python doesn't run on the Arduino. My calculations were for a microcontroler like the Arduino that has hardware support for I2C. Most embedded Linux systems do I2C using bit-banging so you won't reach the maximum bus capacity, probably won't even come near to it.

I am using python and smbus library

So what has this to do with an Arduino?


Rob