The HC-SR04 ultrasonic distance sensor measures distance by emitting a 40 kHz sound pulse and timing the echo return. It outputs a digital pulse whose duration is proportional to the distance of the reflecting object.
| Supply voltage | 5 V |
| Measuring range | 2 – 400 cm |
| Accuracy | ± 3 mm |
| Ultrasonic frequency | 40 kHz |
| Trigger pulse | 10 µs TTL |
| Echo pulse | 150 µs – 25 ms |
| Beam angle | 15° |
| Package | 4-pin through-hole |
Send a 10 µs HIGH pulse on the TRIG pin. The sensor emits 8 bursts of 40 kHz ultrasound and raises the ECHO pin HIGH. Measure the HIGH duration: distance (cm) = pulse_µs / 58. Minimum cycle time is 60 ms to avoid false echoes.
Minimum range 2 cm creates a blind spot. Soft/angled surfaces absorb or deflect sound. Unreliable in noisy ultrasonic environments or with very thin objects. Temperature affects speed of sound (343 m/s at 20 °C).