How to detect if an IMU is in motion or not

The main issue using an IMU is that the estimated measurements (angle, velocity and position) present a drift caused by the single and double integrations. For the compensation of the drift errors, various methods have been presented for example using a Kalman Filter or even a simple removal of a constant value in every estimation. However, the identification whether an IMU is motionless or not could improve the results. Integrating the values when the IMU is in motion only, the drift error can be reduced firther.

An mpu6050 IMU was moved back and forward two times. Three methods have been implemented for the identification of the IMU movement.

 

1.Angular velocity magnitude

Transforming gyroscope’s raw data to angular velocity and using a threshold, the IMU movement can be recognised (Fig. 1).

angular_threshold = 5;
rate_magnitude = sqrt(sq(gyro_rate_x) + sq(gyro_rate_y) + sq(gyro_rate_z));
if (rate_magnitude < angular_threshold)
  {
    GyX = 0;
    GyY = 0;
    GyZ = 0;
    AcX = 0;
    AcY = 0;
    AcZ = 0;
  }

 

 

 

Figure 1. Using the angular velocity magnitude method.

 


2. Absolute acceleration

When the accelerometer is at rest it should record only the gravitational acceleration. Therefore, values higher than 9.81 m/s2 will include acceleration from the movement (Fig. 2). The acceleration method includes also false values due to the fact that an accelerometer is noisier than a gyroscope.

accel_threshold = 9.81;
  accel_magnitude = abs(accel_x_scaled) + abs(accel_y_scaled) +  abs(accel_z_scaled);
if (accel_magnitude < accel_threshold)
    {
      GyX = 0;
      GyY = 0;
      GyZ = 0;
      AcX = 0;
      AcY = 0;
      AcZ = 0;
    }

 

Figure 2. Using the summation of the absolute acceleration values.

 

3. Using both methods

Figure 3. Using both methods.

 

Components list:
(1x) Arduino Uno
(1-16x) IMU MPU-6050
Download Full Code: Link
Check also:
IMU holder for MoCap


RECENT POSTS