Menu

Sensor Calibration and Drift

Sensor Calibration and Drift: The Sensor That Lies a Little More Every Minute

Notes · Sensors and estimationNovember 19, 202624 min readSenova Systems Research

A gyroscope measures rate, not angle, the angle is the integral of the rate, so any bias is integrated too: a bias of 0.1°/s adds 6° of error every minute, 360° in an hour. Bias is the offset the sensor reads at rest; it shifts with temperature and time, and random noise adds its own slow wander (a random walk whose standard deviation grows with the square root of time). The fixes are simple and in order: measure the bias at startup while the device is still and subtract it; recalibrate continuously when the device rests; fuse with an accelerometer (complementary filter, α ≈ 0.98), the accelerometer gives tilt with no drift when still, the gyro gives smooth fast motion. Yaw has no gravity reference, so it needs a magnetometer. Even a well-calibrated gyroscope cannot be trusted for hours without a second sensor to check against.

First, a simple picture

A speedometer, and a compass.

A speedometer tells you how fast you are going. It does not tell you where you are. If you want to know where you are, you have to add up the speed over time, and if the speedometer reads a little high when you are standing still, you will think you are moving when you are not, and the further you go, the further wrong you are.

A compass tells you which way is north. It does not tell you where you are either, but it never drifts, it always points at the same thing, however long you wait. A gyroscope is a speedometer: it measures how fast something is turning, not which way it is pointing.

An accelerometer is closer to a compass: when the device is still, it measures gravity, and gravity always points down. The whole of sensor calibration is the business of combining a speedometer that drifts with a compass that does not, and knowing which one to trust, and when.

A gyroscope measures rate, not angle, and the angle is the sum of everything it ever read

A gyroscope measures rate, not angle. The angle is the running sum of every reading, so a bias of 0.1°/s adds 6° a minute and 360° an hour while the sensor sits still:

θk+1=θk+ωk Δt,θerror(t)=b t=0.1 ∘/s×3600 s=360∘\theta_{k+1} = \theta_k + \omega_k\,\Delta t, \qquad \theta_{\text{error}}(t) = b\,t = 0.1\ ^\circ\text{/s} \times 3600\ \text{s} = 360^\circ

A gyroscope does not measure angle. It measures angular rate, how fast the sensor turns, in degrees per second, and to get the angle you add up the rate over time: angle(new) = angle(old) + rate × dt. This is integration. If the robot turns at 10°/s for 2 seconds, the angle changes by 10 × 2 = 20°. Do this update many times a second, and you track the orientation. A gyroscope measures angular velocity using the Coriolis effect in vibrating MEMS structures, a tiny vibrating mass is deflected when the sensor rotates, and the deflection is proportional to the rate, and the output is a rate, in degrees per second, around each of three axes. An IMU, an inertial measurement unit, is the combination of a three-axis gyroscope and a three-axis accelerometer, sometimes with a three-axis magnetometer, that together give six (or nine) degrees of freedom of inertial observation. It does not directly measure global orientation, velocity, or position. Those states emerge by integrating measurements and combining them with gravity, kinematic, and external observations.

The trap is that integration adds up everything, including the error. No gyroscope reads exactly zero when it is still. It has a small offset called bias, the output of a gyroscope when the input rate is zero, and integration adds up everything, including the bias, so the error does not average out. It keeps piling up. The worked example, from the checked guides: a bias of 0.1°/s adds 6° of error every minute, after 1 second, 0.1 × 1 = 0.1°; after 1 minute, 0.1 × 60 = 6°; after 10 minutes, 60°; after 1 hour, 360°, the sensor has invented a full rotation while sitting perfectly still on the table. The orientation estimate now contains every error the gyro has ever made. And the checked guides say it plainly: if you leave an IMU sitting on a table, after a while it will confidently tell you that it has rotated several degrees. The robot hasn't moved. The room hasn't moved. The sensor has simply accumulated a small error until it has invented a completely different reality. Within 30 seconds, a typical MEMS gyroscope can drift by several degrees.

Bias is the offset the sensor reads at rest, and it is not constant. Bias is a consistent error in the sensor's measurement: instead of randomly fluctuating around the true value, the sensor has a small offset. Imagine the same gyro, sitting perfectly still, reporting 0.05, 0.05, 0.06, 0.05, 0.04°/s, not random, but consistently wrong. And what is worse is that this bias is not constant either. It floats up and down. It slowly wanders over time, a process that can be modelled as a random walk for short periods, because real MEMS gyroscopes exhibit slowly varying bias caused by temperature, mechanical stress, ageing, and stochastic processes. Practical estimators consequently treat gyroscope bias as a state that must be calibrated initially and often estimated continuously during operation. A constant bias produces a linearly growing orientation error, while a slowly varying bias causes the estimate to drift unpredictably over time.

Random noise adds its own slow wander. Even after you remove the bias, each reading has random noise, the random variation in a sensor's output even when the true value has not changed, from quantisation, EMI, thermal noise, really anything. When you integrate noise, the errors do not cancel perfectly. They behave like a random walk, so the angle wanders a little further from the truth the longer you run, although more slowly than a steady bias would. The checked figure: angular random walk (ARW) grows as N·√t, if a sensor has a noise density N = 0.01°/s/√Hz, after 3,600 seconds (1 hour), the heading uncertainty is 0.01 × √3600 = 0.6° (1σ). The standard deviation grows with the square root of time, so the wander slows down as time goes on, but it never stops, and it never comes back. The error model, from the checked guides, is one line: ω_meas(t) = ω_true(t) + b(t) + n(t), the measured rate is the true rate, plus a time-varying bias, plus white noise. Everything in this article is a consequence of that one line.

Four errors, four signatures, and one zero subtraction cannot correct all four

Four gyro errors, four signatures; one zero subtraction cannot fix all four

ErrorWhat it isExampleWhen it shows
BiasA constant offset0.1°/s is 6° a minuteAt rest; grows linearly
NoiseRandom, sample to sampleN = 0.01 gives 0.6° in an hourAlways; grows as √t
Scale factorGain error2.5% on a 90° pan is 2.25°Only while turning
MisalignmentAxes not squareOne axis reads part of anotherOnly in 3-D motion

Bias is an additive offset, noise varies sample to sample, scale error changes gain, and non-orthogonality or misalignment mixes axes. A single zero subtraction cannot correct all four. The four errors, with their signatures:

1. Bias, the offset at rest. The sensor reads a rate when it is still. The signature is static: a long stationary log shows a non-zero mean. The fix is the startup calibration: measure the mean output while the device is still, and subtract it. But the calibration is only as good as the measurement, and the measurement has noise in it, so the residual bias after calibration is the noise in the calibration window. The demo quantifies it: a 10-second window leaves a 1σ calibration error of 0.0095°/s, which integrates to 5.7° in 10 minutes; a 60-second window leaves 0.0039°/s, which integrates to 2.3° in 10 minutes. Longer window, smaller residual, and the window is the first design decision in the calibration, not an afterthought.

2. Noise, the random walk. The sensor's output varies sample to sample even when the true value has not changed. The signature is statistical: the Allan deviation curve, plotted against averaging time on log axes, falls at short scales as white rate noise averages down, flattens at a minimum, the bias instability, and climbs again at long scales as the bias itself wanders. The fix is averaging and filtering, the filter, not the calibration, because noise cannot be subtracted. It can only be smoothed.

3. Scale factor, the gain error. Scale factor is the ratio of the change in the output to the change in the input to be measured, the slope of the input-output line. A scale factor error means the sensor reads 2.5% high on every turn: the output error is proportional to the true rate along the sensitive axis, so it only shows while the device is turning, and the drift is proportional to the rate and the duration of the motion. The demo quantifies it: a 2.5% scale factor error on a 90° pan is 2.25° of error per pan; a 1% error is 0.90° per pan. And the scale factor changes, on every booting, and under different environmental conditions, the scale factor and biases change, so a factory calibration does not hold forever. The in-field fix, from a published paper (arXiv, 2021): rotate the sensor manually through 360° and use the rotation itself as the calibration reference, because gyroscopes lack a reliable reference, since the Earth's self-rotation speed (15°/h) is insufficient for accurate calibration, and the method achieves scale factor and bias errors of less than 2.5×10⁻² for the LSM9DS1 and less than 1×10⁻² for the ICM20948, in under 30 seconds on a low-energy microcontroller.

4. Misalignment, the axes that are not square. Non-orthogonality is caused by the misalignment between the sensitive axis of the inertial sensor and the orthogonal axis of the carrier coordinate system, the essential cause is limited processing technology, and it makes each axis measure part of the specific force in the direction orthogonal to its sensitive axis. Misalignment error is the attitude transition matrix between the IMU coordinate system and the magnetometer coordinate system, due to the production process or the printed circuit board (PCB) mounting process, the board the sensor is soldered to, and the way it is soldered, introduces small misalignments that the factory calibration never saw. The signature is three-dimensional: the error only shows when the device moves in more than one axis at once. And the rule, from the checked guides: calibration values must be tied to the exact sensor, mount, firmware, and operating envelope, change the mount, and the calibration is stale.

Bias stability is the number that decides how far a heading drifts during a run, and it is not the bias. Bias stability is the standard deviation of the averaged output over a stated window, in degrees per hour at one sigma, a spread, not a constant offset. Take a unit specified at 0.05 °/h: that does not mean the output stays within 0.05 °/h of truth; it means that when the output is averaged into 10-second blocks, about 68% of those block averages land within 0.05 °/h of the mean and 95% within 0.10 °/h. A budget built on the 1σ figure holds on roughly two runs in three; if it has to hold on most, use 2σ or 3σ. The quoted figure is the minimum of the Allan deviation curve, and the bracket holds the averaging time at which it was found, a gyro specified at 10 s and one at 100 s are not comparable at face value: if the curve is still descending at 10 s, the true floor sits lower and later. Read the annotation before the number: two datasheets both reading 0.05 °/h can describe instruments that behave differently across a one-hour run. The pipeline's "measured over ~100 seconds at constant temperature" is one common annotation, not a universal one, datasheets use 1 s, 10 s, and 100 s windows, and the article states it that way, with the file noting the refinement. The grades, from the checked guides: consumer MEMS 20–50 °/h (bias instability, with an angle random walk of 0.5 °/√h); industrial MEMS 1–10 °/h (ARW 0.05 °/√h); tactical (fibre-optic or ring-laser) 0.1 °/h (ARW 0.001 °/√h). And the rule that matters: bias can be calibrated; bias stability is a physical chip characteristic that cannot be calibrated away.

Temperature effects are not included in bias-stability measurements, and they are the biggest error in the field. Bias stability describes wander during a single run, warm and thermally steady. Temperature parameters have been clearly identified as the main driving factor for the bias stability of MEMS gyroscopes, and the effect of temperature on the bias stability of different gyroscopes shows heterogeneity and complexity, which makes it difficult to compensate. The field case, from a checked guide: at room temperature 25°C the bias was normal, but once the module self-heated to 35°C, the gyro bias drifted past ±0.3°/s, and after power-on, the IMU self-heats (100–300 mW of power draw), typically rising from 25°C room temperature to 50°C, and this 25°C swing can cause more bias drift than the initial bias itself. Temperature drift is bias shift per degree of temperature change, in °/s/°C, and the rule is: don't just look at "bias", demand the "bias vs. temperature" curve, with full-range −20°C to +60°C data from the manufacturer. A residual bias from a temperature change causes an error that grows linearly with time, because a constant offset, whatever caused it, integrates linearly. And the three bias numbers on the same datasheet tell the story: on one published fibre-optic gyro, bias stability (1σ, 10 s) is ≤0.05 °/h, bias repeatability (1σ) is ≤0.05 °/h, and full-temperature bias repeatability is ≤0.3 °/h, six times the first figure, and the one that governs whenever the hardware changes temperature. The worked example from that guide: 0.05 °/h over 45 minutes accumulates 0.0375° of heading, which at 12 km tilts the track sideways by about 7.9 m, but a line at 60 °C against a 20 °C launch crosses the unit's range during the run, so the 0.3 °/h figure applies: 0.225°, or about 47 m at the far end, more than the whole spread between the three grades.

The fixes, in order, and the one that does not work

Fix 1, Measure the bias at startup while the device is still, and subtract it. The most basic version of calibration is the start-up bias calibration: compute the gyroscope's bias by measuring the steady state's mean output during the start-up phase, while neglecting the Earth's rotation. Start with a warmed-up, motionless sensor on a stable support. Log each gyro axis, keep temperature and timestamps, and separate the calibration interval from a later stationary interval, because the calibration is only as good as the measurement, and the measurement has noise in it. The demo quantifies the window: with a noise density of 0.3°/s, a 10-second window leaves a 1σ calibration error of 0.0095°/s (5.7° in 10 minutes); a 60-second window leaves 0.0039°/s (2.3° in 10 minutes). The window is the first design decision. And the calibration cannot predict how the bias will change later, calibration removes the bias that existed during the calibration process, but it cannot predict how the bias will change later. The temperature step in the demo is the proof: the bias steps by +0.3°/s at 5 minutes, and the startup calibration, taken at 25°C, knows nothing about it.

Fix 2, Recalibrate continuously when the device rests. The bias is a state that must be calibrated initially and often estimated continuously during operation, and the practical way to do it is to re-learn the bias whenever the device stops. A differential-drive robot that re-learns the gyro bias whenever it stops is the pattern: every time the device is still, the gyro should read zero, and whatever it reads is the bias, right now, at this temperature. The demo's hub sits still on a fence post between events, and every still period is a calibration opportunity. The filter that does this properly is the Kalman filter from Article #4: it explicitly models the gyro bias as a state, and estimates it continuously, alongside the angle, which is the key advantage over the complementary filter, and the reason Article #4's filter has a bias state in it.

Fix 3, Fuse with an accelerometer. The complementary filter blends the smooth gyroscope with the drift-free accelerometer: angle = α × (angle + gyro × dt) + (1 − α) × accel_angle, with α typically 0.95 to 0.98, and at α = 0.98, you trust the gyroscope 98% and the accelerometer 2% at each time step. The gyroscope provides the fast response, while the accelerometer slowly corrects any drift. The time constant is τ = α·dt/(1 − α), for α = 0.98 and dt = 0.01 s (100 Hz), τ ≈ 0.49 s: signals faster than this come mostly from the gyroscope; slower signals come from the accelerometer. If you increase α, drift correction becomes slower but the output is smoother; if you decrease α, drift corrects faster but accelerometer noise leaks through. The accelerometer gives tilt with no drift when still, because gravity always points down, and the gyro gives smooth fast motion. The gyro is excellent at measuring short-term changes, but drifts over time. The accelerometer provides a long-term reference, but becomes unreliable during motion. The complementary filter fuses these two sensors, using the best bits from both. And the Kalman filter does the same job with a more careful treatment of the noise in each sensor, a time-varying gain, computed from how much it trusts the model versus the measurement, instead of a fixed weighting. The two failure modes are complementary: the accelerometer's noise is high-frequency, while the gyroscope's drift is low-frequency, and the filter is the thing that separates them.

Fix 4, Yaw needs a magnetometer, because yaw has no gravity reference. Gravity can help constrain roll and pitch during suitable motion, but it does not directly observe yaw. A magnetometer measures the local magnetic field vector to provide an absolute heading reference, correcting long-term gyroscope yaw drift, and it is susceptible to hard-iron and soft-iron magnetic disturbances from nearby electronics, which is why the magnetometer needs its own calibration (collect samples while turning the sensor through every direction, and fit a sphere for hard iron only, or an ellipsoid for hard and soft iron). The complementary filter fixes roll and pitch, and leaves yaw to the gyro, and the demo quantifies it: with a residual bias stability of 10 °/h and no magnetometer, the yaw wanders about 10° in an hour, and 80° in an 8-hour shift. The magnetometer is not a nice-to-have. It is the only absolute reference the yaw axis has.

The one that does not work, trusting the gyro alone for hours. Even a well-calibrated gyroscope cannot be trusted for hours without a second sensor to check against. Pure double integration is not a practical long-term position solution for a typical robot IMU, external position, velocity, contact, or zero-motion constraints are needed according to the application. The accelerometer error grows quickly after integration: an acceleration offset changes estimated velocity continuously, and position error can grow quadratically in a simple uncorrected case, and a small orientation error projects gravity incorrectly into horizontal acceleration, often overwhelming true low acceleration. The hub that sits still for 10 minutes and thinks it has turned 60° is the same hub that, given an hour, thinks it has turned 360°, and given a day, has invented a journey it never took.

Factory calibration covers scale factor and axis alignment, but mounting on the board introduces small misalignments. Factory-written coefficients, scale factor, cross-axis sensitivity, bias, temperature model, are stored in OTP ROM and applied at power-on to correct systematic errors, and every MEMS gyroscope delivered by the factory has had calibration work done on it. But the calibration parameters change after the sensor restarts, and they depend significantly on temperature, and the mounting introduces its own errors, because the misalignment between the IMU coordinate system and the magnetometer coordinate system comes from the production process or the PCB mounting process. The factory calibrated the chip. Nobody calibrated the board. The calibration values must be tied to the exact sensor, mount, firmware, and operating envelope, and the in-field calibration, the 360° rotation, the six-position accelerometer test, and the magnetometer ellipsoid fit are the things that calibrate the board, not the chip.

DEMO

Example Labs is a made-up company we use for worked examples.

The device is the one this article is about: the Example Labs field sensor hub from Articles #6 and #7, the 100 × 60 × 40 mm box on the fence post, in the sun, holding the event camera, the IMU, and the MCU. The hub sits still. The camera watches the fence line.

The IMU measures the hub's orientation, the tilt of the camera, the heading of the fence, and the demo runs the hub's gyro for 10 minutes at 100 Hz, with a fixed seed, and shows what each fix buys. The demo's arithmetic is the article's own, verified before writing, a real simulation, not just arithmetic, in the same style as Article #4's Kalman filter simulation.

Step 1, Case A, the raw gyro. The gyro has a bias of 0.1°/s and white noise of 0.3°/s, and the hub sits still for 10 minutes. The integrated angle after 10 minutes is 59.2° (closed-form 60.0°, the difference is the noise walk); after 1 minute it is 5.7° (closed-form 6.0°); after 1 hour it would be 360°. The hub has not moved. The sensor has invented a full rotation. The camera, which the hub thinks has panned 60°, has not moved at all, and the event camera from Article #2, whose readings the filter must trust, is now pointed at a fence the hub thinks is somewhere else.

Step 2, Case B, the startup calibration. Measure the bias over the first 60 seconds while the hub is still, and subtract it. The measured bias is 0.0957°/s (true 0.1°/s), and the integrated angle after 10 minutes is 1.75° (closed-form 1.67°, from the consumer MEMS bias stability of 10 °/h = 0.00278°/s). The calibration bought a factor of 34, from 59.2° to 1.75°, but it did not buy zero. And the window matters: with a noise density of 0.3°/s, a 10-second calibration window leaves a 1σ calibration error of 0.0095°/s, which integrates to 5.7° in 10 minutes and 34.2° in an hour; a 60-second window leaves 0.0039°/s, which integrates to 2.3° in 10 minutes and 13.9° in an hour. The calibration is only as good as the measurement, and the measurement is only as good as the window. The angle random walk, for comparison, is smaller: with N = 0.01°/s/√Hz, the 1σ heading uncertainty after 10 minutes is 0.24°, and after 1 hour 0.60°. The bias stability, not the noise, is the error that matters, and the bias stability is the number the datasheet gives you, in °/h, at 1σ, with the averaging time in the bracket.

Step 3, Case C, the complementary filter. Run the complementary filter with α = 0.98 on the calibrated gyro, with the accelerometer giving the tilt (true 0°, plus 0.5° of noise per sample, the demo's own assumption, labelled as such). The final angle is 0.02°, and the maximum absolute angle over the 10 minutes is 0.20°. The error is bounded, because the accelerometer pulls the estimate back to the true tilt, with a time constant of 0.49 s, and the gyro's drift, which is slow, is corrected faster than it can accumulate. The filter bought the hours that the calibration could not: the calibration bought minutes (1.75° in 10 minutes, 10° in an hour), and the filter bought a bounded error, for as long as the hub sits still. The Kalman filter from Article #4 does the same job with a more careful treatment of the noise, and it estimates the bias as a state, continuously, instead of subtracting a single number measured once at startup.

Step 4, The temperature step. At 5 minutes, the bias steps by +0.3°/s, the checked field case, where the module self-heated from 25°C to 35°C and the gyro bias drifted past ±0.3°/s. The integrated angle after 10 minutes is 149.2°, an extra 90° in the second 5 minutes. The startup calibration, taken at 25°C, knows nothing about it, because calibration removes the bias that existed during the calibration process, but it cannot predict how the bias will change later. The hub is in the sun, on a fence post, and the sun is the calibration's enemy: the IMU self-heats 100–300 mW, rising from 25°C to 50°C, and the 25°C swing can cause more bias drift than the initial bias itself. The fix is not a longer startup window. The fix is the temperature model, the bias vs. temperature curve, measured across the full −20°C to +60°C range, and the continuous re-calibration, every time the device rests.

Step 5, The yaw, and the scale factor. The complementary filter fixes roll and pitch, and leaves yaw to the gyro, because yaw has no gravity reference. With a residual bias stability of 10 °/h and no magnetometer, the yaw wanders about 10° in an hour, and 80° in an 8-hour shift. The magnetometer is the fix, and it needs its own calibration, because the board's electronics disturb the magnetic field. And the scale factor: a 2.5% error on a 90° pan is 2.25° of error per pan, and a 1% error is 0.90° per pan, and the error only shows while the device is turning, which is why the hub's camera, which pans to track a vehicle, accumulates a heading error that the stationary calibration never sees. The in-field fix is the 360° rotation: turn the sensor through a full circle, use the rotation itself as the reference, and the scale factor and bias errors fall below 2.5×10⁻², in under 30 seconds, on a low-energy microcontroller.

Raw, no calibration59.20 °Start-up calibration (60 s still)1.75 °Complementary filter, α = 0.980.02 °Log scale. Shorter is better.
A gyro sitting still for 10 minutes (simulated, 100 Hz, seed 7): how far the heading wanders under each approach

The decision test

Four questions. They sort the sensors that can be trusted from the sensors that lie a little more every minute:

  1. Do you know the bias, and the bias stability, and the averaging time in the bracket? No, and the sensor is telling you it has turned 60° while sitting still, and you have no number for how fast it lies. Yes, and you know the bias (the offset, which you can calibrate), the bias stability (the wander, in °/h at 1σ, which you cannot calibrate away), and the averaging time the figure was measured at, so you can compare two datasheets without being fooled by the bracket.
  2. Have you measured the bias vs. temperature curve, across the full operating range? No, and the hub is in the sun, the IMU self-heats from 25°C to 50°C, and the 25°C swing causes more bias drift than the initial bias itself, and the startup calibration knows nothing about it. Yes, and the temperature model is in the firmware, the bias is compensated as the temperature changes, and the full-temperature repeatability, six times the headline figure, is the number the budget is built on.
  3. Is there a second sensor checking the first, and does it cover yaw? No, and the gyro integrates alone, the error grows without bound, and the yaw has no reference at all, so it walks away 10° an hour, 80° a shift. Yes, and the accelerometer bounds roll and pitch through the complementary filter (α = 0.98, τ = 0.49 s) or the Kalman filter from Article #4, and the magnetometer bounds the yaw, with its own hard-iron and soft-iron calibration.
  4. Does the calibration cover the board, not just the chip, and does it repeat when the device rests? No, and the factory calibrated the chip, the board mount introduced misalignments the factory never saw, the scale factor changed on the next boot, and the calibration is stale. Yes, and the in-field calibration (the 360° rotation, the six-position accelerometer test, the magnetometer ellipsoid fit) calibrates the board, and the bias is re-learned every time the device rests, because the bias is a state that must be estimated continuously, not a number measured once.

If the answers are yes, yes, yes, yes, the sensor can be trusted, and the review is a final check, not a rescue. If any answer is no, the job is a sensing/calibration review, and the honest thing is to do it before the device ships, not after it, when the heading has walked away and the customer is the one who noticed. And if the answer to question 1 is "the datasheet says 0.05 °/h", the problem is not the number.

The problem is the bracket, and the review starts by reading it.

"But the sensor is factory-calibrated", and two more fair doubts

"But the sensor is factory-calibrated." The factory calibrated the chip, the scale factor, the cross-axis sensitivity, the bias, the temperature model, stored in OTP ROM and applied at power-on. The factory did not calibrate the board. The mounting introduces small misalignments that the factory never saw, and the calibration parameters change after the sensor restarts and depend significantly on temperature. The factory calibration is the starting point, not the calibration, and the in-field calibration, the 360° rotation, the six-position test, and the magnetometer fit are the things that calibrate the board, not the chip. The calibration values must be tied to the exact sensor, mount, firmware, and operating envelope, change any one of them, and the calibration is stale.

"But we calibrate at startup, and it still drifts." The startup calibration removes the bias that existed during the calibration process, and it cannot predict how the bias will change later. The bias wanders with temperature, with mechanical stress, with ageing, and with stochastic processes, and the hub is in the sun, so the temperature is changing while the hub sits still. The startup calibration buys minutes: 1.75° in 10 minutes, 10° in an hour. The fix is not a longer startup window, a 60-second window leaves a 1σ error of 0.0039°/s, which still integrates to 13.9° in an hour. The fix is the continuous re-calibration, every time the device rests, and the fusion with a second sensor, which bounds the error instead of integrating it. The Kalman filter from Article #4 estimates the bias as a state, continuously, which is why it has a bias state in it, and why the complementary filter, which does not, is the simpler tool for the simpler job.

"But the magnetometer is noisy near the motors." It is, and that is why the magnetometer needs its own calibration, and why the fusion has to know when to trust it. The magnetometer is susceptible to hard-iron and soft-iron magnetic disturbances from nearby electronics, the motors, the power supply, the steel in the fence post, and the calibration is to collect samples while turning the sensor through every direction, and fit a sphere (hard iron only) or an ellipsoid (hard and soft iron). And the fusion has to weight the magnetometer by its quality: when the motors are running, the magnetometer is noisy, and the gyro carries the heading; when the motors are off, the magnetometer corrects the yaw. The Kalman filter does this with a time-varying gain, computed from how much it trusts the model versus the measurement, which is the same job it does for the accelerometer, and the reason Article #4's filter is the tool for the job when the noise changes. The magnetometer is not perfect. It is the only absolute reference the yaw axis has, and the alternative is a heading that walks away 80° a shift.

Sources

  1. DuckyHelper, "Why gyroscopes drift and robots can't trust them alone"
    What we used

    "A gyroscope reports rotation rate. Integrating it gives angle, and any small bias is integrated too"; "A bias of 0.1°/s adds 6° of error every minute"; `angle(new) = angle(old) + rate × dt`; a simple recipe is the complementary filter: `angle = α × (angle + gyro × dt) + (1 − α) × accel_angle`; more advanced fusion methods, such as the Kalman filter, do the same job with a more careful treatment of the noise in each sensor; even after you remove the bias, each reading has random noise, when you integrate noise, the errors behave like a random walk, so the angle wanders a little further from the truth the longer you run

  2. AzadRoy, "Everything Lies: Gyro Drift"
    What we used

    Gyroscopes measure angular velocity; if you integrate that measurement over time, you get orientation; if you leave an IMU sitting on a table, after a while it will confidently tell you that it has rotated several degrees, the robot hasn't moved, the room hasn't moved, the sensor has simply accumulated a small error until it has invented a completely different reality; measurement noise is the random variation in a sensor's output even when the true value has not changed; bias is a consistent error, a small offset; the bias is not constant, it floats up and down, it slowly wanders over time (modelled as a random walk for short periods); "The orientation estimate now contains every error the gyro has ever made"; a constant bias produces a linearly growing orientation error, while a slowly varying bias causes the estimate to drift unpredictably over time; calibration removes the bias that existed during the calibration process, but it cannot predict how the bias will change later; the gyro is excellent at measuring short-term changes, but drifts over time; the accelerometer provides a long-term reference, but becomes unreliable during motion

  3. SiliconWit, "Sensor Fusion and State Estimation"
    What we used

    A gyroscope measures angular velocity cleanly, but integrating angular rate to get angle introduces drift that grows without bound; within 30 seconds, a typical MEMS gyroscope can drift by several degrees; the complementary filter is a weighted blend: trust the gyroscope for short-term changes and the accelerometer for long-term stability; a single parameter (typically 0.95 to 0.98) controls the tradeoff, at α = 0.98, you trust the gyroscope 98% and the accelerometer 2% at each time step; the time constant is τ = α·dt/(1 − α), for α = 0.98 and dt = 0.01 s (100 Hz), τ ≈ 0.49 s; the Kalman filter is the optimal linear estimator for Gaussian noise, it computes a time-varying gain based on how much it trusts the model versus the measurement; the Kalman filter explicitly models and corrects for gyro bias, estimating angle and bias simultaneously; the accelerometer's noise is high-frequency, while the gyroscope's drift is low-frequency; gyro noise std 0.3 °/s in the worked example

  4. Procirel, "Gyroscope Sensor Explained: Working, Arduino & Uses"
    What we used

    Gyroscopes measure angular velocity (°/s) using the Coriolis effect in vibrating MEMS structures; the complementary filter fuses gyro + accelerometer: θ = α·(θ_prev + ω·dt) + (1−α)·θ_accel; ARW grows as N·√t over time; if a sensor has N = 0.01°/s/√Hz, after 3,600 seconds (1 hour), heading uncertainty = 0.01 × √3600 = 0.6°; consumer MEMS bias instability 20–50 °/h, ARW 0.5 °/√h; industrial MEMS 1–10 °/h, ARW 0.05 °/√h; tactical (FOG/RLG) 0.1 °/h, ARW 0.001 °/√h; IEEE 1431 governs scale factor, vibration rectification, and temperature compensation specs

  5. Liocrebif, "Bias Stability Explained: The Single Number That Defines Your Gyro"
    What we used

    Bias stability is the standard deviation of the averaged output over a stated window, in degrees per hour at one sigma, a spread, not a constant offset; a unit specified at 0.05 °/h means about 68% of 10-second block averages land within 0.05 °/h of the mean and 95% within 0.10 °/h, a budget built on the 1σ figure holds on roughly two runs in three; if it has to hold on most, use 2σ or 3σ; bias stability is read off an Allan deviation curve, it falls at short scales as white rate noise averages down, flattens at a minimum (the bias instability), and climbs again at long scales as the bias itself wanders; the quoted figure is that minimum, and the bracket holds the averaging time at which it was found, a gyro specified at 10 s and one at 100 s are not comparable at face value; bias stability describes wander during a single run, warm and thermally steady; bias repeatability describes the power-up-to-power-up spread at constant temperature; full-temperature bias repeatability is what remains after compensation across the operating range: six times the first figure on the published fibre-optic gyro (0.3 against 0.05 °/h); worked example, 0.05 °/h over 45 minutes accumulates 0.0375° of heading, which at 12 km tilts the track sideways by about 7.9 m; with temperature, 0.3 °/h gives 0.225°, or about 47 m

  6. Engineering for Change, "Basic Knowledge of Bias Stability of MEMS Gyroscope"
    What we used

    Bias stability refers to the stability of the output signal of the MEMS gyroscope at zero input angular velocity; temperature parameters have been clearly identified as the main driving factor for the bias stability of MEMS gyroscope; after temperature compensation, the bias stability is improved by 22 times in one cited study; the 1σ method and the Allan variance method are the two ways to calculate bias stability; the ER-MG2-50/100 is a high-performance north-seeking MEMS gyroscope with bias stability (1σ 10s) of 0.05–0.1 °/h and zero-bias stability (1σ 1s) of 0.15–0.3 °/h

  7. AOMway, "IMU Selection Guide: 6 Metrics That Actually Determine Flight Controller Performance (2026)"
    What we used

    A 0.1°/s gyro bias means attitude integration drifts 360° after 1 hour; temperature drift is the #1 killer in industrial scenarios, the 25°C self-heating range can cause more drift than initial bias; at room temperature 25°C the bias was normal, but once the module self-heated to 35°C, gyro bias drifted past ±0.3°/s; after power-on, the IMU self-heats (100–300 mW power draw), typically rising from 25°C room temperature to 50°C, this 25°C swing can cause more bias drift than the initial bias itself; consumer IMU gyro bias stability typically 10–50 °/h, industrial 1–10 °/h, tactical (ADIS16470) <1 °/h; "Bias can be calibrated; bias stability is a physical chip characteristic that cannot be calibrated away"; temperature drift is bias shift per degree of temperature change (°/s/°C); don't just look at "bias", demand the "bias vs. temperature" curve, with full-range −20°C to +60°C data

  8. Engineering for Change, "Error characteristic analysis of MEMS gyroscope"
    What we used

    Scale factor error is the deviation of the unit slope of the input-output of the inertial instrument; the output error of a three-axis device caused by a scaling factor error is proportional to the true specific force along the sensitive axis; non-orthogonality error is caused by the misalignment between the sensitive axis of the inertial sensor and the orthogonal axis of the carrier coordinate system; zero bias is a constant error that all accelerometers and gyroscopes exhibit, and has nothing to do with the actual output of the carrier; the misalignment error refers to the attitude transition matrix between the IMU coordinate system and the magnetometer coordinate system due to the production process or the PCB mounting process; Ericco has done calibration work on every MEMS gyroscope delivered by the factory

  9. arXiv, "In-Field Gyroscope Autocalibration with Iterative Attitude Estimation" (2021)
    What we used

    Gyroscopes lack a reliable reference since the Earth's self-rotation speed is insufficient for accurate calibration; the method uses manual rotation of the MEMS gyroscope to a specific angle (360°) as the calibration reference; it can be implemented in real-time on a low-energy microcontroller and completed in under 30 seconds; it achieves scale factor and bias errors of less than 2.5×10⁻² for LSM9DS1 and less than 1×10⁻² for ICM20948; on every booting or under different environmental conditions, the scale factor and biases change; when calculating the attitude, the integration will lead to the accumulation of drift and scale factor error

  10. MDPI Sensors 2023, 23, 6431, "Homogeneous Sensor Fusion Optimization for Low-Cost Inertial Sensors"
    What we used

    The calibration parameters change after the sensor restarts and also significantly depend on the temperature; the most basic version of calibration is the start-up bias calibration, which computes the gyroscope's bias (offset) by measuring the steady state's mean output during the start-up phase while neglecting the Earth's rotation; offline calibration rotates the sensor by several predefined angular velocities and fits a calibration curve, measuring at different temperatures to compensate for thermal drift; the calibration estimates the sensor's gain, bias, misalignment, and optionally higher-order nonlinearity

  11. PhysicalAI Lab, "Robot IMU Bias, Drift and Calibration Guide"
    What we used

    An IMU measures angular velocity and specific force; it does not directly measure global orientation, velocity or position, those states emerge by integrating measurements and combining them with gravity, kinematic and external observations; gyroscope bias integrates into angle error; accelerometer bias integrates into velocity error and then position error; scale factor, axis misalignment, vibration, temperature, sampling and timestamp errors create different signatures and require different tests; "A single zero subtraction cannot correct all four [bias, noise, scale and alignment]"; "Calibration values must be tied to the exact sensor, mount, firmware and operating envelope"; a constant angular-rate offset accumulates approximately linearly into angle when uncorrected; gravity can help constrain roll and pitch during suitable motion, but it does not directly observe yaw, magnetometers, vision, lidar or other references may constrain heading; measure yaw drift during long stationary holds and representative motion, and report drift distribution and temperature rather than one best run; an acceleration offset changes estimated velocity continuously, and position error can grow quadratically in a simple uncorrected case; pure double integration is not a practical long-term position solution for a typical robot IMU, external position, velocity, contact or zero-motion constraints are needed; start with a warmed-up, motionless sensor on a stable support, log each gyro axis, keep temperature and timestamps, and separate the calibration interval from a later stationary interval

  12. Dev.to, "Perception and Sensor Fusion, Chapter 05: IMU and Inertial Perception"
    What we used

    The practical measurement can be modeled as ω_m = ω + b_g + n_g, where b_g represents gyroscope bias and n_g represents measurement noise; even a small constant offset produces continuously increasing attitude error; real MEMS gyroscopes exhibit slowly varying bias caused by temperature, mechanical stress, aging, and stochastic processes; practical estimators treat gyroscope bias as a state that must be calibrated initially and often estimated continuously during operation; gyroscope measurements provide rapid and locally smooth information about rotational motion but accumulate drift after integration; bias and noise have different implications and should not be treated as a single error source

  13. NarrativeGoldmine, "IMU"
    What we used

    The core challenge is drift: integrating noisy sensor readings accumulates error over time, causing the estimated position or heading to wander from ground truth; the magnetometer measures the local magnetic field vector to provide an absolute heading reference, correcting long-term gyroscope yaw drift, and is susceptible to hard-iron and soft-iron magnetic disturbances from nearby electronics; the calibration store holds factory-written coefficients (scale factor, cross-axis sensitivity, bias, temperature model) stored in OTP ROM and applied at power-on; IMU performance is classified primarily by gyroscope bias instability (°/h) and angle random walk (°/√h), characterised using Allan Variance per IEEE Std 952; consumer/MEMS bias instability >1 °/h

  14. GeekyChris, "IMU fusion and encoders"
    What we used

    Gyro-only integration drifts away by its bias; the accelerometer alone is noisy and fooled by every acceleration; the fusion filters keep the best of both; a 1 °/s bias is 60° a minute; calibrate gyro bias by keeping the sensor still; record the accelerometer in six positions; collect magnetometer samples while turning the sensor through every direction, and fit a sphere (hard iron only) or an ellipsoid (hard and soft iron); untick "Use the magnetometer" and see yaw left to the gyro; a fused estimate that re-learns the gyro bias whenever the robot stops

  15. MobileStalk, "Complementary Filter vs Kalman Filter: Which Should You Use?"
    What we used

    A gyroscope measures angular rate; integrating it gives a responsive estimate, but gyro bias and noise accumulate into drift; an accelerometer can bound roll and pitch over time but is disturbed by linear motion; a complementary filter combines these signals with fixed or scheduled gains; a Kalman filter combines them through a state-space model and explicit uncertainty estimates; the conventional discrete one-axis form is θ̂_k = α(θ̂_{k−1} + ω_k·Δt) + (1 − α)θ_acc,k; a larger α produces a faster, smoother response but allows more drift; a smaller value corrects drift more aggressively but makes the estimate more susceptible to accelerometer noise and motion-induced errors; a Kalman-family filter becomes more compelling when the estimator must model bias, fuse several coupled states, handle changing measurement quality, or provide uncertainty information

More in precision measurement

The Spec Sheet That Lies About AccuracyA sensor can be precise without being accurate, a tight cluster of readings, far from the true value. Accuracy is closeness to the true value; precision is how tightly repeated readings group; resolution is the smallest detectable change. The Levelogger 6 M100's resolution is 0.6 mm on a 100 m full scale, 83 times finer than its ±5 cm accuracy. Averaging fixes random noise; it cannot fix systematic error. That needs calibration against a known reference.22 minThe Ground That Isn't a GroundOn the schematic every ground symbol is the same point. On the board they are joined by copper, and copper has resistance and inductance, so the ground at the sensor is not the ground at the ADC. The fix is a plane, a return under the trace, and one bridge between the noisy and the quiet.24 minEMC pre-compliance testingAbout half of products fail EMC testing on the first attempt, and each failure costs $5,000–$30,000 and 2–6 weeks. A pre-compliance scan on your own bench finds the failure before the lab does, for $300–$800 a scan.30 minThe Rail That Doesn't RingYour schematic is correct and your board still fails EMC. The problem is in the layout: the hot loop, the switch node, and the ground that is not one ground. Here is the buck converter's noise, measured in numbers.20 minThe Rail That SagsThe processor wakes up, the rail droops, the board resets, the clock jitters, the radio loses packets, and the schematic is correct, because the problem is the impedance of the power delivery network, not the regulator.22 min