ECParts Toolkit LogoECParts Toolkit

Sensors Guide

Accelerometer Calibration and Static Tilt: Bias, Axis Alignment, and Validity

A tilt equation is only as trustworthy as the axis calibration and the assumption that the sensed vector is mostly gravity. Establish those conditions before interpreting pitch, roll, or angle from vertical.

16 min · Intermediate · Updated October 16, 2026

Define the Measurement Frame

Record sensor X/Y/Z pins, board axes, product forward/up directions, and the sign convention used by the firmware. A correct formula with a swapped axis or inverted board orientation returns a credible but wrong angle. Calibration first converts each channel to acceleration in g; a separate rotation aligns that calibrated vector with the product frame.

A static accelerometer measures specific force including the gravity-related support reaction. Its sign depends on the device convention. Verify the +Z level reference before using any atan2 expression. For general sensor signal-chain context, see Motion, Distance, and Inertial Sensor Measurement Workflows.

Calibrate Bias and Sensitivity

Formula reference

First-order analog axis calibration

Vout = V0 + S aa(g) = (Vout - V0)/SV0 ≈ (V+g + V-g)/2S ≈ (V+g - V-g)/2 V/g

Variable definitions

V0 is the measured zero-g voltage
S is signed sensitivity under the adopted polarity convention
V+g and V-g are readings in controlled +1 g and -1 g orientations
The simple model omits nonlinearity, cross-axis sensitivity, and temperature drift

Suppose one axis reads 1.8 V at +1 g and 1.2 V at -1 g. Its midpoint is 1.5 V and its sensitivity is 0.3 V/g. A subsequent 1.65 V reading corresponds to +0.5 g. The Accelerometer Voltage & g Calculator performs this linear conversion, but the reference values must come from a valid sensor calibration. Do not average a saturated +g endpoint into the fit.

A six-position fixture provides +X, -X, +Y, -Y, +Z, and -Z references. Estimate each axis midpoint and span after settling, then validate at additional orientations. For higher accuracy, solve a calibrated three-dimensional affine model and check residuals; six axis endpoints alone cannot prove the full misalignment and cross-axis model.

Rotate to the Product Frame

After removing bias and scale errors, apply the measured board-to-product rotation. This is not the same as changing the axis labels in a formula: an arbitrary mounting angle couples axes. A calibrated vector is a three-component quantity, so apply one documented rotation matrix consistently to every sample. Verify the result by placing the assembled product in known orientations rather than only rotating a bare development board.

CheckMethodRisk if skipped
BiasUse +g and -g readings for each axisA wrong midpoint creates angle bias near level
SensitivityUse half the separation of +g and -g readingsNominal mV/g may differ from the assembled device
Axis alignmentRotate calibrated sensor vector into the product frameA board mounting error is not a sensor scale error
Static gateCheck vector magnitude, stability, and application motionNear-1 g alone does not establish static conditions
TemperatureRepeat bias and sensitivity checks over operating cornersAn ambient-only calibration may drift
Independent validationTest orientations omitted from calibrationA perfect fit to six endpoints does not prove cross-axis accuracy

Compute Static Tilt with Explicit Axes

Formula reference

One common XYZ static-tilt convention

A = sqrt(Ax^2 + Ay^2 + Az^2)roll = atan2(Ay, Az)pitch = atan2(-Ax, sqrt(Ay^2 + Az^2))tilt from +Z = acos(Az/A), for A > 0

Variable definitions

Inputs are calibrated accelerations in a common unit
The chosen convention assumes level +Z near +1 g
atan2 preserves quadrant information for roll and pitch
Gravity-only tilt cannot determine yaw

With Ax = 0, Ay = 0, Az = 1 g, magnitude is 1 g and tilt from +Z is 0°. With Ax = 0.5 g, Ay = 0, Az ≈ 0.866 g, the vector is about 30° from +Z. The sign of pitch depends on the adopted axis convention; its magnitude is about 30° in this example. The Accelerometer Tilt & Vector Calculator applies the declared convention to already calibrated axes.

Know When Tilt Is Invalid

Static tilt assumes the measured vector approximates gravity. During vehicle acceleration, vibration, impact, or free fall, the vector contains other forces or may nearly vanish. Magnitude near 1 g is a useful screening rule but not proof: an accelerated vector can happen to have that length while pointing elsewhere. Add temporal stability checks, application-state information, and a motion model. Dynamic attitude requires gyroscope integration or sensor fusion outside these static calculators.

Near A = 0, the normalization Az/A is undefined and noise can produce arbitrary angles. Reject or label such samples rather than returning 0°. Also avoid converting every noisy sample directly into a display angle: filtering should have a defined delay, bandwidth, and validity policy.

Budget and Verify Angle Error

Bias causes a nearly fixed vector offset; sensitivity error scales an axis; cross-axis response and mounting error rotate or skew the vector. Quantization and noise create random angle variation. Temperature shifts bias and sensitivity. Near some orientations, a small transverse error can create a noticeable angle shift, so evaluate at the intended tilt range rather than assuming one global degree-per-g conversion.

Verification pointExpected behaviorWhat to record
Six axis endpointsEach corrected axis near ±1 gRaw voltage, corrected vector, temperature
Independent intermediate tiltAngle agrees with fixture referenceResidual angle and magnitude
Board remountProduct-frame result unchangedAlignment coefficients and mounting repeatability
VibrationStatic tilt rejected or boundedValidity flag and filtered response
Free fallTilt marked undefinedMagnitude threshold and recovery
Hot/cold cornersError remains within budgetBias, scale, and angle drift

Use the general Sensor Calibration and Accuracy Reference for uncertainty vocabulary. This guide owns accelerometer-specific axis calibration and tilt validity, not generic ADC acquisition or ultrasonic time of flight.

Common Mistakes

  • Using nominal zero-g voltage as a finished calibration.
  • Failing to settle the fixture before each +g/-g capture.
  • Ignoring signed sensitivity and axis polarity.
  • Treating board orientation as if it were a sensor bias.
  • Using raw ADC codes without a voltage and reference convention.
  • Applying level-only equations to a moving device.
  • Taking acos of an unclamped noisy ratio or dividing by a near-zero magnitude.
  • Assuming magnitude near 1 g guarantees static orientation.
  • Claiming accelerometer-only yaw.
  • Validating only the same orientations used for calibration.

Support reference

FAQ

How do I remove accelerometer zero-g bias?

For an analog axis, subtract its measured zero-g voltage before dividing by sensitivity. A nominal datasheet bias is a starting value, not a unit-specific calibration.

What does a six-position calibration measure?

Placing each axis near +1 g and -1 g allows first-order estimates of that axis's bias and sensitivity. More orientations are needed to estimate full cross-axis alignment reliably.

Can an accelerometer measure tilt while a device is moving?

Only when non-gravitational acceleration is small enough for the required error budget. A single acceleration sample cannot generally separate gravity from motion.

Can accelerometer-only tilt measure yaw?

No. Rotation about the gravity direction leaves the measured gravity vector unchanged, so yaw requires another reference.

Why is the measured acceleration magnitude not exactly 1 g at rest?

Bias, scale error, noise, cross-axis response, mounting error, gravity variation, and temperature can shift the corrected vector magnitude.

Is a magnitude near 1 g proof that a tilt reading is valid?

No. Motion can occasionally produce a vector with magnitude near 1 g but the wrong direction. Magnitude is a useful gate, not a complete motion detector.

How does mounting angle affect pitch and roll?

The calculator assumes its named axes match the physical coordinate frame. Rotate the calibrated vector into the product frame before applying pitch and roll equations.

What happens to tilt in free fall?

The proper-acceleration vector approaches zero, so gravity-based normalization and orientation become undefined or noise dominated.

How should accelerometer calibration be verified?

Test independent orientations and temperature corners, check residual magnitude and angle error, then repeat with realistic vibration and movement to confirm validity gating.

Summary

Measure bias and sensitivity, align the calibrated axes to the product, then compute static tilt only while gravity is the dominant acceleration. Validate independent orientations and motion states; reject readings whose physical assumptions are not met.