arduinompu6050

MPU6050 doesn't seem to give values properly and no i2c devices found error thrown


I am using MPU6050 with arduino. It reads something but not numerical values!

1- Connections are the same as in below.

enter image description here


2- Then I added i2cdev library from here and mpu6050 library from here

I copied them to C:\Program Files\Arduino\libraries.


3- I tried DMP6 example and it gives random charactersenter image description here


4- I tried MPU6050_raw example . You can see it constantly gives same characters but not numerical valuesenter image description here

5- Here, I saw this topic MPU6050 DMP does not work? and uploaded i2c_scanner to device. It says "No I2c devices found". Why?

6- I saw another topic https://forum.arduino.cc/index.php?topic=404031.0 just the same as in my case. I also tried the code there, it seems working but it gives constantly -1 for accelerometer and gyro values even though I move MPU6050.


Solution

  • Complete answer so that this question may be closed:

    1. The wrong baud rate was selected in the serial monitor. The sketch MPU6050_DMP6.ino outputted at a baud of 115200 baud and MPU6050_raw.ino at 38400 baud, the serial monitor was however set to 9600, causing de-synchronization of the UART interface and the resulting garbage bytes.
    2. The pin AD0 on the MPU6050 is used to select the lower bit of its I2C address. This pin should be either pulled up to VCC or pulled down to GND. In this example it was however left unconnected / floating, which causes the device to not have a stable fixed I²C adress. This problem was fixed by connecting AD0 with GND.