How It Works: The Time-of-Flight Principle
The HC-SR04 consists of an ultrasonic transmitter, a receiver, and a control circuit. When triggered by a 10µs pulse, the transmitter sends out an 8-cycle burst of ultrasound at 40kHz. These waves travel through the air, bounce off an object, and return to the receiver. The “Echo” pin then outputs a high-level pulse whose duration is proportional to the time taken for the round trip. At RoboShop BD, we recommend this sensor for its immunity to sunlight and black-material interference, which often plagues infrared-based distance sensors.
Reliable and Easy to Interface
This sensor is remarkably easy to use with any microcontroller, including Arduino, ESP32, and Raspberry Pi. Because it operates on a standard 5V supply and consumes less than 15mA, it can be powered directly from your development board. Its compact, “two-eyed” design has made it a favorite for the global maker community, ensuring a vast library of open-source code and tutorials are available for your next build.
Key Features
-
Non-Contact Measurement: Detects objects without physical touch, preventing damage to delicate surfaces.
-
High Precision: Offers a resolution of 0.3cm and a ranging accuracy of up to 3mm.
-
Wide Detection Range: Reliable sensing from as close as 2cm up to 4 meters away.
-
4-Pin Interface: Simple wiring with VCC, Trig, Echo, and GND pins.
-
Sunlight Independent: Unlike IR sensors, its performance is not affected by ambient light or dark-colored objects.
-
Fast Response: High-speed measurement cycles (suggested >60ms) for real-time robotics.
Technical Specifications
| Specification | Details |
| Operating Voltage | 5V DC |
| Operating Current | 15mA |
| Ultrasonic Frequency | 40 kHz |
| Detection Range | 2 cm – 400 cm |
| Measuring Angle | < 15° (Effectual) / 30° (Sensing) |
| Trigger Input Signal | 10µs TTL Pulse |
| Echo Output Signal | TTL Pulse (Proportional to Distance) |
| Dimensions | 45mm x 20mm x 15mm |
| Resolution | 3 mm |
Pinout Configuration
| Pin | Name | Function |
| 1 | VCC | +5V Power Supply |
| 2 | Trig | Trigger Input (10µs pulse starts measurement) |
| 3 | Echo | Echo Output (High pulse duration = time of flight) |
| 4 | GND | System Ground |






There are no reviews yet.