使用带Arduino的陀螺仪/加速度计

Sum*_*udu 5 arduino accelerometer gyroscope

我试过arduino.cc提供的这个草图.(我有一个MPU6050 GY-521分线板.)

我认为它运作正常.它提供了一组奇怪的数字,我无法得到任何意义.它说那些是原始价值.

如何将它们转换为有意义的值?

输出如下.即使整个事物保持静止,它也会带来不断变化的价值!这有意义吗?然后怎么理解?

(我只知道温度值是有意义的:D)

June 2012
WHO_AM_I : 68, error = 0
PWR_MGMT_2 : 0, error = 0

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 260, 120, 15572
temperature: 31.047 degrees Celsius
gyro x,y,z : -24, -234, -240,

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 304, 12, 15608
temperature: 31.000 degrees Celsius
gyro x,y,z : -7, -234, -232,

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 160, 100, 15716
temperature: 31.000 degrees Celsius
gyro x,y,z : -8, -241, -248,

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 192, 56, 15712
temperature: 31.000 degrees Celsius
gyro x,y,z : -36, -212, -222,

MPU-6050
Read accel, temp and gyro, error = 0
accel x,y,z: 212, 100, 15440
temperature: 30.906 degrees Celsius
gyro x,y,z : -32, -253, -240,
Run Code Online (Sandbox Code Playgroud)

Kar*_*ldt 11

您需要查看数据表以将原始值转换为有意义的值.寻找像这样的陀螺仪表:

陀螺表

如果您使用了默认值,FS_SEL则会0.这就是灵敏度设置.因此,要将原始陀螺仪值转换为每秒度数,您将它们除以131.您可以看到您的数字低于每秒2度左右,这是一个合理的误差范围.

对于默认的加速度计灵敏度,除以16,384得到g的值(地球施加的力).x轴和y轴的顺序为0.01g,z轴的顺序为0.95g,这在芯片保持静止且z轴指向地球的情况下处于合理的误差范围内.

  • 非常感谢卡尔!我购买了这个模块,因为我发现这些模块在构建四轮直升机时会派上用场(我要打​​造一个).但除此之外,我对使用它们一无所知.我已经使用给定的示例代码进行了测试(代码很大,无法理解事情:().我知道有[此库](https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050),很多人说这很有用.如果你可以帮我写一个简单的(可理解的)草图,我会很感激._(我找到了[本页](http://www.instructables.com/ id/Accelerometer-Gyro-Tutorial /)很有帮助.)_ (3认同)