← All notes

Accelerometer

Accelerometer

What does it measure?

An accelerometer measures specific force along its three axes, in units of m/s2\mathrm{m/s^2} or multiples of gg (1g≈9.81 m/s21g\approx9.81\,\mathrm{m/s^2}).

A useful model in the sensor/body frame is:

fm≈RT(aworld−gworld)+ba+na\mathbf f_m \approx \mathbf R^T(\mathbf a_{world}-\mathbf g_{world})+\mathbf b_a+\mathbf n_a

where R\mathbf R rotates body coordinates into world coordinates. At rest, the accelerometer still registers approximately 1 g in magnitude because it senses the supporting force opposing gravity. The measured sign depends on the axis orientation.

Estimating roll and pitch

For the common body-axis convention in which a level, stationary sensor reads approximately (ax,ay,az)=(0,0,+g)(a_x,a_y,a_z)=(0,0,+g):

ϕacc=atan2⁡(ay,az)\phi_{acc}=\operatorname{atan2}(a_y,a_z)
θacc=atan2⁡(−ax,ay2+az2)\theta_{acc}=\operatorname{atan2}\left(-a_x,\sqrt{a_y^2+a_z^2}\right)

Here ϕ\phi denotes roll and θ\theta pitch. Results are in radians unless converted. These formulas depend on the coordinate/sign convention and assume that non-gravitational linear acceleration is small.

What goes wrong?

Issue Why it matters
Linear acceleration Acceleration from a vehicle, robot, or human motion is mixed with the gravity signal, causing false tilt
Vibration High-frequency oscillations make readings noisy and can alias into the sampled signal
Bias / zero-g offset Adds systematic error to measured acceleration and tilt
Scale-factor / axis misalignment Changes magnitude and direction of the measured vector
Temperature changes Bias and sensitivity can vary with temperature
Saturation Accelerations beyond the selected ±g range are clipped
Integration Estimating velocity/position requires integration, magnifying small bias and gravity-removal errors

Why not use acceleration alone for position?

For a constant acceleration error bab_a, the approximate position error from double integration is:

Δp(t)≈12bat2\Delta p(t)\approx\tfrac12 b_a t^2

A 0.1 m/s20.1\,\mathrm{m/s^2} constant error therefore becomes about 5 m of position error after 10 s, even before considering attitude error. Reliable inertial navigation typically needs more information (e.g. GNSS, vision, wheel odometry, or motion constraints).

Calibration basics

  1. Check units and axis orientation. At rest, the magnitude should be near gg, not zero.
  2. Collect several static orientations (commonly +X,−X,+Y,−Y,+Z,−Z+X,-X,+Y,-Y,+Z,-Z aligned with gravity).
  3. Use known +g/−g+g/-g values to estimate each axis' offset and scale factor; more advanced routines fit cross-axis misalignment as well.
  4. Repeat or model calibration over temperature if accuracy requirements justify it.
  5. Apply corrections before passing accelerometer readings to sensor fusion.

For example, with one axis held at +g+g and then −g-g, the raw mean measurements a+a_+ and a−a_- give an approximate bias (a++a−)/2(a_++a_-)/2; their difference gives scale information.

Handling bad gravity measurements

  • Apply appropriate low-pass/anti-alias filtering and sample at a suitable rate.
  • Down-weight accelerometer tilt updates during likely linear acceleration or high vibration.
  • Use ∥a∥≈g\lVert\mathbf a\rVert\approx g as a sanity check, but remember that matching the magnitude of gg does not prove there is no linear acceleration.
  • Record the timing of the accelerometer sample relative to the gyro sample.

Relation to the gyroscope

The accelerometer offers a long-term gravity reference for roll/pitch but is unreliable as a tilt sensor during certain motions. The Gyroscope accurately captures brief rotations but drifts if integrated indefinitely. Their strengths motivate a Complementary Filter or Kalman Filter for IMUs.

See also: 6-DoF IMU · BMI088 - Hardware Connection

Sources

Connections