0
votes

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.

1
Read the code. (github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/…). It says Serial.begin(115200); for the DMP6 example so you need your Serial monator at 115200 baud, too. And Serial.begin(38400); in MPU6050_raw. Also pull AD0 to GND to fix its I2C address. When still doubt, read invensense.com/wp-content/uploads/2015/02/… .Maximilian Gerhardt
Yes, you are right. It can read some values now.Uygar Uçar
So this problem is completly solved by setting the right baud rate?Maximilian Gerhardt
It was solved by setting baud rate and pulling AD0 to GND.Uygar Uçar

1 Answers

1
votes

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.