4x MPU6050 not working
I have a project to finish soon and im using acceleration sensors ( MPU6050 ), I know that one of these sensors has 2 addresses and im using 2 busses ( bus 0: SDA0 21, SCL0 22 and bus 1: SDA1 19 SCL1 18 ) and still somehow it doesnt work and I cant figure out how to fix the issue not even with AI.
I want them to all work at the same time.
1 Reply
Have you gotten one sensor to work at a time?
Best thing I find when having issues is test one thing at a time. Then add see if it works , been awhile since I used a 6050, are they i2c ?
From your sketch I am assuming you are, also this looks incorrect
#define MPU1_ADDR 0x68 // Bus0 - AD0 = GND
#define MPU2_ADDR 0x69 // Bus0 - AD0 = VCC
#define MPU3_ADDR 0x68 // Bus1 - AD0 = GND
#define MPU4_ADDR 0x69 // Bus1 - AD0 = VCC ,
I2C is a shared bus meaning both device connect to the same pins, id assume your using an Arduino uno. You can try this sketch I generated but you need the mpu6050 library installed https://claude.ai/public/artifacts/580c7d93-093d-4463-9287-5644e99e9e44
Wiring Configuration:
For different I2C addresses (recommended method):
MPU6050 #1 (Address 0x68):
VCC → 3.3V or 5V
GND → GND
SCL → A5 (Arduino Uno) or Pin 21 (ESP32)
SDA → A4 (Arduino Uno) or Pin 20 (ESP32)
AD0 → GND (or leave floating)
MPU6050 #2 (Address 0x69):
VCC → 3.3V or 5V
GND → GND
SCL → A5 (Arduino Uno) or Pin 21 (ESP32)
SDA → A4 (Arduino Uno) or Pin 20 (ESP32)
AD0 → 3.3V or 5V (this changes the address to 0x69)
Required Library:
Install the MPU6050 library by Electronic Cats or Jeff Rowberg through the Arduino Library Manager.
I'm sorry just realized you are using 4 not 2 mpus
upon further research you can not use 4 mpu6050 unless you get an i2c multiplexer. MPU 6050 have only 2 address which means you run out of addresses. You could also try to use comething like an esp32 or teensy as they have multiple i2c and esp can software i2c as well.