Sensors

HC-SR04

Classic ultrasonic distance sensor module used in robotics obstacle detection and beginner projects.

China-madeGenericActiveEasy

Best For

Projects needing Distance and Ultrasonic with a commonly available sensors part.

Avoid If

You need production-grade certainty without checking the exact module vendor, pinout, and library maintenance status.

Quick Decision Notes

HC-SR04 is indexed as a sensors part from Generic. ChipScout tracks it by practical maker-facing dimensions: interfaces, library readiness, estimated price, field-level sources, and whether the page is strong enough for selection rather than only lookup.

Technical Specifications

MeasurementUltrasonic distanceSource: Generic
InterfaceTrigger + Echo GPIOSource: Generic
Range2cm - 400cmSource: Generic
Working Voltage5VSource: Generic

Common Use Cases

  • Maker prototypes
  • Low-cost modules
  • Educational hardware

Known Issues

  • Breakout boards may use different pin labels or regulator choices
  • Clone modules can differ from the original datasheet part

Interfaces and Library Support

Interfaces
GPIO
Wireless
None
Voltage
3.3V
Libraries
Arduino verifiedMicroPython verified
Data Integrity78% confidence
Sourcehttps://cdn.sparkfun.com/datasheets/Sensors/Proximity/HCSR04.pdf
Last verified2026-05-20
Core specsVerified
PinoutAvailable
Library supportChecked
Price rangePresent
Found a wrong spec?

Every field is meant to be source-backed. Corrections should include a datasheet URL, vendor page, module photo, or reproducible library test.

Submit correction

Source Resources

Pinout Table

VCC3.3VPower the module from a rail that matches the breakout board, not just the bare IC.
GNDCommon groundConnect ground between the controller, sensor/module, and external power supply.
SignalMCU GPIO / ADCUse a digital input, output, PWM, or ADC pin based on the module output type.

Pinout is not yet source-verified. Use the table as an integration checklist, then confirm exact pins against the module vendor page before wiring hardware.

Common Wiring

VCC

Power the module from a rail that matches the breakout board, not just the bare IC.

GND

Connect ground between the controller, sensor/module, and external power supply.

Signal

Use a digital input, output, PWM, or ADC pin based on the module output type.

Arduino Example

void setup() {
  Serial.begin(115200);
  Serial.println("HC-SR04 GPIO wiring smoke test");
}

void loop() {
  // Replace with the maintained HC-SR04 library or module protocol.
  Serial.println("Read or toggle the connected signal pin.");
  delay(1000);
}

MicroPython Example

from machine import Pin
import time

signal = Pin(0, Pin.IN)

while True:
    # Replace with the maintained HC-SR04 driver or module protocol.
    print("HC-SR04 signal:", signal.value())
    time.sleep(1)

Recommended Development Boards

ESP32-C3 development board

Low-cost Wi-Fi/BLE board with enough interfaces for most sensors and modules.

Arduino Uno R4 / compatible

Good baseline for beginner wiring and library validation.

Raspberry Pi Pico W

Practical MicroPython target for I2C, SPI, UART, PWM, and ADC experiments.

Alternative Model Reasons

ACS712SensorsCompare this option when price or module availability is the deciding constraint.
ADXL345SensorsThis alternative currently has stronger source coverage and confidence in ChipScout.
AHT10SensorsCompare this option when price or module availability is the deciding constraint.
AHT20SensorsThis alternative currently has stronger source coverage and confidence in ChipScout.

Common Questions

What is HC-SR04 best used for?

Projects needing Distance and Ultrasonic with a commonly available sensors part.

Does HC-SR04 support Arduino or MicroPython?

HC-SR04 has verified Arduino support and verified MicroPython support.

What interfaces does HC-SR04 use?

HC-SR04 lists GPIO; wireless support is no wireless protocol.

Compare HC-SR04 vs ACS712

Alternatives and Related Parts