Time-of-Flight and Temperature Drift
Time-of-Flight and Temperature Drift
Ada re-derives this chapter’s own numbers step by step, at full precision
ADA · CALCULATION AUDIT
Time-of-Flight and Temperature Drift
The HC-SR04 ranging widget assumes a fixed 343 m/s speed of sound at 20°C, while the chapter’s own note says sound speed adds about 0.606 m/s for every degree above a 331.3 m/s baseline, adding up to roughly a 1 cm error for every 30 cm of range if temperature is ignored. This audit asks the question that claim invites: for a worked ultrasonic pulse, does the arithmetic really produce about 1 cm of drift per 30 cm once the 0°C and 20°C speeds are compared directly?
Companion to the chapter Lab: Light and Proximity Sensors — every number here comes from that chapter.
See the relationship before changing it
The figure reads from left to right. The blue card is air temperature. The middle card applies this page's rule. The green card is distance for 1,750 us echo. Walk the arrows once: set the input, apply the rule, then read the result with its unit.
The retained audit below checks several chapter fixtures. This model keeps those stated values fixed and changes only air temperature, so the numeric fixture does not switch without explanation.
Derive the baseline in four named moves
- 1
Name the input. The chapter baseline is 20 deg C.
- 2
Name the relationship. distance = 1,750 us x (331.3 + 0.606 T) m/s / 2
- 3
Substitute with units. 1,750 x 0.034342 / 2 = 30.05 cm
- 4
Read the result. Keep the unit beside the value. Use it only inside the technical boundary on this page.
Predict, then change air temperature
Try Predict the direction of distance = 1,750 us x (331.3 + 0.606 T) m/s / 2. Test another air temperature, then compare distance for 1,750 us echo.
Observe Temperature changes sound speed and scales every distance inferred from the same echo time. Reset air temperature to 20 and compare distance for 1,750 us echo.
Explain Temperature changes sound speed and scales every distance inferred from the same echo time.
Check yourself
What should you do before trusting a moved-control result?
What does this small model leave out?
Apply pulse time 1750 us with sound speed 0.0343 cm/us, then compare 0 C and 20 C before Check audit.
Distance shows 30.01 cm at 20 C and 28.99 cm at 0 C, a temperature-induced shift of about 1.02 cm.
Round-trip geometry supplies the divide-by-two, while a 20 C temperature change alters propagation speed and systematically scales every inferred distance.
Ada: The ultrasonic distance in this chapter is a division by two and a speed-of-sound term, and the chapter claims a ~1 cm error per 30 cm if temperature is ignored. Let me work the round trip at full precision. The rule is d = t x v / 2, with v = 343 m/s = 0.0343 cm/us at 20 C.
The worked pulse of t = 1750 us:
d = 1750 x 0.0343 / 2 = 60.025 / 2 = 30.01 cm.
Now let temperature move the speed, v = 331.3 + 0.606 x T:
- At 35 C:
v = 331.3 + 0.606 x 35 = 331.3 + 21.21 = 352.51 m/s, i.e.(352.51 - 331.3) / 331.3 = 6.4%faster than the 0 C baseline. - At 0 C the speed is
331.3 m/s = 0.03313 cm/us, so the same 1750 us pulse reads1750 x 0.03313 / 2 = 28.99 cm. - Error against the 20 C value:
30.01 - 28.99 = 1.02 cmon a ~30 cm target – the chapter’s “1 cm per 30 cm.”
The audit makes the sensitivity concrete: the divide-by-two is exact geometry, but the v term carries every degree of air temperature straight into the distance, so an outdoor ranger without a thermometer bakes in a systematic 3-4% error that no averaging can remove.
Every number above is taken from the chapter’s own material and re-derived step by step.
Technical boundaries: The uniform-air time-of-flight model excludes humidity, wind, temperature gradients, transducer ring-down, target angle and reflectivity, multipath, timer resolution, and pulse-detection threshold.