Parts · Sensors
Ultrasonic sensor (HC-SR04)
HC-SR04, the classic one: 5 V only
Measures distance with a sound too high to hear: it times the echo.
Parts · Sensors
HC-SR04, the classic one: 5 V only
Measures distance with a sound too high to hear: it times the echo.

| Pin or leg | What it is for |
|---|---|
| VCC | + 5 V |
| Trig | from a pin: starts a measurement |
| Echo | to a pin: the answer, at 5 V (into a Micro:bit through the divider) |
| GND | GND |
Good to know: The 3.3 V kind (HC-SR04P) looks the same from the front, and sellers often print "HC-SR04" on it too. The back tells them apart: see the picture. On 3.3 V a classic one gives short, odd or no numbers.
The idea behind it, step by step: Ultrasonic distance sensor
| Power | 5 V only, about 15 mA |
|---|---|
| Range | about 2-400 cm |
| Pins | VCC, Trig, Echo, GND |
| On the back | three chips: a 16-pin MAX232 (or no name), a 14-pin LM324 and a small 8-pin microcontroller |
| On the front | almost always a small silver crystal (an oval can marked 4.000) between the two eyes |
| HC-SR04P (often printed "HC-SR04") | works on 3.3 V and 5 V: an RCWL or CS100A chip on the back, no MAX232. See "Ultrasonic sensor for 3.3 V" |
|---|---|
| RCWL-1601 | works on 3.3 V too |
| US-016 | gives the distance as a voltage on one pin |