Product added to cart
HC-SR04 Ultrasonic Distance Sensor Module
SAVE
As low as $0.7500
In stock
Only %1 left
SKU
SEN-07-009
Product Variations:
Ships in 2-3 business days, then:
Free delivery in 12-15 days by Tracked Economic Shipping on orders over $100.
Free delivery in 7-10 days by Express Shipping on orders over $300.
More shipping info
Shop with confidence Learn More
US-100 Ultrasonic Distance Sensor Module Previous
HC-SR04 Ultrasonic Sensor Review
The HC-SR04 Ultrasonic Distance Sensor Module is a dedicated 5V, four-pin acoustic ranging board for indoor proximity sensing, obstacle detection, and microcontroller distance experiments. With paired 40KHz piezoelectric transducers, it sends an ultrasonic burst and outputs a timed digital pulse that corresponds to the sound wave's round-trip travel time. For developers using 5V development boards such as the Arduino Uno, it provides a straightforward hardware interface requiring only two digital pins and standard pulse-timing logic.
This module works reliably in controlled indoor environments when ranging against broad, flat, acoustically reflective surfaces such as walls, cardboard boxes, and smooth panels. Its 5V Echo output must not be wired directly to 3.3V-only microcontroller pins without voltage protection. The open circuit board also lacks environmental sealing, so it is unsuitable for wet, outdoor, or chemically aggressive locations, along with safety-critical collision detection or sub-millimeter metrology.
Ideal for:
- Indoor mobile robotics prototypes requiring basic obstacle detection against solid walls.
- Benchtop Arduino distance indicators, bench measurement jigs, and educational time-of-flight labs.
- Controlled indoor tank-level demonstrators with calm, reflective liquid surfaces and adequate overhead clearance.
Avoid if:
- Your system requires direct wiring to 3.3V GPIO pins without an intermediate level shifter or voltage divider.
- The operating environment involves rain, condensation, high humidity, outdoor exposure, or heavy dust. For sealed hardware, browse the wider Ultrasonic sensor category.
- The application demands sub-millimeter precision, safety-certified emergency braking, or reliable detection of soft fabric, foam, or angled surfaces.
- You need a direct fluid-flow measurement sensor inside a pipe or closed channel.
Specifications of HC-SR04 Ultrasonic Distance Sensor Module
- Input Voltage: 5V
- Working Current: 15mA
- Standby current: less than 2mA
- Working Frequency: 40KHz
- Induction Angle: <15°
- Distance Range: 2cm ~ 400cm
- Resolution: 1cm
- Trigger Input Pulse Width: 10uS
- Pin Number: 4 Pin
- Interface: TTL
- Compatibility: Compatible with Arduino
- Size: 45mm x 20mm x 15mm
HC-SR04 Arduino and 3.3V Compatibility
The module breaks out four standard header pins: VCC, Trig, Echo, and GND. VCC requires a regulated 5V power supply, drawing 15mA during active operation and under 2mA at standby. Trig accepts a 5V TTL control pulse, while Echo outputs a 5V high pulse whose duration is proportional to the round-trip distance between the module and the detected object.
Connection to a 5V microcontroller such as an Arduino Uno is direct. Trig connects to any digital output pin, Echo connects to any digital input pin, and the power lines tie directly to the 5V and GND rails. To start a distance reading, the controller drives Trig high for at least 10uS. The module then emits eight cycles of 40KHz ultrasound and holds Echo high until the reflected burst returns to the receiving transducer. Step-by-step wiring diagrams and software routines are detailed in the guide to Interfacing HC-SR04 Ultrasonic Distance Sensor with Arduino and the tutorial on Getting Started with Ultrasonic Module and Arduino. For clean circuit assembly, standard jumper leads such as the Breadboard Jumper Wire Kit - 140 Pieces provide reliable point-to-point connections.
Use caution when interfacing with 3.3V development platforms such as the ESP32, ESP8266, or Raspberry Pi. Although the module's Trig pin responds to 3.3V logic signals from these boards, Echo outputs a full 5V TTL pulse. Feeding this 5V signal directly into a 3.3V GPIO pin can degrade or permanently damage the microcontroller's internal input circuitry. Place a simple two-resistor voltage divider, such as 1kΩ and 2kΩ, or a dedicated bidirectional logic-level shifter between Echo and the 3.3V input pin to reduce the signal to safe levels. Certain low-voltage revisions in the wider market operate across 3.3V to 5V rails, but unless a board is positively identified as a low-voltage variant, treat all standard modules as 5V devices requiring Echo level shifting.
For native multi-voltage support or alternative communication protocols without external dividers, use the RCWL-1605 Multi-Interface Module, which operates from 2.8V to 5.5V and supports GPIO, UART, I2C, and 1-Wire interfaces.
| Parameter / Controller | Compatibility Status | Wiring & Integration Requirements |
|---|---|---|
| Supply Voltage | 5V Required | Requires a steady 5V DC supply rail; typical active current is 15mA. |
| 5V Arduino Uno & Mega | Direct Compatibility | Connect Trig to digital output, Echo to digital input; common ground required. |
| ESP32 & ESP8266 | Requires Level Shifting | Trig accepts 3.3V logic; 5V Echo output requires a voltage divider or level shifter. |
| Raspberry Pi & RP2040 | Requires Level Shifting | Echo pin must be stepped down to 3.3V before connecting to Pi GPIO pins. |
| Software Architecture | Microcontroller Timing | Firmware generates a 10uS trigger pulse, reads Echo duration, and applies a strict timeout. |
| Multiple Modules | Sequential Operation Only | Sensors must be fired one at a time to prevent acoustic pulse collisions and false echoes. |
HC-SR04 Accuracy, Range and Target Limits
The module is rated for a nominal detection range of 2cm to 400cm, with a specified measurement resolution of 1cm. A 1cm resolution means the output timing can resolve distance changes in 1cm increments under steady conditions. It does not guarantee absolute 1cm accuracy across all targets, angles, and temperatures. Ranging accuracy depends directly on speed-of-sound calculations, which shift roughly 0.6 m/s per degree Celsius. Uncompensated indoor firmware experiences minor drift as room temperatures fluctuate.
Objects closer than 2cm fall within the module's near-field blind zone. Inside this boundary, receiver ringing cannot settle quickly enough to distinguish outgoing bursts from returning reflections, leading to erratic readings or full timeouts. At the opposite extreme, reaching the full 400cm range requires a large, flat, hard surface oriented perpendicular to the transducers. As acoustic energy disperses across the module's <15° induction angle, angled surfaces reflect sound waves away from the receiver rather than back to it. Soft materials such as clothing, drapery, acoustic foam, and open fur absorb ultrasound, resulting in missing returns or drastically shortened detection ranges.
The open PCB and transducers lack water or particle protection. Moisture, condensation, and airborne dust alter transducer resonance and corrode component traces. For applications exposed to outdoor weather, road spray, or tank condensation, the JSN-SR04T Waterproof Module uses a sealed, weather-resistant cylindrical probe, though it gives up close-up sensing with a 20cm to 25cm blind distance. The SR04T Ultrasonic Ranging Module has a sealed probe on a 2.5-meter cable for remote chassis mounting and carries a 25cm blind zone.
For high measurement precision in clean indoor setups, the US-015 High Precision Module retains the same form factor while offering a precision rating of 0.3cm + 1% and a lower 2.2mA operating current. Where acoustic interference, multi-sensor crosstalk, or soft targets remain persistent problems, optical sensing is a dependable alternative approach. The VL53L1X Laser ToF Sensor uses infrared laser Time-of-Flight ranging over I2C up to 4 meters, eliminating ultrasonic beam spread. For tighter robotics obstacle detection, the Waveshare Laser Distance Sensor is a compact optical solution rated for distances up to 1.5 meters.
| Module | Sensing Technology | Stated Range | Blind Distance | Key Integration Distinction |
|---|---|---|---|---|
| HC-SR04 | Dual Ultrasonic (Open PCB) | 2cm ~ 400cm | 2cm | Standard 5V TTL pulse timing; 1cm resolution; unsealed board. |
| US-015 | Dual Ultrasonic (Open PCB) | 2cm ~ 400cm | 2cm | High-precision 0.3cm + 1% rating; low 2.2mA current; 5V operation. |
| JSN-SR04T | Sealed Single Ultrasonic Probe | 20cm ~ 600cm | 20cm ~ 25cm | Waterproof probe; wider 3V–5.5V supply; wider sensing cone. |
| SR04T Module | Sealed Single Probe w/ 2.5m Cable | 25cm ~ 450cm | 25cm | Weather-resistant probe with remote cable for chassis or tank mounting. |
| RCWL-1605 | Dual Ultrasonic Transceiver | 25cm ~ 450cm | 25cm | Multi-protocol output (GPIO, UART, I2C, 1-Wire); 2.8V–5.5V supply rail. |
HC-SR04 Projects and Alternatives
In educational and prototyping spaces, this sensor is a benchmark introduction to acoustic time-of-flight physics. Typical applications include small indoor wheeled robots that detect walls to trigger turns, desktop distance meters driving small character LCDs, and interactive museum exhibits that sound a buzzer when a visitor approaches. In laboratory experiments, students use the module to observe sound reflection, write non-blocking timing routines, and build median software filters to smooth erratic readings.
More specialized uses, such as servo-swept 2D mapping rigs or calm indoor liquid-level prototypes, are achievable but require close attention to physical limits. A sweeping acoustic sensor produces broad, fuzzy obstacle profiles rather than sharp edges because the <15° beam illuminates a wide arc at several meters. For non-contact tank monitoring, the sensor can track fluid levels in small indoor containers if the surface is calm, non-foaming, and safely beyond the 2cm blind distance. It cannot measure direct liquid flow through pipes, nor should it ever be integrated into human-safety systems, machinery guards, or motor vehicle road-warning assemblies.
Several related ultrasonic models in the catalog provide compatible footprints or expanded functionality:
- HY-SRF05 Ultrasonic Module: This compatible ultrasonic unit offers an alternative 5-pin interface supporting single-pin combined Trigger/Echo signaling alongside dual-pin modes.
- CJMCU-891 SRF04 Module: A compact ultrasonic board with integrated mounting holes suited for APM flight controllers and custom brackets.
- US-100 Ultrasonic Module: An ultrasonic alternative with built-in temperature compensation logic and selectable direct UART serial output.
- HC-SR04 Test Board: A dedicated visual diagnostic board that hosts an ultrasonic sensor and an onboard digital display for reading distances directly without a separate microcontroller.
HC-SR04 Setup, Mounting and Accessories
Initial testing requires a microcontroller, a clean 5V DC power source, jumper wires, and a stable mounting arrangement. The overall dimensions are 45mm x 20mm x 15mm. Because the two transducer barrels project forward by approximately 12mm, check your chassis opening or enclosure cutout depth before securing the board.
Rigid mounting helps prevent false readings caused by chassis vibration or accidental sensor tilting. The HC-SR04 Ultrasonic Sensor Module Bracket is cut to fit around the twin transducer cylinders and provides pre-drilled holes for fastening to servo horns or robot frames. For alternative bracket arrangements, the SRF05 Mounting Bracket provides an acrylic mounting flange that holds the module firmly in place.
Recommended Hardware Checklist
- Required Wiring: The Breadboard Jumper Wire Kit - 140 Pieces provides flexible female-to-male and female-to-female leads to connect the board header directly to your development platform.
- Required Voltage Protection (3.3V Controllers): Use a pair of standard through-hole resistors, such as 1kΩ and 2kΩ, or a digital level shifter module to safely drop the 5V Echo pulse to 3.3V logic levels.
- Required Controller & Power: An Arduino Uno or compatible microcontroller board, backed by a stable 5V regulated power rail capable of supplying at least 15mA of active current.
- Recommended Mounting: The HC-SR04 Ultrasonic Sensor Module Bracket keeps the transducers perpendicular to your target area.
- Recommended Programming Cable: A suitable USB cable matched to your development board's programming port.
- Optional Hardware: An acoustically verified indoor protective housing and a controlled power-switch transistor if automated power-cycling is needed for remote installations.
Quick Verification Procedure
- Connect VCC to your 5V power supply rail and GND to system ground.
- Wire Trig to your controller's digital output pin.
- Wire Echo to your controller's digital input pin, inserting a resistor divider if using a 3.3V microcontroller.
- Upload a basic sketch that drives Trig high for 10uS, pulls it low, and measures the high pulse duration on Echo using a microsecond timer.
- Calculate distance in centimeters using the standard round-trip formula:
Distance = (Duration_uS * 0.0343) / 2. - Place a flat, hard cardboard target 20cm away from the transducers. The measured value should track smoothly as the target moves between 5cm and 50cm.
A common first-time pitfall is omitting a timeout on the Echo pulse measurement. If an echo is deflected away and never returns, an unbounded pulse-in function stalls the microcontroller's execution loop. Set an input capture timeout of roughly 25ms to 30ms, corresponding to roughly 400cm to 500cm, and discard any readings that reach this upper boundary.
HC-SR04 Ultrasonic Sensor FAQ
Does this HC-SR04 work with an Arduino Uno?
Yes, the HC-SR04 interfaces directly with the Arduino Uno. The Uno provides the required 5V power rail, and its ATmega328P digital I/O pins handle 5V TTL levels on both Trig and Echo without external level shifting. Detailed code examples are available in the guide to Interfacing HC-SR04 Ultrasonic Distance Sensor with Arduino.
Can I connect this HC-SR04 directly to an ESP32, ESP8266, or Raspberry Pi?
No, do not connect Echo directly to a 3.3V microcontroller. Although the 3.3V Trig output from an ESP32 or Raspberry Pi can trigger the module, the 5V Echo pulse overvolts 3.3V-rated GPIO pins and risks permanent silicon damage. Use a two-resistor voltage divider or a logic-level converter to safely attenuate Echo to 3.3V.
What is the real HC-SR04 measuring range?
The module is rated for a nominal range of 2cm to 400cm, but practical usable range depends heavily on target composition and alignment. Large, rigid surfaces such as painted drywall or sheet plastic return strong echoes out to 300cm–400cm under quiet indoor conditions. Smaller objects, angled boundaries, and soft fabrics scatter sound energy, frequently reducing dependable detection distance to under 150cm.
Is the HC-SR04 accurate to 1cm?
The 1cm specification represents measurement resolution rather than absolute field accuracy. The module can register 1cm shifts under steady laboratory conditions, but overall accuracy varies with air temperature, humidity, target angle, and multipath acoustic reflections. For benchtop projects that demand tighter precision specifications, the US-015 High Precision Module carries a stated precision rating of 0.3cm + 1%.
Why does an HC-SR04 give random, zero, maximum, or ghost readings?
Erratic distance readings stem from targets within the 2cm blind zone, acoustic reflections bouncing off smooth surfaces at shallow angles, or soft materials absorbing the sound burst. In robotics setups, acoustic reflections from the floor or internal transducer cross-coupling can also trigger premature echo returns. Securing the sensor perpendicularly with the HC-SR04 Ultrasonic Sensor Module Bracket, incorporating software median filtering, and setting a 25ms Echo timeout resolve most intermittent reading issues.
Can several HC-SR04 ultrasonic sensors run together?
Yes, multiple sensors can operate on the same system, but they must be triggered sequentially rather than simultaneously. When two adjacent sensors transmit at the same time, one sensor's receiver can detect the other's acoustic burst, resulting in severe crosstalk and false low-distance readings. Allow at least 20ms to 30ms between pings to let residual echoes dissipate across the room.
Can this ultrasonic sensor detect black, transparent, soft, or fabric objects?
The module detects optical transparency and deep black surfaces effortlessly because acoustic waves reflect regardless of color or visual opacity, making it superior to optical sensors for clear acrylic or dark plastic. Soft fabrics, wool, foam packing, and downy surfaces, however, absorb 40KHz sound pulses, making soft targets difficult or impossible to detect reliably.
Is this HC-SR04 waterproof or suitable for outdoor use?
No, this open-frame module carries no IP rating and is not water-resistant. Outdoor humidity, direct rain, splashing, and dust rapidly corrode the exposed traces and degrade transducer operation. For outdoor robotics, exterior automotive warning, or weather-exposed monitoring, select the sealed JSN-SR04T Waterproof Module.
Can this module measure water level or liquid flow?
The module can monitor static water levels from above in a calm indoor tank, provided the water remains flat and stays at least 2cm away from the transducer face. It cannot measure internal liquid flow rates in pipes or channels, and heavy surface condensation or chemical vapors damage the unsealed metal mesh.
Purchase Decision Summary
Ideal for:
- Hobbyists and engineers developing indoor 5V microcontroller applications requiring non-contact distance estimation.
- Classroom educational setups exploring digital pulse timing, time-of-flight physics, and speed-of-sound calculations.
- Small indoor obstacle-avoidance robots navigating around hard, perpendicular walls.
Maybe for:
- ESP32, ESP8266, and Raspberry Pi builds where you are willing to add a resistor divider or level shifter on the Echo trace.
- Controlled indoor fluid-level monitoring where the surface is flat, non-foaming, and condensation is absent.
- Multi-sensor robotic chassis that incorporate software logic to trigger each sensor in sequential rotation.
Consider another option if:
- The installation site is exposed to weather, splashing water, condensation, or heavy industrial dust.
- Your circuit demands direct 3.3V signal lines without supplementary level-shifting hardware.
- You require guaranteed sub-millimeter metrology or are building human safety and emergency-stop systems.
- The target consists of clothing, plush materials, or sound-absorbing acoustic foam.
HC-SR04 Buying Checklist
- A regulated 5V DC power source providing at least 15mA is available in your design.
- Your microcontroller has one free digital output for Trig and one timing-capable digital input for Echo.
- You have provisioned a 5V-to-3.3V resistor divider or level shifter if connecting to an ESP32, ESP8266, or Raspberry Pi.
- The intended target object will remain outside the 2cm near-field blind zone at all times.
- The detected surface is rigid, non-porous, and oriented reasonably perpendicular to the sensor face.
- The project environment is dry, indoors, and sheltered from airborne particulate contamination.
- Your firmware architecture supports an Echo measurement timeout and rejects out-of-bounds readings.
- If using multiple modules, your control routine triggers them sequentially to avoid ultrasonic crosstalk.
- Your physical enclosure accommodates the 45mm x 20mm x 15mm board profile and allows unobstructed transducer clearance.
| Interface Type | Digital |
|---|---|
| Operating Voltage (V) | 5V |
| Operating Current (mA) | < 2mA |
| Operating Temp (°C) | 0 to 70 |
| Mounting Type | THT (Through Hole) |
| Output Type | Digital |
| Accuracy | 1 cm |
| Detection Distance | 2cm – 500 cm |
| Detection Angle (°) | <15° |
| Sensing Method | Ultrasonic |
| Chipset | SRF04 |
| Sensor Model | SRF04 |
Write Your Own Review




Please complete your information below to login.
Sign In
Create New Account