ECParts Toolkit LogoECParts Toolkit

Engineering Guide

Motion, Distance, and Inertial Sensor Measurement Workflows

Reliable sensor results come from a declared physical model, consistent units, calibration, and an uncertainty budget. This guide connects acoustic time of flight and accelerometer signals to defensible distance, acceleration, and static-tilt measurements.

SensorsIntermediate20 min readUpdated October 5, 2026

Measurement Workflow

StepActionEngineering Check
Define the measurandState whether the output is distance, one-axis acceleration, vector magnitude, or static tilt.
Declare conventionsDocument one-way versus round-trip time, axis signs, units, zero reference, and angle definition.
Convert the raw signalApply timing, voltage sensitivity, offset, and ADC transfer functions before interpreting motion.
CalibrateUse traceable physical references across the intended range; retain residual error rather than only slope and offset.
Budget uncertaintySeparate quantization, noise, temperature drift, alignment, target geometry, and model error.
Filter with purposeSet bandwidth from real motion dynamics; avoid hiding delay, ringing, or missed events behind excessive averaging.
Validate boundariesTest temperature, range endpoints, orientation, vibration, target material, supply, and mounting.
Report honestlyDistinguish resolution, repeatability, accuracy, latency, and confidence in the final result.

Measurement Models and Boundaries

WorkflowRaw InputCore ModelDominant Boundaries
Ultrasonic pulse echoEcho timed = vt/2Temperature, target angle, ringing, multipath
Analog accelerometerVoltagea = (Vout - Vzero)/SOffset, sensitivity, ADC, cross-axis error
Three-axis static tiltAx, Ay, Azatan2 and vector geometryAxis convention, dynamic acceleration, free fall
CalibrationReference pairsLinear or selected fitReference quality, nonlinearity, extrapolation
ADC digitizationVoltage codeCode width and transfer functionNoise and analog error remain separate

Ultrasonic Time-of-Flight Distance

Formula reference

Pulse-echo ranging

Round-trip distance: d = vt/2One-way distance: d = vtRound-trip echo time: t = 2d/vAir approximation: v = 331.3 + 0.606T m/sRound-trip timer increment: delta d = v delta t/2

Variable definitions

t must be identified as one-way or round-trip time
T is air temperature in degrees Celsius
Humidity, pressure, airflow, target geometry, and transducer behavior are not fully modeled

Use the Ultrasonic Distance Calculator for echo timing, inverse timeout, temperature compensation, and timer increment. Verify sensor dead zone, beam angle, echo threshold, target reflectivity, multipath, and firmware latency with hardware.

Analog Accelerometer Voltage to Acceleration

Formula reference

Linear one-axis transfer function

Vout = Vzero + S x aa = (Vout - Vzero)/Sa(m/s squared) = a(g) x 9.80665g/code = ADC volts per code / |S x gain|

Variable definitions

Vzero is measured zero-g bias
S must be converted to volts per g
The first-order model excludes nonlinearity, cross-axis coupling, hysteresis, and dynamic bandwidth

The Accelerometer Voltage and g Calculator converts voltage, bias, and sensitivity. A two-point or multi-point calibration should be used when nominal bias and sensitivity do not meet the error budget.

Three-Axis Vector and Static Tilt

Formula reference

Adopted XYZ convention

|A| = sqrt(Ax squared + Ay squared + Az squared)roll = atan2(Ay, Az)pitch = atan2(-Ax, sqrt(Ay squared + Az squared))tilt from +Z = acos(Az/|A|)

Variable definitions

Axis labels and signs must match the physical mounting
Equations assume acceleration is dominated by gravity for static tilt
Yaw cannot be recovered from accelerometer-only data
Near-zero magnitude makes normalization and tilt undefined

Use the Accelerometer Tilt and Vector Calculator only after axis conversion and offset correction. Dynamic attitude estimation requires gyroscope integration or sensor fusion and belongs outside this static model.

Calibration, ADC Resolution, and Uncertainty

The Sensor Calibration Calculator supports slope, intercept, and residual checks; the Sensor ADC Resolution Calculator supports code-width planning. They are shared tools because calibration and digitization support many sensor types. Neither replaces a complete uncertainty budget.

Design rule: keep quantization, random noise, repeatability, offset, gain error, temperature drift, reference uncertainty, alignment, model error, and dynamic error as separate terms until their distributions and correlations are justified.

Worked Examples

One-millisecond echo

At 20 degrees C, v = 343.42 m/s. A 1 ms round-trip echo gives d = 343.42 x 0.001 / 2 = 0.17171 m.

Temperature compensation

A 10 ms echo gives 1.6565 m at 0 degrees C and 1.7474 m at 30 degrees C, showing why fixed sound speed creates systematic error.

Timer resolution

At 20 degrees C, a 1 us round-trip timer tick represents about 0.17171 mm, but this is not complete measurement accuracy.

Voltage to g

With Vzero = 1.65 V, sensitivity = 330 mV/g, and Vout = 1.98 V, acceleration is +1.00 g.

Offset error

If a stationary zero-g axis reads 1.67 V instead of 1.65 V at 330 mV/g, indicated offset is about +0.0606 g.

ADC granularity

A 12-bit 3.3 V ADC has about 0.806 mV/code. At 330 mV/g and unity gain, that is about 0.00244 g/code before noise and error.

Static level orientation

Ax = 0, Ay = 0, Az = 1 g gives magnitude 1 g, roll 0 degrees, pitch 0 degrees, and tilt from +Z of 0 degrees.

Forty-five-degree roll

Ax = 0, Ay = 0.7071 g, Az = 0.7071 g gives roll = atan2(Ay, Az) = 45 degrees.

Free-fall boundary

When vector magnitude approaches zero, normalization and gravity-based tilt become undefined rather than zero.

Dynamic-motion boundary

A 1 g magnitude can still include linear acceleration; magnitude near 1 g does not prove the device is stationary.

Common Mistakes

Forgetting the factor of two for pulse-echo distance.
Using a fixed sound speed across a wide temperature range.
Treating timer resolution as total distance accuracy.
Applying a voltage-to-g equation without subtracting zero-g bias.
Entering mV/g as V/g without unit conversion.
Treating nominal datasheet sensitivity as a complete calibration.
Equating ADC code width with effective sensor accuracy.
Using atan instead of atan2 and losing quadrant information.
Changing axis signs or mounting conventions without updating angle equations.
Calculating yaw from accelerometer-only data.
Reporting static tilt during strong linear acceleration or vibration.
Normalizing a near-zero vector in free fall.
Extrapolating a calibration far beyond its reference range.
Filtering so heavily that measurement latency hides real events.

Related Calculators

Related Resources

Support reference

FAQ

Why is ultrasonic echo distance divided by two?

The measured pulse travels to the target and back. Dividing total acoustic path length by two gives one-way target distance.

How does temperature affect ultrasonic distance?

Sound travels faster in warmer air. A temperature-compensated speed model reduces the systematic distance error caused by using one fixed speed.

Is ultrasonic timer resolution the same as accuracy?

No. Timer quantization is only one contributor; ringing, threshold timing, temperature, target geometry, multipath, and electronics latency also matter.

How do I convert accelerometer voltage to g?

Subtract the zero-g bias from output voltage and divide by sensitivity in volts per g: a = (Vout - Vzero)/S.

Why must accelerometer sensitivity units be explicit?

A value in mV/g differs from V/g by 1000. Converting units before division prevents a three-order-of-magnitude error.

How do I calculate accelerometer vector magnitude?

Use sqrt(Ax squared + Ay squared + Az squared), with all three components expressed in the same acceleration unit.

Why use atan2 for roll and pitch?

atan2 preserves quadrant information and remains defined when the denominator of a simple ratio approaches zero.

Can an accelerometer determine yaw?

No. Rotation around the gravity vector does not change its projection, so yaw needs another reference such as a magnetometer, vision, or integrated gyro information.

Why does static tilt fail during motion?

Linear, centripetal, and vibration acceleration add to gravity. The measured vector then no longer represents gravity alone.

What happens to tilt in free fall?

The measured proper-acceleration magnitude approaches zero, so vector normalization and gravity-based orientation are undefined or unreliable.

Does a higher-resolution ADC make a sensor more accurate?

Not automatically. More codes can improve quantization, but sensor noise, offset, drift, reference error, front-end error, and calibration still limit accuracy.

When should I recalibrate a sensor?

Recalibrate after mounting changes, significant temperature or aging exposure, mechanical shock, or whenever verification against references exceeds the allowed error budget.

Summary

Start from the physical measurand, declare timing and coordinate conventions, convert raw signals with consistent units, calibrate against references, and keep uncertainty sources separate. Calculators make the deterministic conversions repeatable; validation establishes whether the complete sensor system meets the required accuracy and dynamics.