41 IMU and Barometric Calibration
41.1 Start With the Measurement Story
Calibrate Against a Known Still Point
Picture a delivery cart that must detect a turn and a change of floor. Its motion sensor reports gravity as well as movement. Its pressure sensor also reacts to weather and warm air. A changing number is not yet proof of a real move.
Begin with a known state. Hold the device still, record its pose and local pressure, and save the bias seen on each axis. Rotate it through checked directions. Move it by a known height and compare the result with a tape or fixed mark.
Test vibration, slow heat change, a new mounting angle, and a restart. Keep the raw readings, correction values, sample time, and final claim together. If the reference is old or the sensors disagree, lower confidence instead of forcing an answer.
One indoor check cannot promise accuracy on every vehicle or day. The deeper sections explain gravity, drift, alignment, pressure, and combined sensing so each correction has a reference, a limit, and a new-test trigger.
IMU and barometric readings are useful only after bias, drift, alignment, and altitude assumptions are visible. The first story is the reference condition, then the correction, then evidence that motion or pressure changes are real.
The mathematical gist. Hydrostatic balance and the ideal gas law give . With the chapter’s sea-level constants, the scale height is 8.43 km and one pascal is worth 8.32 cm near 101,325 Pa. A catalog-typical 0.12 Pa BMP280 noise floor therefore becomes about 1.00 cm, rising to roughly 1.09 cm near the chapter’s 93,255 Pa example.
41.2 Learning Objectives
After this page, you should be able to:
- Explain how a MEMS capacitive accelerometer turns proof-mass deflection into acceleration readings.
- Convert analog and digital IMU readings into physical units while preserving full-scale and offset evidence.
- Diagnose why accelerometers confuse gravity, tilt, vibration, and horizontal acceleration without fusion.
- Use BMP280 pressure changes as relative altitude evidence while accounting for weather drift and baseline freshness.
41.3 After Motion and Environment Labs
Motion and Environmental Sensor Labs introduces MPU6050 and BMP280 wiring, expected readings, calibration steps, and exercises. This page isolates the deeper measurement boundaries behind those labs: what moves inside the IMU, how raw counts become evidence, why fusion is needed, and when barometric altitude is a relative signal rather than absolute truth.
Use it when motion or floor-change logic works on a bench but becomes noisy after mounting, orientation changes, sampling changes, vibration, or slow pressure drift.
41.4 Overview: A Tiny Mass on Silicon Springs
The accelerometer in a phone, a drone, or an IoT motion tag is a MEMS device — a micro-electro-mechanical system etched from silicon. Inside is a microscopic proof mass suspended on flexible silicon beams that act as springs. When the device accelerates, inertia makes the mass lag behind, deflecting on its springs. The sensor measures that tiny deflection and reports it as acceleration.
The clever part is how the deflection is read out. The proof mass carries movable plates interleaved with fixed plates, forming capacitors. As the mass shifts, the gaps change, and so does the capacitance. This is capacitive transduction shrunk to the micrometre scale: mechanical motion becomes a capacitance change becomes a voltage.
That means the first lab check is physical, not just digital. With the board flat and still, one accelerometer axis should report about +1 g or -1 g depending on mounting, while the other two axes sit near 0 g. If all axes hover near 0 g, the code may be reading the wrong register or scale. If the total magnitude is far from 1 g while stationary, the offset calibration, range setting, or board orientation needs attention before motion detection can be trusted.
The BMP280 side of the lab uses a different physical proxy. Pressure falls as altitude rises, so a barometric sensor can estimate relative height changes even though weather systems shift the absolute pressure over time. The shared lesson is that motion and environmental labs both need a known reference: gravity for the IMU, a stable desk-height baseline for pressure, and repeated samples to separate real movement from startup noise.
Intuition: picture a weight hanging between two charged plates. Push the whole assembly sideways and the weight swings, moving closer to one plate and further from the other. The changing gaps change the capacitances, and that difference is the acceleration signal.
41.4.1 Overview Knowledge Check
41.5 Deflection to Volts
The mechanics are a mass on a spring. An inertial force F = m·a deflects the mass until the spring pushes back equally, so the static deflection is:
m·a = k·x -> x = m·a / k = a / ω0^2 k = spring stiffness, ω0 = sqrt(k/m) = resonant frequency Parallel-plate capacitance: C = ε · A / d as the mass moves, one gap d shrinks and the other grows, giving a differential capacitance change proportional to x
That same equation is also the whole story of why MEMS accelerometers can be shrunk onto a chip in the first place. Writing the resonant frequency as f0 = ω0 / 2π = (1/2π)·sqrt(k/m) turns the deflection equation into x = a / (2πf0)^2: for a fixed target f0, only the ratio k/m matters, not k and m individually. Shrinking the proof mass alone would push f0 up and shrink the deflection per g; to keep the same sensitivity at the same resonant frequency, the spring has to be softened by the same factor the mass was reduced. A miniaturized accelerometer therefore needs a small mass and a proportionally weak spring — it is the ratio, not the size, that is being designed. The real cost of miniaturization shows up on the other side of the equation: shrinking k/m together to hit a given f0 also shrinks the deflection x the readout has to resolve for a given acceleration, which is exactly why the capacitive readout, bandwidth, and noise floor below cannot be chosen independently of how small the die is.
Before acting on deflection to volts, inspect Figure because it condenses the evidence path: an ADXL335 breakout turns the tiny proof-mass deflections described above into three analog voltages. The central MEMS package contains all three axes; the labeled X, Y, and Z outputs are the signals a calibration rig must map from volts back to acceleration. Photo: oomlout, CC BY-SA 2.0.
Read Figure from the central MEMS package outward to the labelled X, Y, and Z connections. The package converts proof-mass deflection into three analogue outputs; the breakout only makes those supply and signal pins accessible. Follow each axis into the calibration record rather than treating the board as a ready-made orientation estimate: offset, scale, mounting direction, ADC reference, and cross-axis behaviour still determine what the voltages mean.
41.5.0.1 Dynamic response is still the same mechanical model
When the input changes quickly, the proof mass is better treated as a mass-spring-damper rather than a static spring alone. The force balance is:
F(t) = m*x'' + b*x' + k*x X(s) / F(s) = (1/m) / (s^2 + (b/m)*s + k/m)
The step response depends on damping. An underdamped sensor overshoots and rings, a critically damped sensor reaches the final value quickly without overshoot, and an overdamped sensor is stable but slow. Other real channels can add simple delay, decay, or a combination of both. That is why bandwidth, settling time, and filtering belong in the sensor evidence record: raise bandwidth only when the physical event is fast enough to justify the extra noise.
41.5.0.2 Worked example: reading an ADXL335 analog accelerometer
The ADXL335 outputs a ratiometric analog voltage,
typically 300 mV per g, centered at half the supply
(0 g sits at Vs/2, about 1.5 V on a 3 V rail):
At rest, flat on a bench, the Z axis feels gravity:
Vz = 1.5 V + (1 g × 0.300 V/g) = 1.80 V
X and Y axes feel 0 g:
Vx = Vy = 1.5 V
Tilt the board 30° and Z feels cos(30°) = 0.87 g:
Vz = 1.5 V + 0.87 × 0.300 = 1.76 V
Because the output is ratiometric, referencing the ADC to the same supply cancels supply drift — the same trick that helps resistive dividers, applied to a MEMS part.
A digital IMU such as the MPU6050 hides the analog voltage, but the same calibration thinking still applies. In the +/-2 g accelerometer range, one g is 16,384 counts, so a stationary Z reading of 15,900 counts is about 0.97 g. A useful calibration record stores the raw X/Y/Z counts, converted g values, total magnitude, board orientation, and whether the device was still. That record catches swapped axes and wrong full-scale constants before they become false motion events.
For motion detection, avoid testing a single axis in isolation. A tilt can move gravity from Z into X or Y without the device translating. The magnitude test sqrt(ax^2 + ay^2 + az^2) should stay near 1 g while stationary at any orientation; walking, taps, and vibration appear as deviations around that baseline. The threshold then becomes a design choice tied to the activity you want to detect.
41.5.1 Practitioner Knowledge Check
41.6 Gravity, Brownian Noise, Bandwidth
Three physical realities shape what a MEMS accelerometer can and cannot tell you. The sensor reports specific force, not a labelled distinction between gravity, vibration, and intentional movement. Software has to infer that distinction from time, context, and companion sensors.
It always feels gravity
A capacitive accelerometer is DC-capable, so at rest it reads 1 g along the vertical. That makes it a fine tilt sensor — but it cannot, by itself, separate a tilt from a real horizontal acceleration, since both are just specific force.
Brownian noise floor
The proof mass is so tiny that random thermal-mechanical (Brownian) buffeting jostles it, setting a noise floor quoted in micro-g per sqrt(Hz). A smaller mass means more Brownian noise, so there is a size-versus-noise trade-off.
Quantitatively, that buffeting is a force noise with spectral density Sn_force(f) = 4·kB·T·k / (ω0·Q), where Q is the resonator's quality factor. For a MEMS cantilever in air, squeeze-film air damping typically limits Q to only about 30–50 — far below what a vacuum-packaged resonator can reach. A softer spring k lowers this noise floor for a given Q, which is one more reason the miniaturization trade-off above pairs a small mass with a weak spring rather than shrinking either alone.
Bandwidth and resonance
The spring-mass system has a resonant frequency; useful measurement stays well below it. On parts like the ADXL335 you set the bandwidth with output capacitors, trading response speed for less noise.
Why fusion exists
Because the accelerometer confuses gravity with motion and is noisy under vibration, real systems fuse it with a gyroscope, which is clean short-term but drifts. Each covers the other's weakness.
The accelerometer and gyroscope fail in complementary ways, so pause at Figure 41.1 before choosing the filter constant. The diagram distinguishes the raw sources, the calibration boundary, and the orientation quantities each path can actually support.
The diagram in Figure 41.1 receives three inputs: Gyroscope, Accelerometer, and Magnetometer. The gyroscope supplies fast angular-rate changes but “drifts over time”; the accelerometer supplies a long-term Gravity reference for tilt but is “noisy during motion.” Their Kalman Filter path therefore estimates Roll & Pitch, while the magnetometer must pass through Tilt Compensation before it can contribute Yaw. The repeated Calibration Unit blocks are not decoration: bias or scale errors injected before fusion contaminate every downstream angle. This division of labour explains the complementary-filter equation that follows and why pressure needs its own contextual cross-check rather than being folded blindly into orientation.
These limits explain the whole design pattern of inertial sensing: the accelerometer gives an absolute, gravity-referenced tilt that never drifts but is noisy and ambiguous under motion; the gyroscope gives smooth short-term rotation that slowly drifts. Fusing them is not a luxury — it is how you get a stable orientation from imperfect parts.
The simplest fusion logic is a complementary filter. At each sample it trusts the gyroscope for the fast change, then slowly pulls the estimate back toward the accelerometer angle: angle = alpha * (angle + gyro_rate * dt) + (1 - alpha) * accel_angle. A larger alpha follows fast rotations more smoothly but corrects drift slowly; a smaller alpha rejects drift faster but lets vibration shake the angle estimate.
Environmental pressure adds another kind of ambiguity. A BMP280 can see a floor change because pressure changes with height, but it cannot tell whether pressure changed because the device moved upward or because weather drifted over minutes. The robust lab pattern is therefore the same as IMU fusion: keep a short-term baseline, log raw and converted values, and compare the inferred event against another clue before making a decision.
41.6.1 Under-the-Hood Knowledge Check
41.7 Release Checklist
Before relying on motion or pressure-derived events, confirm these points:
Start by the IMU full-scale range, LSB-per-unit constants, raw offsets, and mounting orientation are recorded with the calibration data. Then stationary accelerometer readings have total magnitude near 1 g, not merely near zero on each axis. Next motion thresholds are tested across orientation changes, taps, vibration, and expected activity patterns. After that gyroscope integrations include sample interval evidence and a drift-correction plan, such as a complementary or Kalman filter. Continue by pressure-based floor or altitude logic uses a short-term baseline and relative changes rather than unqualified absolute pressure. Finally each event record stores raw values, converted units, baseline timestamp, threshold, and any companion evidence used for confirmation.
41.8 See Also
Start by Motion and Environmental Sensor Labs for MPU6050 and BMP280 setup, code, and exercises. Then Sensor Data Processing for filtering and confidence checks after acquisition. Next Sensor Calibration Techniques for reference records, offsets, and drift management. Finally Sensor Power Management for duty-cycling IMUs and pressure sensors in battery nodes.
41.9 Next
Return to Motion and Environmental Sensor Labs once the calibration boundaries are clear, then continue to Light and Proximity Sensors for optical, PIR, ultrasonic, and capacitive readout practice.
