Spark Logic

HC-SR04 ultrasonic ranging module pinout

The HC-SR04 sends a 40 kHz ultrasonic burst and reports the round-trip time as the width of a logic pulse.

Four-pin module header

4 contacts Current package

ELECFREAKS·

Four-pin module header pinout

Four-pin module header
Face the two transducers with the connector below them. VCC, Trig, Echo, and GND run left to right.
Selected pin details

1 · VCC

Supply input · Power

Connect to a regulated 5 V supply.

ELECFREAKS HC-SR04 User Guide, pp. 3–4, §§ 2.3–2.5 and 3.1.

Electrical limits · Link to this pin

Measure a distance with a 5 V host

  • +5 V
    • Regulated 5 V rail
  • Ground
    • Host ground
  • Trigger output
    • →
    • Host GPIO output
  • Echo capture
    • →
    • Host timer capture input

Connection guide

All 4 pins

PinSignalDirectionFunction
1VCC Supply inputSupply input Connect to a regulated 5 V supply.
2Trig InputInput A high pulse of at least 10 µs starts one measurement.
3Echo OutputOutput The high pulse width measures acoustic round-trip time.
4GND Supply returnSupply return Share ground with the host and the 5 V supply.

Signal assignments

Trigger and echo

Use one GPIO output to start the burst and a separate input timer to measure echo pulse width. For a 3.3 V input without 5 V tolerance, reduce the Echo level with a suitable divider or level shifter.

Electrical limits

ParameterLimitConditions and source
Supply5 V DC5 V DC The guide lists 15 mA operating current. ELECFREAKS HC-SR04 User Guide, pp. 3–4, §§ 2.3–2.5 and 3.1.
Trigger width10 µs minimum10 µs minimum The module emits eight 40 kHz cycles per trigger. The guide specifies a TTL pulse without a numeric VIH. ELECFREAKS HC-SR04 User Guide, pp. 3–4, §§ 2.3–2.5 and 3.1.
Echo outputTTL pulseTTL pulse The guide shows a 5 V host and gives no numeric VOH. For a 3.3 V input without 5 V tolerance, reduce the Echo level with a suitable divider or level shifter. ELECFREAKS HC-SR04 User Guide, pp. 3–4, §§ 2.3–2.5 and 3.1.
Ranging interval2 cm to 4 m2 cm to 4 m The documented range depends on target size, angle, and acoustic conditions. ELECFREAKS HC-SR04 User Guide, pp. 3–4, §§ 2.3–2.5 and 3.1.

Models and documents

This map follows the 5 V ELECFREAKS HC-SR04. Check the markings and voltage limits on lookalike modules.

HC-SR04
5 V version documented by ELECFREAKS.