Technical Blog
7 min read
January 2025

Understanding IMU Sensors: Accelerometers and Gyroscopes

Sensor fusion, calibration and noise filtering for precision attitude estimation.

Inertial Measurement Units (IMUs) are among the most widely misunderstood sensors in robotics. An accelerometer does not measure velocity; a gyroscope does not measure angle. Each measures a derivative of what most engineers intuitively want to know — and naively integrating those measurements produces data that is worse than useless within seconds. This blog covers what these sensors actually measure, their noise characteristics, and how to extract useful attitude estimates from them.

What an Accelerometer Actually Measures

An accelerometer measures specific force: the sum of all forces acting on the sensor divided by its mass, minus the gravitational component along each axis. At rest on a table, a 3-axis accelerometer reads [0, 0, +9.81 m/s²] — the reaction force of the surface, not movement. During free fall, it reads [0, 0, 0] — not the gravitational acceleration you might expect. This distinction matters: you can extract tilt angle from an accelerometer at rest, but during dynamic motion, linear acceleration contaminates the gravity vector and corrupts your tilt estimate.

What a Gyroscope Actually Measures

A MEMS gyroscope measures angular rate in degrees/second or radians/second around each axis. To get orientation, you integrate rate over time. The problem: MEMS gyroscopes have bias — a non-zero output even when stationary. Integrating a constant 0.01°/s bias for 60 seconds produces a 0.6° error. After 10 minutes, you have 6° of drift from bias alone, before accounting for temperature effects or noise.

Noise Characteristics

Key spec sheet values: Noise Spectral Density (NSD) in °/s/√Hz — lower is better. Bias Instability in °/hr — the minimum bias drift achievable with optimal averaging. Zero-Rate Offset (gyro bias at startup) — typically ±0.5 to ±3 °/s for MEMS. Accelerometer: Noise Density in µg/√Hz, Zero-g Offset (bias). High-quality automotive-grade IMU parts have an order of magnitude better noise floor than entry-level parts and are worth the cost for any precision application.

Complementary Filter: Simple and Effective

The complementary filter fuses accelerometer tilt with gyroscope rate using a single tuning parameter α (typically 0.98): `angle = α × (angle + gyro_rate × dt) + (1 - α) × accel_angle`. This exploits the complementary frequency characteristics: the gyro is accurate at high frequencies (fast motion), the accelerometer at low frequencies (slow motion or rest). α controls the crossover frequency. For a drone at 1000 Hz loop rate, α = 0.998 works well. The complementary filter is computationally trivial and adequate for many applications.

Kalman Filter and Mahony/Madgwick Filters

For higher accuracy, the Extended Kalman Filter (EKF) is the standard in aerospace. It models sensor noise as Gaussian and propagates uncertainty estimates alongside the state estimate. Tuning requires characterising your sensor's Q (process noise) and R (measurement noise) matrices from real data. For embedded systems, the Mahony and Madgwick filters are computationally lighter alternatives that produce comparable results on 9-DOF IMUs (accelerometer + gyro + magnetometer). Many racing-firmware stacks use a variant of the Mahony filter; full autonomous-mission firmware typically uses a complete EKF.

Calibration Procedures

Gyro bias calibration: average the output over 5–10 seconds at rest and subtract the mean from all subsequent readings. Temperature compensation: characterise bias vs temperature using a thermal chamber and store a lookup table in firmware. Accelerometer calibration: place the sensor in 6 orientations (each face against a flat surface) and solve for scale factor and bias per axis using a least-squares fit. Skip this and your accelerometer will report a gravity vector that is consistently off by several percent.

Choosing the Right IMU

Consumer robotics (< ₹2,000): MPU-6050 or MPU-9250. Adequate for basic balance bots and educational projects. Performance robotics (₹2,000–₹8,000): ICM-42688-P or BMI088. Low noise floor, good bias stability, hardware anti-aliasing filter, suitable for drones and AMRs. Professional/aerospace (₹8,000+): ADIS16507 or comparable tactical-grade parts. Temperature-calibrated from factory, used in flagship-class flight controllers and surveying equipment. Never use a cheaper IMU and expect high-grade filter software to compensate — noise floor is a hardware limit that software cannot exceed.