Robot Pi Shop

HC-SR04 Ultrasonic Distance Sensor Module

$1.50

Shipping calculated at checkout.

Quantity

HC-SR04 Ultrasonic Distance Sensor Module – 2cm to 400cm

The HC-SR04 Ultrasonic Distance Sensor Module is a compact, non-contact distance measurement sensor designed for robotics, obstacle detection, automation, and electronics projects.

Using ultrasonic sound waves at 40kHz, the HC-SR04 measures the distance between the sensor and an object by calculating the time required for the transmitted sound wave to return after reflection.

With a measuring range of approximately 2cm to 400cm, the module provides reliable distance measurements and can be easily integrated with Arduino, ESP32, Raspberry Pi, and other microcontroller platforms.

Key Features

  • Non-Contact Distance Measurement: Measures distance using ultrasonic sound waves.
  • Wide Detection Range: Approximately 2cm to 400cm.
  • 40kHz Ultrasonic Frequency: Uses ultrasonic pulses for object detection.
  • High Measurement Accuracy: Typical resolution of 3mm under suitable conditions.
  • 4-Pin Interface: Simple VCC, Trig, Echo, and GND connections.
  • Digital Pulse Output: Distance is calculated using the duration of the Echo signal.
  • Low Power Consumption: Suitable for embedded electronics and robotics.
  • Microcontroller Compatible: Works with Arduino, ESP32, Raspberry Pi, and other development boards with appropriate voltage interfacing.

Technical Specifications

Parameter Specification
Model HC-SR04
Sensor Type Ultrasonic Distance Sensor
Operating Voltage 5V DC
Typical Operating Current 15mA
Measuring Range 2cm–400cm
Ultrasonic Frequency 40kHz
Measurement Resolution Approximately 3mm
Measuring Angle Approximately 15°
Trigger Signal 10µs TTL Pulse
Echo Output 5V TTL Pulse
Interface Digital Trigger and Echo
Number of Pins 4
Board Dimensions Approximately 45 × 20 × 15mm

Pin Configuration

Pin Function Description
VCC Power Supply Connect to 5V DC
Trig Trigger Input Receives a 10µs pulse to start measurement
Echo Echo Output Outputs a pulse proportional to measured distance
GND Ground Connect to system ground

Connection Example – Arduino UNO

HC-SR04 Arduino UNO
VCC 5V
Trig D9
Echo D10
GND GND

The Arduino sends a short trigger pulse to the sensor. The HC-SR04 transmits an ultrasonic burst and measures the returning echo.

The distance is calculated using:

Distance (cm) = Echo Duration (µs) × 0.0343 / 2

ESP32 and Raspberry Pi Compatibility

The HC-SR04 can also be used with ESP32 and Raspberry Pi boards.

Important: The Echo pin typically outputs a 5V signal, while ESP32 and Raspberry Pi GPIO pins operate at 3.3V.

Use a suitable voltage divider or logic level converter between the Echo output and the 3.3V GPIO input.

Applications

  • Obstacle Avoidance Robots
  • Distance Measurement Projects
  • Arduino and ESP32 Robotics
  • Raspberry Pi Projects
  • Automatic Parking Assistance Prototypes
  • Object Detection Systems
  • Smart Automation Projects
  • Educational Electronics
  • DIY Distance Monitoring Systems

Important Notes

  • The HC-SR04 requires a regulated 5V DC power supply.
  • The Echo output is typically 5V and must not be connected directly to 3.3V-only GPIO pins.
  • Measurement accuracy depends on object size, surface material, angle, and environmental conditions.
  • Soft or sound-absorbing materials may reduce detection performance.
  • The sensor is not waterproof and is intended primarily for indoor applications.
  • The maximum measuring range of 400cm depends on suitable target and environmental conditions.

Package Includes

  • 1 × HC-SR04 Ultrasonic Distance Sensor Module