MPU6050 not connecting with Thonny or VSCode #15754
Replies: 3 comments
-
What library are you using? 0x68 is pretty much the standard address for these devices. Does you board have pull-up resistors? Please don't forget to post code between triple backticks (see the Welcome message for details) so we can read it |
Beta Was this translation helpful? Give feedback.
-
The driver is evidently this one. To throw the
See (for example) this thread. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your help. Yes, I think my MPU6050 s are incompatible. I’m
obtaining more from a more reliable source.
…On Sun, Sep 1, 2024 at 12:34 PM Peter Hinch ***@***.***> wrote:
The driver is evidently this one
<https://github.com/micropython-IMU/micropython-mpu9x50>. To throw the
MPUException at line 158 the device has been recognised in an I2C scan,
but is failing to communicate when reading the chip ID register. There are
two possibilities:
1. An electrical problem making I2C communication unreliable As @scruss
<https://github.com/scruss> suggests, check that you have pullup
resistors on both lines.
2. The chip is a Chinese clone. These exist, and don't always work as
well as an InvenSense chip.
See (for example) this thread
<micropython-IMU/micropython-mpu9x50#25>.
—
Reply to this email directly, view it on GitHub
<#15754 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A7EQQ3IZC3GKAOKE3TZDS6LZUM6Y7AVCNFSM6AAAAABNOASHFOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANJRGMZDSNA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
I'm hoping someone can offer some insight. I have made numerous attempts to connect to my Pico a MPU6050(accepts p to 6 vollts-tried both 3.3 and 5 V)I have changed the chip address in the imu.py library to reflect mine. I get this persistent error( I thought I addressed the 'chip_id' in line 158 by changing the i2c address to mine, and the libraries are recognized in the REPL, etc.) :
I2C SCANNER
i2c devices found: 1
I2C hexadecimal address: 0x68
Traceback (most recent call last):
File "", line 19, in
File "/lib/imu.py", line 105, in init
File "/lib/imu.py", line 158, in chip_id
MPUException: I2C failure when communicating with IMU
this is the simplified program I am trying to run:
from imu import MPU6050
from machine import I2C,Pin
import time
i2c=I2C( 0,sda=Pin(16), scl=Pin(17), freq=400000)
print('I2C SCANNER')
devices = i2c.scan()
if len(devices) == 0:
print("No i2c device !")
else:
print('i2c devices found:', len(devices))
for device in devices:
print("I2C hexadecimal address: ", hex(device))
time.sleep(.2)
mpu = MPU6050(i2c)
while True:
xAccel=round(mpu.accel.x,1)
yAccel=round(mpu.accel.y,1)
print('x: ',xAccel,' G ', 'y: ',yAccel,' G')
time.sleep(.1)
Using Thonny as well as VS code with micro-pico ( I tried commenting out the body of the def chip_id and setting a fixed id without success(just gave a different error- possibly I flubbed that effort)
Beta Was this translation helpful? Give feedback.
All reactions