HC-SR04 — how an echo becomes a distance

Drag the wall or press Ping. Watch the 40 kHz burst fly out, bounce, and return — the round-trip time turns into centimeters.

Ready. Press Ping to send a burst.
DISTANCE
20.0 cm
ECHO TIME
1160 µs
SOUND TRAVEL
39.8 cm
distance = ( echo_time × 0.0343 ) / 2
= ( 1160 µs × 0.0343 ) / 2 = 20.0 cm