Il giorno sabato 4 novembre 2017 20:25:34 UTC+1, Björn Lundin ha scritto:
> Hi!
> I got a GY-521 (or MPU-6050) for reading movement.
> I connect it to pin 1,3,5,6 (vcc, SDA, SCL, Ground) as most tutorials
> suggest.
> I have enabled I2C
> I find the device with
>
> pi@raspberrypi:~ $ sudo i2cdetect -y 1
> 0 1 2 3 4 5 6 7 8 9 a b c d e f
> 00: -- -- -- -- -- -- -- -- -- -- -- -- --
> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
> 70: -- -- -- -- -- -- -- --
>
> I can read the device id
> pi@raspberrypi:~ $ sudo i2cget -y 1 0x68 0x75
> 0x68
>
> but I get 0x00 for the x/y/z and ax/ay/az values whatever I do
> pi@raspberrypi:~ $ sudo i2cget -y 1 0x68 0x44
> 0x00
> pi@raspberrypi:~ $ sudo i2cget -y 1 0x68 0x43
> 0x00
> pi@raspberrypi:~ $ sudo i2cget -y 1 0x68 0x3b
> 0x00
> pi@raspberrypi:~ $ sudo i2cget -y 1 0x68 0x3c
> 0x00
>
>
> using
>
https://raw.githubusercontent.com/Tijndagamer/mpu6050/master/mpu6050/mpu6050.py
> I get
> pi@raspberrypi:~ $ sudo python mpu6050.py
> 36.53
> Traceback (most recent call last):
> File "gyro_test.py", line 247, in
> accel_data = mpu.get_accel_data()
> File "gyro_test.py", line 139, in get_accel_data
> x = self.read_i2c_word(self.ACCEL_XOUT0)
> File "gyro_test.py", line 71, in read_i2c_word
> high = self.bus.read_byte_data(self.address, register)
> IOError: [Errno 121] Remote I/O error
>
> So it reads temp, but get 0 back (get_temp adds 36.53)
> and crashes on reading ACCEL_XOUT0 which is 0x3B.
> Which was read to 0 by i2cget, unless that handles read error of course.
>
>
so you can communicate wiith the device, but the device seems not working
correctly.
Either is broken or you need the read the datasheet of the device in order to
learn how to set it up so it starts takeing measurements.
Bye Jack
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|