python - Relationship between I2C operating frequency and sample rate setting in MPU6050 -



python - Relationship between I2C operating frequency and sample rate setting in MPU6050 -

i interested in reading gyroscope info raspberrypi , python confused how set sample rate of mpu6050 (accelerometer, gyroscope;datasheet mpu6050) according i2c clock frequency in order avoid wrong reading info (for illustration reading while there not info in buffer or reading faster writing, , on), in knowledge each measure 16 bit word.

is there relationship between 2 clocks?

i did project same chip 18 months ago. haven't touched pi since then, don't know how things may have changed in meantime. in event, used smbus read chip. few things found out hard way, reading individual registers slow compared i2c block read. also, had turn off sleep mode. sorry don't have info on clock timing, if trying read loop, might help. don't have utilize numpy, if plan manipulate samples, it's quite helpful. gl/hf.

import smbus import numpy # initialize bus = smbus.smbus(1) # turn off sleep mode bus.write_byte_data(0x68,0x6b,0x00) # reading in info (this can in loop or function call) sample = numpy.empty(7) r = bus.read_i2c_block_data(0x68, 0x3b, 14) sample[0] = (r[0]<<8)+r[1] sample[1] = (r[2]<<8)+r[3] sample[2] = (r[4]<<8)+r[5] sample[3] = (r[6]<<8)+r[7] sample[4] = (r[8]<<8)+r[9] sample[5] = (r[10]<<8)+r[11] sample[6] = (r[12]<<8)+r[13]

python raspberry-pi gyroscope i2c

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -