Shop by category
Shop all componentsSensors & MCUs
c = 331.3 + 0.606 × T (m/s, T in °C)distance = c × echo time ÷ 2An echo of 1166 µs at 20 °C: c = 343.4 m/s, so distance = 343.4 × 0.001166 ÷ 2 = 0.200 m = 20.0 cm. Round trip time for 4 m is 23.3 ms.
An ultrasonic sensor sends a burst of 40 kHz sound and times the echo. The sound travels to the object and back, so the distance is half the speed of sound multiplied by the time.
Sound is faster in warm air, about 0.6 m/s per °C, which adds around 0.2% error for every 1 °C if you ignore temperature. Soft or angled surfaces reflect poorly, and the HC-SR04 echo pin outputs 5 V, so use a divider or level shifter with a 3.3 V board.
Distance = speed of sound × echo time ÷ 2. At 20 °C, 1000 µs is about 17.2 cm.
The sound travels to the object and back, so the echo time covers twice the distance.
Yes. Sound travels about 0.6 m/s faster per °C, so a hot day changes long readings by a few centimetres.
c = 331.3 + 0.606 × T (m/s, T in °C); distance = c × echo time ÷ 2.
An echo of 1166 µs at 20 °C: c = 343.4 m/s, so distance = 343.4 × 0.001166 ÷ 2 = 0.200 m = 20.0 cm. Round trip time for 4 m is 23.3 ms.
Geekobot builds that use it include Wi-Fi dustbin level, Wi-Fi desert cooler water level, Wi-Fi library drop box monitor and Wi-Fi sanitizer and handwash bottle monitor. Each has the full parts list, wiring and code.
Results are estimates for design and learning. Check critical designs against the component datasheet. Made by the Geekobot Learning Team. How we write our calculators