HC-SR04 ultrasonic distance sensor (5 V)
Measures distance by bouncing sound off things, like a bat.
Classic 40 kHz sonar ranger, 2-400 cm, 15° cone. Needs 5 V power; a 10 µs TRIG pulse starts a reading and ECHO returns a 5 V pulse whose width is the round-trip time. 15 mA while measuring.
Electrical
- Supply voltage
- 4.5 to 5.5 V
- Logic level
- 5 V
- Current
- 15 mA typical, 15 mA max
- Talks over
- digital
Needs alongside it
- ECHO is 5 V. On a 3.3 V board use a level shifter or a 1k/2k divider, or pick the 3.3 V version (ultrasonic-3v3).
Pins
| Pin | Can do | Max V | Max mA |
|---|---|---|---|
| VCC | 5 V | ||
| TRIG | digitalAccepts 3.3 V or 5 V. | ||
| ECHO | digitalOutputs 5 V. Shift it down for 3.3 V boards. | ||
| GND | ground |
Size and material
- Size
- 46 × 16 × 20 mm
- Weight
- 8.7 g
- Material
- pcb
- Sold by the
- piece
Works with
- Arduino Uno R3
- Arduino Nano
- Arduino Mega 2560 Rev3
- Arduino UNO R4 WiFi
- Arduino UNO R4 Minima
- Arduino Nano ESP32
- ESP32 DevKitC (ESP32-WROOM-32, 38-pin)
- ESP32-S3-DevKitC-1 (N8R8)
- Adafruit ESP32-S3 Feather (4 MB flash, 2 MB PSRAM)
- Seeed XIAO ESP32S3 Sense (camera + mic)
- Seeed XIAO ESP32C3
- Seeed XIAO ESP32C6
- Raspberry Pi Pico (RP2040)
- Raspberry Pi Pico W (RP2040, Wi-Fi)
- Raspberry Pi Pico 2 (RP2350)
- Raspberry Pi Pico 2 W (RP2350, Wi-Fi)
- Seeed XIAO RP2040
- Seeed XIAO nRF52840 (Bluetooth LE)
- Raspberry Pi 5 (4 GB)
- Raspberry Pi 4 Model B (4 GB)
- Raspberry Pi Zero 2 W

