Work out ultrasonic distance instantly with clear inputs, formula shown and shareable results.
Distance is half the echo time times the speed of sound, since the pulse travels out and back. Speed of sound varies as the square root of absolute temperature, roughly 0.6 m/s per degree, so ignoring temperature causes about 0.17% of error per degree — 17 mm at 10 m over 10 degrees.
Ultrasonic ranging
d = c x t / 2; c = 331.3 x sqrt(1 + T/273.15) m/s
Because the error is proportional to distance. At short range it is negligible, but at several metres a 20 degree swing moves the reading by centimetres.
The previous echo must decay before the next burst, otherwise reverberation is mistaken for a target. Rate is roughly the inverse of the maximum round-trip time.