IMU Calibration and Drift

How to characterize accelerometer and gyro errors before trusting dead reckoning or attitude estimates.

Robotics and Controls · State Estimation

An IMU gives high-rate motion measurements, not position. Dead reckoning fails when bias, scale error, misalignment, vibration, timestamp error, and gravity projection are treated as noise instead of first-order design constraints.

Separate the error terms

A simple sensor model is:

[y = S R x + b + n]

where $x$ is the true physical quantity, $R$ is sensor-axis alignment, $S$ is scale and cross-axis sensitivity, $b$ is bias, and $n$ is noise. Calibration estimates enough of this model for the mission. It does not make a low-cost MEMS IMU behave like a navigation-grade unit.

For an accelerometer at rest, the measurement magnitude should be close to local gravity:

[\lVert a \rVert \approx g]

For a gyro at rest, the mean should be close to zero after bias correction. The residual determines how quickly attitude drifts.

Collect static data first

Start with simple static positions:

  • +X up,
  • -X up,
  • +Y up,
  • -Y up,
  • +Z up,
  • -Z up.

Record raw accelerometer and gyro samples for each orientation after settling. This exposes bias, rough scale error, noisy axes, clipping, and axis sign mistakes. Keep temperature if available.

A six-position accelerometer calibration can estimate per-axis offset and scale. More positions help fit cross-axis terms, but only if the fixture and labels are reliable.

Characterize gyro bias

Gyro bias is the attitude killer. Record the stationary gyro output for several minutes and compute mean, standard deviation, and drift over temperature if possible. Then integrate the bias error into an attitude estimate to understand mission impact:

[\theta_{err}(t) \approx b_g t]

A bias of $0.5^\circ/s$ becomes $30^\circ$ in one minute if uncorrected. That attitude error rotates gravity into horizontal acceleration, then position error grows quickly after double integration.

Timestamp accuracy matters

Integration depends on sample interval. Do not assume nominal ODR equals actual timing. Measure or record timestamps at the point where samples enter the estimator. Watch for:

  • FIFO burst reads that assign the same timestamp to many samples,
  • I2C or SPI blocking that jitters loop timing,
  • USB or host timestamps used instead of MCU timestamps,
  • dropped samples hidden by the driver.

A good log contains raw sample, corrected sample, timestamp, temperature, estimator state, and status flags.

Remove gravity deliberately

Accelerometer-based velocity and position require gravity compensation. That means attitude error directly becomes acceleration error. A one-degree roll error projects roughly 0.17 m/s² of gravity into the horizontal channel. After 10 seconds, that alone can create meters of position error.

This is why strap-down dead reckoning from a low-cost IMU needs constraints: zero-velocity updates, wheel odometry, visual odometry, magnetometer heading, beacons, pressure/depth, or known motion segments.

Test dynamic behavior

After static calibration, run repeatable motion tests:

Test Purpose
stationary log bias, noise, timestamp health
90 degree rotation gyro scale and sign
return-to-origin motion integrated drift
vibration exposure aliasing and mechanical isolation
temperature sweep bias stability
known-distance motion velocity and position sanity

Do not tune filters only on plotted smoothness. A filter that looks clean can add phase lag that breaks a control loop.

Keep calibration tied to hardware

Calibration constants belong to a sensor serial number, mounting orientation, firmware transform, and temperature range. If the board rotates in the enclosure or the driver changes axis mapping, old constants can become wrong while still looking numeric and plausible.

UUV Navigation and State Estimation, PID Tuning and Step Response, and Measurement and Instrumentation.

Sources