- Home
- 2 x HC-SR04 Ultrasonic range finder module for Arduino
Product Categories
- Cricket Scoreboards (9)
- RGB Scoreboards- Wi-Fi/RF (8)
- Digital Scoreboards (24)
- Enclosures ()
- FREE SHIPPING Items (3)
- Bluetooth Audio Amplifier (27)
- Bluetooth Audio Amplifier (Apt-X) (29)
- Bluetooth Audio Receiver/Transmitter modules (26)
- Bluetooth Audio volume controller (3)
- Bluetooth Relays (16)
- Digital Menu and Calenders (3)
- Scoreduino (10)
- Scoreduino DMD- Bluetooth (8)
- Dot Matrix Displays (6)
- Arduino Modules (18)
- Arduino Shields (6)
- Counters (10)
- DIY Kits (16)
- Lazybones (2)
- Bluetooth Relays (16)
- RF Relays (7)
- Timer Relays (9)
- USB Relays (19)
- FM transmitters (3)
- Buck and Boost Modules (1)
- Power supplies (9)
Featured product
US $49.95 – US $50.95
US $24.95 – US $25.95
Description
HC-SR04 Ultrasonic Distance Measuring Sensor Module – 2cm to 400cm Range for Arduino, ESP32, Raspberry Pi and Robotics (Pack of 2)
Product Overview
The HC-SR04 Ultrasonic Distance Sensor Module is a popular, affordable, and reliable electronic sensor designed for non-contact distance measurement. It uses ultrasonic sound waves to detect objects and calculate their distance without requiring physical contact.
The module offers a typical measuring range of 2cm to 400cm (4 metres) with a resolution of approximately 3mm, making it suitable for Arduino projects, robotics, obstacle detection, distance monitoring, and DIY automation systems.
The HC-SR04 consists of an ultrasonic transmitter, an ultrasonic receiver, and an onboard control circuit. It operates at 40kHz and measures distance by calculating the time taken for ultrasonic sound waves to travel to an object and return to the sensor.
With its simple four-pin interface, the HC-SR04 can be easily connected to Arduino, ESP32, Raspberry Pi, STM32, and other microcontroller development boards.
Key Features
-
Non-Contact Distance Measurement: Detects objects and measures distance without physical contact.
-
2cm to 400cm Measuring Range: Suitable for short- and medium-distance sensing applications.
-
High Measurement Resolution: Approximately 3mm resolution under suitable conditions.
-
40kHz Ultrasonic Frequency: Uses ultrasonic sound waves beyond the normal human hearing range.
-
Simple Four-Pin Interface: Easy connection using VCC, TRIG, ECHO, and GND.
-
5V DC Operation: Compatible with standard 5V microcontroller power supplies.
-
Fast Response: Suitable for obstacle detection, robotics, and real-time distance monitoring.
-
Compact and Lightweight: Easy to install in small electronic enclosures and robotic projects.
-
Wide Microcontroller Compatibility: Works with Arduino, ESP32, Raspberry Pi, STM32, and other compatible controllers.
Technical Specifications
| Parameter | Specification |
|---|---|
| Model | HC-SR04 |
| Sensor Type | Ultrasonic Distance Sensor |
| Operating Voltage | 5V DC |
| Operating Current | Approximately 15mA (active) |
| Quiescent Current | Typically below 2mA |
| Ultrasonic Frequency | 40kHz |
| Measuring Range | 2cm to 400cm |
| Measurement Resolution | Approximately 3mm |
| Measuring Angle | Approximately 15° |
| Trigger Pulse | Minimum 10µs HIGH |
| Interface | Digital Trigger and Echo |
| Dimensions | Approximately 45 × 20 × 15mm |
| Quantity | 2 Modules |
How Does the HC-SR04 Work?
The HC-SR04 measures distance using the ultrasonic time-of-flight principle.
-
The microcontroller sends a HIGH signal of at least 10 microseconds to the TRIG pin.
-
The module automatically transmits eight ultrasonic pulses at 40kHz.
-
These sound waves travel through the air and reflect from nearby objects.
-
The ultrasonic receiver detects the reflected signal.
-
The module produces an output pulse on the ECHO pin. The duration of this pulse represents the ultrasonic travel time.
-
The microcontroller calculates the distance using the measured pulse duration and the speed of sound.
Distance Calculation
Distance = (Time × Speed of Sound) ÷ 2
The speed of sound in air is approximately 340m/s, depending on temperature and environmental conditions.
For example, if the ECHO pulse duration is 1000 microseconds:
Distance = (1000 × 0.034) ÷ 2 = 17cm
The distance is divided by two because the ultrasonic pulse travels from the sensor to the object and then returns to the sensor.
HC-SR04 Pin Configuration
| Pin | Description |
|---|---|
| VCC | 5V DC Power Supply |
| TRIG | Trigger Pulse Input |
| ECHO | Echo Pulse Output |
| GND | Ground / 0V |
Important: The ECHO output is typically a 5V logic signal. When connecting the HC-SR04 to 3.3V microcontrollers such as ESP32 or Raspberry Pi, use a suitable voltage divider or logic level shifter to protect the GPIO input.
Applications
The HC-SR04 ultrasonic sensor can be used in a wide range of electronics and automation projects.
-
Obstacle Avoidance Robots: Detect objects in front of robotic vehicles and help prevent collisions.
-
Arduino Distance Measuring Projects: Build digital distance meters using LCD, OLED, or LED displays.
-
Water Level Monitoring: Measure the distance between a sensor and the surface of water in a tank, subject to suitable installation conditions.
-
Smart Parking Systems: Detect the distance between vehicles and nearby obstacles.
-
Automatic Doors and Detection Systems: Detect the presence of objects within a specified distance.
-
DIY Automation Projects: Trigger alarms, relays, LEDs, or other electronic devices based on measured distance.
-
Educational Electronics: Learn about ultrasonic sensors, pulse timing, and microcontroller programming.
Arduino Example Code
The following example measures distance using the HC-SR04 sensor and displays the result in the Arduino Serial Monitor.
const int trigPin = 9;
const int echoPin = 10;
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
long duration = pulseIn(echoPin, HIGH, 30000);
if (duration > 0) {
float distance = duration * 0.034 / 2;
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
} else {
Serial.println("No echo detected");
}
delay(100);
}
Arduino Connections
| HC-SR04 | Arduino Uno |
|---|---|
| VCC | 5V |
| GND | GND |
| TRIG | Digital Pin 9 |
| ECHO | Digital Pin 10 |
After uploading the code, open the Arduino Serial Monitor at 9600 baud to view the measured distance in centimetres.
HC-SR04 vs Infrared Distance Sensors
Compared with many infrared distance sensors, such as the Sharp IR sensor family, the HC-SR04 is generally a more affordable option for basic distance measurement applications.
Unlike infrared sensors, which use reflected infrared light, the HC-SR04 uses ultrasonic sound waves. This means its measurements are generally less affected by ambient lighting conditions.
However, ultrasonic measurement performance depends on the object's surface, angle, size, and ability to reflect sound waves. Soft materials, irregular surfaces, and angled objects may reduce measurement reliability.
The HC-SR04 is especially useful for educational robotics, obstacle detection, and general-purpose distance sensing where very high precision is not required.
Important Notes
-
The sensor performs best when the target object has a reasonably flat surface facing the sensor.
-
Soft, angled, or sound-absorbing materials may produce weak or unreliable echoes.
-
The advertised 2–400cm range represents typical module capability; actual performance depends on the target and environment.
-
The sensor is not waterproof and should be protected from moisture.
-
For ESP32 and Raspberry Pi applications, protect the 3.3V GPIO inputs from the sensor's 5V ECHO output.
-
The approximately 3mm figure refers to nominal measurement resolution and should not be interpreted as guaranteed accuracy under all conditions.
Package Includes
2 × HC-SR04 Ultrasonic Distance Measuring Sensor Modules
Microcontroller, jumper wires, breadboard, and other accessories are not included unless otherwise specified.
Documentation and Tutorial
For additional information, circuit diagrams, and practical Arduino examples, visit:
BuildCircuit.com – Ultrasonic Range Finder Tutorial
Why Choose the HC-SR04?
The HC-SR04 Ultrasonic Distance Sensor is an excellent choice for students, electronics enthusiasts, engineers, and hobbyists looking for an affordable and easy-to-use distance measurement solution.
Its simple interface, widely available Arduino libraries, reliable operation under suitable conditions, and compatibility with popular development boards make it one of the most commonly used sensors for robotics and embedded electronics projects.
This pack of two HC-SR04 modules is ideal for experimenting with multiple sensors, building robotic systems, or developing custom distance-measuring applications.
Shipping & Return
SHIPPING
Our default shipping method is Registered International Post with a tracking code. Alternatively, you may opt for express shipping via DHL or FedEx.
Please note that we endeavor to ship all orders within 24 to 48 hours. The typical delivery time frame ranges between 2 to 4 weeks.
Kindly be aware that unforeseen circumstances, including customs or postal delays, may occasionally affect delivery times beyond our control.
Customers are responsible for any customs charges and should verify their country's customs policy.
RETURNS
If you are dissatisfied with the product, you may initiate a return within one month from the date of delivery. Please ensure that the product is sent back to our address in Sydney, Australia. Kindly note that all shipping charges associated with the return are the responsibility of the customer.
Reviews
Related Products
Recently viewed products
Copyright © BUILDCIRCUIT.COM and SCOREDUINO.COM. All Rights Reserved.
Shopping cart
close
-
WHAT ARE YOU LOOKING FOR?Search
- Login / Register
- Home
-
Shop
All categories
- Cricket Scoreboards
- RGB Scoreboards- Wi-Fi/RF
- Digital Scoreboards
- Enclosures
- FREE SHIPPING Items
- Bluetooth Audio Amplifier
- Bluetooth Audio Amplifier (Apt-X)
- Bluetooth Audio Receiver/Transmitter modules
- Bluetooth Audio volume controller
- Bluetooth Relays
- Digital Menu and Calenders
- Scoreduino
- Scoreduino DMD- Bluetooth
- Dot Matrix Displays
- Arduino Modules
- Arduino Shields
- Counters
- DIY Kits
- Lazybones
- Bluetooth Relays
- RF Relays
- Timer Relays
- USB Relays
- FM transmitters
- Buck and Boost Modules
- Power supplies
- page
- Blog Tutorials and Documents
- Wishlist (0)
- Compare (0)
- Contact Us





