2026-09-24

Five errors wearing one name: what temperature does to a measurement chain

Temperature DriftError BudgetADCNTC ThermistorResistor TCRVoltage RegulatorCalibrationUltrasonicESP32-S3MetrologyEmbeddedMeasurement
Five errors wearing one name: what temperature does to a measurement chain

A circuit that behaves differently on Tuesday than it did on Monday, with the same wiring and the same firmware, is the most common complaint in embedded work. The usual explanation is temperature, and the usual outcome is that the explanation is accepted and nothing changes, because temperature as a cause explains everything and therefore predicts nothing.

The useful version of the same observation is narrower. Temperature does not act on a circuit as a whole; it acts on specific parameters of specific parts, each with its own coefficient, its own time constant, and its own answer to the question of whether a calibration can remove it. Enumerated that way the problem becomes arithmetic, and arithmetic produces a ranking.

This piece builds that ranking on one concrete chain: a 12 V supply divided down into the ADC of a 3.3 V microcontroller, a thermistor nearby measuring ambient, and an ultrasonic ranger on the same board. Every input below comes from a published datasheet, and every number is reproducible from the ones printed here.

One symptom, five measurements

The first thing to separate is when the error appears. An offset present from the first sample and constant afterwards is a tolerance. A reading that walks away over the first twenty minutes at constant ambient is the board heating itself. A reading that is correct in the lab and wrong in the field is a coefficient. A reading that is right at both calibrated points and wrong between them is a curve that was approximated with a straight line. A reading that jumps when the radio transmits is not temperature at all, but it arrives with the same symptom and gets blamed on the same cause.

These five need five different tests, and a slow sweep through a temperature chamber will not separate them, because it moves all of them at once.

Symptom Term Time constant Removed by a two-point calibration
Offset from the first sample, constant thereafter component tolerance none yes, per unit
Drifts for ten to thirty minutes after power-on, then settles self-heating minutes no, it depends on load and airflow
Correct at room temperature, wrong at both extremes temperature coefficient follows ambient no, it is the slope itself
Correct at the calibrated points, wrong in between linearisation none no, it needs a table
Moves in bursts when the transmitter fires supply sag and reference error milliseconds only by averaging or decoupling

The order of the last column is the useful part. Two of the five respond to the standard remedy, and the ones that do not are the ones that get the least attention, because they are properties of parts chosen once rather than of a unit being calibrated.

Timing sensors pay a constant that was correct at one temperature

Sound travels at 331.3 m/s in dry air at 0 °C and at 354.7 m/s at 40 °C. That is a 7.07 percent change across a range any outdoor device is expected to work in, and nearly every ultrasonic ranger converts time into distance with a single constant compiled into the firmware.

The error is neither random nor small, and it has a sign.

Ambient Speed of sound Error with 340 m/s assumed Same error on a true 3.00 m
0 °C 331.30 m/s +2.63 % +7.9 cm
14.5 °C 340.00 m/s 0 0
25 °C 346.13 m/s −1.77 % −5.3 cm
40 °C 354.73 m/s −4.15 % −12.5 cm

Two details matter more than the table. The first is the zero crossing at 14.5 °C: a bench test in a comfortable room lands very close to the one ambient temperature at which the constant is right, which is precisely why the problem survives development and appears in the field. The second is the size of the per-degree term, 0.17 percent, which on a three metre path is about five millimetres per kelvin. A sensor that resolves three millimetres and drifts five millimetres per kelvin is not a three millimetre sensor.

Reported distance error against ambient temperature for a firmware constant fixed at 340 m/s, crossing zero at 14.5 °C and reaching minus 4.2 percent at 40 °C

The fix is not a better constant. It is a thermometer: read ambient, recompute the constant, and the term collapses to the accuracy of that thermometer. What remains is humidity, which the expression above ignores because it assumes dry air — smaller than the temperature term over most of the range, but still a term that ultrasonic module datasheets rarely mention.

The same structure appears wherever a quantity is converted into a duration. An RC oscillator's frequency depends on the resistor's temperature coefficient. An internal RC clock trimmed at room temperature is only trimmed at room temperature. The rule generalises: if the measurement is a duration, then whatever converts duration into engineering units is temperature-dependent until proven otherwise.

A resistor carries two numbers, and both are printed

Resistor datasheets state a tolerance and a temperature coefficient, and these are not two views of one uncertainty. The tolerance is a bounded deviation at a reference temperature, usually 25 °C. The coefficient is the slope away from it, in ppm/K. The first is an offset that a single measurement can trim out of a single unit. The second is a slope that no amount of trimming will remove from a batch.

The pairing is explicit in a standard thick-film chip series: ±5 percent parts are specified at ±200 ppm/K, ±1 percent parts at ±100 ppm/K, with the coefficient measured from 20 °C out to the ends of the operating range.

The divider in this chain is 100 k over 15.4 k, turning 12 V into 1.60 V. In a divider the two coefficients either cancel or add, depending on which way they point. If both parts drift in the same direction, the ratio is unchanged in the first order, because numerator and denominator move together. If they drift in opposite directions, the ratio moves by close to the full difference.

Rise above 25 °C 1 % parts, matched 1 % parts, worst mismatch 5 % parts, worst mismatch
25 K 0.000 % −0.43 % −0.86 %
45 K 0.000 % −0.78 % −1.55 %
70 K 0.000 % −1.21 % −2.40 %

Matched drift is exactly zero in the ratio, not approximately zero, which is the entire argument for a resistor network in one package over two discrete parts of the same tolerance. The mismatch columns are the price of buying the two halves of a divider separately: at 45 K of rise with 5 percent parts it reaches 1.55 percent, larger than the ADC's own specified error.

The tolerance, meanwhile, produces a fixed offset. With both parts at ±1 percent, the ratio can sit 1.75 percent from nominal and stay there indefinitely. That is the one term in this article that a screwdriver or a calibration constant removes, and it is the term that receives most of the attention.

The rail is the term most error budgets leave out

A 3.3 V regulator's accuracy is usually remembered as one percent. In the datasheet it is two numbers, and they differ by a factor of four.

The fixed 3.3 V part is specified at ±1 percent with the junction at 25 °C, 5 V in and 10 mA out. Over the full recommended range the C-grade version spans 3.235 to 3.365 V, which is ±1.97 percent, and the I-grade version spans 3.168 to 3.432 V, which is ±4.00 percent. The I-grade part is the one designed for the wider temperature range, and its output band is four times the number from the headline.

Nothing is wrong with the component. The headline is a 25 °C figure and the band is the field figure, and the datasheet prints both.

Whether it matters depends on one design decision. If the sensor is excited by the same rail the ADC uses as its reference — a potentiometer, a bridge, a thermistor divider — the rail appears in both the numerator and the denominator of the conversion and cancels. If the sensor measures something else entirely, such as a 12 V supply divided down, the rail appears once and a four percent rail error becomes a four percent reading error. The same part is irrelevant in one topology and the largest single term in the other.

The ADC figure arrives with a temperature, a capacitor and a radio attached

ADC accuracy is where quoting a single number does the most damage, because the number is usually quoted without its conditions. The ESP32-S3 datasheet is unusually explicit: the measurements in its ADC section are taken with an external 100 nF capacitor, DC input, an ambient of 25 °C, and Wi-Fi disabled.

Under those conditions the calibrated total error is 5 mV over the 850 mV range, 6 mV over 1100 mV, 10 mV over 1600 mV, and 50 mV over 2900 mV. Read as shares of full scale, the four rows reorder themselves.

Attenuation Full scale Total error Share of full scale
ATTEN0 850 mV ±5 mV 0.59 %
ATTEN1 1100 mV ±6 mV 0.55 %
ATTEN2 1600 mV ±10 mV 0.62 %
ATTEN3 2900 mV ±50 mV 1.72 %

The widest range is three times worse in relative terms than the narrowest, which turns range selection into an accuracy decision rather than a convenience one. Sizing a divider so the signal lands inside the 850 mV window buys a factor of three and costs nothing but thought.

The chain used here makes the cost concrete. Its divider delivers 1.60 V, which fits the 1600 mV window and would be read with 0.62 percent error. It is configured for the 2900 mV window instead, which is the default attenuation in most examples, so the same signal is read with 1.72 percent error. Nothing changed except one configuration value, and the term nearly tripled.

Two more numbers from the same section. At 12 bits over 2.9 V one code is 0.708 mV, so a 50 mV total error is seventy codes: resolution is not accuracy, and a stable last digit is evidence of neither. And the linearity terms — ±8 codes integral, ±4 codes differential — are far smaller than the total error, which means most of that 50 mV is gain and offset that a two-point calibration on the actual unit will remove.

Then there are the conditions. Wi-Fi disabled is the one that matters. The same datasheet rates the radio at a 340 mA peak while transmitting at 21 dBm, and a burst of that size moves a 3.3 V rail by more than the ADC's whole error band unless the decoupling is deliberate. A device that converts while its radio transmits is operating outside the conditions under which its ADC was characterised, and no amount of averaging fixes a reference that is moving.

Five error terms from the same measurement chain ranked as a share of one reading, with the removable offset separated from the temperature-dependent slope

A thermistor: three errors, and a table you wrote yourself

A 10 k thermistor with a 3984 K B-value contributes to the budget in three places, and they are not the same size.

The R25 tolerance is an offset. A ±2 percent part, one of the datasheet's standard options, reads about 0.22 K low or high at 25 °C, and reads the same 0.22 K off at every temperature.

The B-value tolerance is a slope. With B specified to ±1 percent the error is zero at 25 °C by construction, because B is defined through two temperatures and one of them is 25 °C, and it grows away from that point: +0.31 K at −10 °C, −0.27 K at 50 °C, −0.71 K at 85 °C.

The third error is in no datasheet. It is the conversion in the firmware. A two-point linear table between 0 and 50 °C, which is what most example code ships, departs from the real curve by up to 15.2 K, and the worst point sits at 34.4 °C — in the middle of the range, not at the ends, which is why checking both endpoints does not reveal it. A table spanning 25 to 85 °C is worse still, 18.4 K, because the curve is steeper where the resistance is smaller.

One comparison settles the argument. Replacing the straight line with a 78-entry table and linear interpolation between entries brings the same error down to 0.01 K. The sensor was never the limiting element.

Self-heating, the term most often raised, is not the problem at these values. A 10 k thermistor in a 3.3 V divider draws 165 µA at 25 °C, dissipates 0.27 mW, and with the 7 mW/K dissipation factor of a bead thermistor sits 0.04 K above ambient. At 85 °C the resistance falls to about 1.07 k and the power falls with it, to 0.095 mW. The term is real and it is two orders of magnitude below the table it competes with.

The board heats itself, and the datasheet says so

Linear regulators turn a voltage difference into heat, and the arithmetic is unforgiving. Dropping 12 V to 3.3 V at 100 mA dissipates 0.87 W. In a SOT-223 package the junction-to-ambient figure is 95.4 K/W, so the junction sits 83 K above ambient: 108 °C in a 25 °C room and 123 °C in a 40 °C one, against a 125 °C limit. At 300 mA the dissipation is 2.61 W and the predicted rise is 249 K, which is not a thermal design but a fault.

That heat does not stay in the package. It raises the local ambient for everything within a few centimetres, including the thermistor that is supposed to be measuring ambient, and the loop closes: the regulator's own dissipation becomes an error term in the temperature the same board reports.

The microcontroller is candid about this. Its internal temperature sensor is described as designed primarily to sense temperature changes inside the chip, and the datasheet states plainly that the chip's internal temperature is generally higher than ambient. The sensor is not lying; it is measuring what it was built to measure.

Passives have the same issue in a quieter form. A 0402 thick-film resistor is rated 100 mW at 70 °C and derates linearly to zero at 155 °C, which leaves 35 mW at 125 °C. A part running near its rating in a warm enclosure is a part whose own temperature rise is a further error source, and this one has a time constant of minutes — exactly the timescale of the drift that started the whole question.

A procedure that fits in an afternoon

  1. Log raw counts rather than engineering units for thirty minutes at constant ambient with the load on. A curve that rises and flattens with a time constant of minutes is self-heating; a flat line is not.
  2. Soak the board at two ambients twenty minutes apart and take one reading in each. The slope between them is the coefficient of the whole chain rather than of one part, which is the number that matters.
  3. Repeat at one ambient with three units. The spread is the tolerance term, and it is the only one that can be trimmed per unit.
  4. Trim the offset per unit in firmware against a reference. Do not trim the slope per unit; it is set by parts and is more stable than the reference you would trim it against.
  5. Replace interpolated formulas with tables, and test the middle of the range as carefully as the ends.
  6. Write the result down as a specification, with a range, a temperature span and a number. High accuracy is not a specification.

What the ranking is for

Ranked as shares of the same reading, the terms come out in an order that contradicts the intuition most people bring to the problem. The resistor whose tolerance was selected with care contributes 1.75 percent, and it is removable. The regulator nobody examined contributes 4.00 percent, and it is not. The conversion table copied from an example contributes 15 K. The thermistor's self-heating, the effect most often written about, contributes 0.04 K.

That is the real answer to the original observation. The numbers do drift, and temperature is why, but not in the way the phrase suggests. It is not one effect acting on a circuit; it is five effects acting on different parts, with different time constants, and only some of them respond to a calibration. Separating them is not extra work on top of chasing the drift. It is the work.

← All news