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

时间:2017-06-15 09:46:52

标签: arduino mpu6050

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 个答案:

答案 0 :(得分:1)

完整回答以便关闭此问题:

  1. 在串行监视器中选择了错误的波特率。草图MPU6050_DMP6.ino以115200波特的波特率输出,MPU6050_raw.ino以38400波特率输出,但串行监视器设置为9600,导致UART接口失效并产生垃圾字节。
  2. MPU6050上的引脚AD0用于选择I2C地址的低位。该引脚应上拉至VCC或下拉至GND。在这个例子中,它没有连接/浮动,这导致设备没有稳定的固定I²C地址。通过将AD0与GND连接来解决此问题。