代码之家  ›  专栏  ›  技术社区  ›  Anubis

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

  •  5
  • Anubis  · 技术社区  · 13 年前

    我试过了 this sketch 由arduino.cc提供。(我有 MPU6050 GY-521 breakout board .)

    我认为效果很好。它给出了一组奇怪的数字,我无法理解。它说这些都是原始价值观。

    我如何将它们转化为有意义的价值观?

    输出如下。即使整个东西保持静止,它也会产生不断变化的价值!这有意义吗?那么如何理解呢?

    (我只知道温度值是有意义的: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,
    
    2 回复  |  直到 13 年前
        1
  •  11
  •   Karl Bielefeldt    13 年前

    你需要看看 datasheet 将原始值转换为有意义的值。为陀螺仪查找如下表格:

    gyro table

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

    对于默认的加速度计灵敏度,除以 16,384 获取中的值 (地球施加的力)。x轴和y轴的精度约为0.01g,z轴的精度为0.95g,这在芯片保持z轴朝向地球静止的合理误差范围内。

        2
  •  0
  •   Arshiya Rita    10 年前
     mpu.setFullScaleGyroRange(0); //0 = +/- 250 degrees/sec | 1 = +/- 500 degrees/sec | 2 = +/- 1000 degrees/sec | 3 =  +/- 2000 degrees/sec
      mpu.setFullScaleAccelRange(0);  //0 = +/- 2g | 1 = +/- 4g | 2 = +/- 8g | 3 =  +/- 16g