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.

2Use it

The back of the two boards side by side. HC-SR04 (5 V): three chips, a 16-pin MAX232 (or no name), a 14-pin LM324 and a small 8-pin microcontroller. HC-SR04P (3.3 V and 5 V): one or two RCWL chips (or a CS100A) and the small M1 and M2 pads. Both have the pins VCC, Trig, Echo and Gnd.
Our drawing
Pin or legWhat it is for
VCC+ 5 V
Trigfrom a pin: starts a measurement
Echoto a pin: the answer, at 5 V (into a Micro:bit through the divider)
GNDGND

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

Used in

3Facts

Power5 V only, about 15 mA
Rangeabout 2-400 cm
PinsVCC, Trig, Echo, GND
On the backthree chips: a 16-pin MAX232 (or no name), a 14-pin LM324 and a small 8-pin microcontroller
On the frontalmost always a small silver crystal (an oval can marked 4.000) between the two eyes

Kinds you may find

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-1601works on 3.3 V too
US-016gives the distance as a voltage on one pin

More to read

Where to buy