arduino上的MPU 6050无法正常工作

时间:2014-12-31 23:43:50

标签: arduino

所以我试图让这个新的6dof陀螺仪和继电器工作,但我已经尝试了一切,但它无法正常工作。我的最后一站是i2cdev图书馆购买杰夫,情况更糟。我没有打印正常的字符(在uno上使用他的MPU6050_DMP6示例草图)

ÛðÙT·DWá÷

当我输入一封信时会发生这种情况

ÛðÙT·DWá÷MÌÖkO`nþ

当我尝试使用他的MPU6050_raw示例时,会发生这种情况

ààüàààààü¨¬ ±   -!-14¤¥5%µ$%¥¡0 ´¥Ç%µ!0 4¤!¡!%5´¥

它会不间断地打印。

所以我决定尝试从mpu6050上的arduino webside中的示例我不会把代码放在这里,因为它很长但是这里是一个链接(http://playground.arduino.cc/Main/MPU-6050它是最后一个示例,大约900行) 这是我得到的:

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: -164, 4758, 17040
temperature: 30.865 degrees Celsius
gyro x,y,z : 343, 361, -143, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 16732, 746, -2242
temperature: 30.847 degrees Celsius
gyro x,y,z : 874, -131, -363, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 4510, -7420, 13774
temperature: 30.847 degrees Celsius
gyro x,y,z : 1822, 2928, 8526, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: -6016, -1678, -16304
temperature: 31.018 degrees Celsius
gyro x,y,z : 32767, -21928, -20069, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 3486, 10330, -5702
temperature: 30.894 degrees Celsius
gyro x,y,z : 32767, -31308, -15464, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 3308, -9292, 6200
temperature: 30.847 degrees Celsius
gyro x,y,z : 3166, -8144, 27748, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: -320, -13024, 11298
temperature: 30.776 degrees Celsius
gyro x,y,z : 376, 462, -143, 

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: -484, -13260, 10908
temperature: 30.771 degrees Celsius
gyro x,y,z : 342, 258, -319, 

你可以看到,当我移动它时,数字变得非常巨大(至少温度是正确的)。所以我决定在同一页面上给另一个例子大约40行。而我的出局就像奇怪一样:

AcX = -682 | AcY = 2178 | AcZ = 17698 | Tmp = 27.55 | GyX = 473 | GyY = 234 | GyZ = -219
AcX = -598 | AcY = 2224 | AcZ = 17580 | Tmp = 27.57 | GyX = 550 | GyY = -59 | GyZ = -680
AcX = -756 | AcY = 2196 | AcZ = 17680 | Tmp = 27.57 | GyX = 375 | GyY = 272 | GyZ = -164
AcX = 5578 | AcY = 13118 | AcZ = 13424 | Tmp = 27.57 | GyX = 32767 | GyY = -13348 | GyZ = -1000
AcX = 1846 | AcY = 14718 | AcZ = 7596 | Tmp = 27.55 | GyX = 875 | GyY = 362 | GyZ = -32
AcX = 2216 | AcY = 14504 | AcZ = 6930 | Tmp = 27.57 | GyX = 630 | GyY = 800 | GyZ = -1125
AcX = 2390 | AcY = 14968 | AcZ = 7338 | Tmp = 27.57 | GyX = 568 | GyY = 241 | GyZ = -92
AcX = 2338 | AcY = 14928 | AcZ = 7486 | Tmp = 27.54 | GyX = 561 | GyY = 158 | GyZ = -396
AcX = 2698 | AcY = 15038 | AcZ = 7466 | Tmp = 27.55 | GyX = 1231 | GyY = 341 | GyZ = -252
AcX = 7560 | AcY = 12958 | AcZ = 11980 | Tmp = 27.55 | GyX = -32768 | GyY = 19048 | GyZ = 7243
AcX = -106 | AcY = 876 | AcZ = 16868 | Tmp = 27.53 | GyX = 890 | GyY = -442 | GyZ = -1959
AcX = -114 | AcY = 1390 | AcZ = 17586 | Tmp = 27.55 | GyX = 1534 | GyY = -281 | GyZ = -665

这与我之前获得真正巨大而奇怪的数字是一样的问题。我不认为这是deg / s,也不是deg / minute。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:3)

您的{1}}波特率可能与编码波特率不同,请检查一下。如果不是,您的代码中应该存在编码问题。

您获得的Serial Monitor值不是标准公制单位。

MPU-6050具有用户可编程陀螺仪满量程范围AcX = -682 | AcY = 2178 | AcZ = 17698 | Tmp = 27.55 | GyX = 473 | GyY = 234 | GyZ = -219±250, ±500, ±1000,(dps)以及用户可编程加速度计满量程范围±2000°/sec。这意味着如果您将灵敏度设置为±2g,则整数范围为16位整数将用于存储±2g, ±4g, ±8g, and ±16g-2g的值。

因此,你可能需要做一些简单的数学,

+2g