Go Down

Topic: I2C device not detected (Read 746 times) previous topic - next topic

Brathindra

     I'm working on a project that uses the MPU 6050. I'm using the GY-521 module with the following connections to the Arduino Uno:

Vcc -> 5volt/3.3volt (I tried both)
Gnd -> gnd
SCL -> A5
SDA -> A4
INT -> digital pin 2

      I worked with this module 2 years back. It worked fine then. Now, I tried running the MPU6050_DMP6 example. I got the following messages:

I⸎Initializing I2C devices...
Testing device connections...
MPU6050 connection failed

Send any character to begin DMP programming and demo:
Initializing DMP...
DMP Initialization failed (code 1)

       I got another module and am still getting the same result. I uploaded the I2C scanner to the Uno and it couldn't detect my device. The serial monitor says "No I2C devices found".
 
     I really really don't understand what's happening... Please help me out. I looked through similar issues on the Arduino forum before posting this but none of those solved the issue.

 

Koepel

#1
Jan 13, 2018, 11:26 pm Last Edit: Jan 13, 2018, 11:26 pm by Koepel
The Arduino Uno is a 5V Arduino board. Use a I2C level shifter to connect the 5V I2C bus from the Arduino to the 3.3V I2C bus of the MPU-6050. The INT signal does not need a level shifter, but you could add one if you have a module with 4 level shifters.

You took a risk, and you probably were working beyond the specifications of the datasheet. Now something has changed. perhaps the USB 5V is 0.1V higher or lower, something like that can make it stop working.

Brathindra

Thanks a lot for the help. According to the datasheet, the GY-521 module has a voltage regulator. So, is a level shifter essential?

Koepel

#3
Jan 14, 2018, 10:15 am Last Edit: Jan 14, 2018, 10:16 am by Koepel
The level shifter is for the SDA and SCL signals.
SDA and SCL are connected to the MPU-6050 chip, which is a 3.3V chip.

When the GY-521 module is connected with VCC to 5V, the MPU-6050 runs at 3.3V, and the pullup resistors on the GY-521 are to 3.3V.
The Arduino running at 5V requires 0.7 * VCC for the I2C bus for a high level. That means 3.5V is required. The internal pullup resistors to 5V in the Arduino help a little to raise the voltage levels, but probably not enough.
Depending on the value of the pullup resistors on the module, the internal pullup resistors of the Arduino might even raise the voltage of SDA and SCL too much and damage the MPU-6050.

When you connect 3.3V to the VCC of the GY-521 module, that 3.3V has to go through a voltage regulator and the MPU-6050 will not run at 3.3V but at a little lower voltage. That makes it even harder for the Arduino to detect a high level on SDA and SCL.

In most cases it will work even when it is not okay according the datasheets. Run the i2c scanner and connect 5V to VCC of the module. If you are using a breadboard and it does not work, then bad contact of the breadboard are often the problem.

Brathindra

Thanks for the explanation. I'll try adding I2C level shifters.

Go Up