HC-SR04 Application Guide
Research sources and write the HC-SR04 application guide.
Check the guide’s completeness, citations, and integration guidance.
Table
| Parameter | Absolute maximum rating | Recommended / nominal operation | Evidence and engineering note |
|---|---|---|---|
| Supply voltage | Not specified in the reference document | 5 V DC | Do not treat 5 V nominal as an absolute maximum. Some later vendor variants claim 3.3–5 V operation, but that is variant-specific and must not be generalized. |
| Supply current | Not specified | 15 mA working current | Budget additional rail margin for startup/transmit transients because the document gives no peak-current limit. |
| Operating/storage temperature | Not specified | Not specified | Qualify the exact purchased module over the intended environment; do not copy temperature limits from a different HC-SR04 clone. |
| Ranging performance | Not an absolute rating | 2 cm to 4 m; stated measuring angle 15° | Range depends strongly on target size, angle, material, air conditions, and acoustic surroundings. |
| Ultrasonic burst | Not applicable | Eight cycles at 40 kHz after a valid trigger | The table’s “40 Hz working frequency” is ambiguous; the operating description clearly identifies the acoustic burst as 40 kHz. |
| Module dimensions | Not specified as toleranced limits | 45 × 20 × 15 mm nominal | Verify board outline, transducer height, mounting holes, and connector position on the physical lot before enclosure or carrier-PCB release. |
| Package / header pitch | Not applicable | Off-board PCB module; commonly a 1×4, 2.54 mm header, but pitch is variant-dependent and not specified by the ELECFREAKS reference | Measure the received module or obtain a mechanical drawing. The Flux library contains a separate 2.54 mm HC-SR04 header model, which is useful reference geometry but not proof for every clone. |
Table
| Pin Number | Pin Name | Description | Best Practice |
|---|---|---|---|
| 1 | VCC | 5 V supply input for the documented variant. | Use a regulated 5 V rail and confirm the actual module variant before attempting 3.3 V supply operation. |
| 2 | Trig | Digital trigger input; drive HIGH for at least 10 µs. | Hold LOW when idle; a 3.3 V MCU output commonly works, but the generic document gives no VIH/VIL limits, so validate logic margin on the purchased lot. |
| 3 | Echo | Digital pulse output whose HIGH duration represents acoustic round-trip time. | Treat as 5 V logic unless the exact vendor explicitly states otherwise; translate before connection to a non-5-V-tolerant MCU. |
| 4 | GND | 0 V supply return. | Connect directly to MCU/system ground with a short return path; verify ground first during bench wiring. |
VMCU = VECHO × 15 kΩ / (10 kΩ + 15 kΩ) = 0.60 × VECHO, so a 5.00 V Echo becomes 3.00 V. With independent ±1% resistors, the maximum ratio is 15.15 / (9.90 + 15.15) = 0.6048, or 3.024 V at 5.00 V input; still verify the MCU’s VIH requirement, input leakage, rail tolerance, and absolute maximum voltage. This divider is an engineering recommendation, not an HC-SR04 datasheet requirement.distance_cm = echo_high_time_µs / 58, distance_in = echo_high_time_µs / 148, or the underlying round-trip equation distance = time × speed_of_sound / 2.2 × 4 / 340 = 23.5 ms; an engineering timeout around 30 ms accommodates the documented maximum range while preventing a missing Echo edge from blocking the program. A longer timeout may be required for clone behavior or unusually slow local sound velocity./58 shortcut assumes approximately 340 m/s and is not a precision environmental model.Table
| Alternative | Verified characteristics | Compatibility |
|---|---|---|
| MaxBotix MB1010-000 LV-MaxSonar-EZ1 | Branded ultrasonic module; manufacturer lists 2.5–5.5 V operation, 6–254 in range, 1 in resolution, and analog, pulse-width, and asynchronous serial outputs on the official LV-MaxSonar-EZ product family page. | Functionally similar ultrasonic rangefinder, but not pin-, protocol-, or footprint-compatible with HC-SR04. |
| STMicroelectronics VL53L1CXV0FY/1 | Branded optical time-of-flight IC; 2.6–3.5 V supply, I²C up to 400 kHz, and up to 4 m ranging depending on conditions. ST datasheet DS12385 Rev 8 is dated August 2024. | Functionally similar distance sensing, but it is an optical reflowable IC requiring a host driver and optical/mechanical design; not pin-, protocol-, technology-, or footprint-compatible. |
Table
| Attribute | Details |
|---|---|
| Primary Distributors | The Flux library currently links an OSEPP-branded HC-SR04 listing at Mouser and a Universal-Solder Electronics HC-SR04 listing at DigiKey. These are seller/manufacturer-specific products, not proof that all generic modules are equivalent. |
| Packaging Options | OSEPP listings describe retail/blister packaging; generic marketplace modules are also sold individually or in multipacks. No universal tape-and-reel, tray, or factory-pack standard exists for HC-SR04 modules, and an ordering suffix should not be inferred without seller documentation. |
| Standard MOQ | No industry-standard MOQ exists. Distributor listings commonly permit single-unit purchases, but MOQ, pack quantity, and price breaks are seller- and date-dependent; confirm on the live listing at order time. |
| Sourcing Advice | For prototypes, buy enough units from one traceable lot to characterize 5 V current, 3.3 V Trig recognition, Echo amplitude, timeout behavior, minimum/maximum useful range, beam interactions, and mechanical dimensions. For production, prefer a branded module with a controlled revision and change notification, or select a manufacturer-controlled alternative such as MaxBotix; do not second-source generic HC-SR04 modules without incoming inspection and regression tests. |
1. Quick Specifications
2. Pinout & Connections
3. Standard Application Circuit
5 V MCU or 5 V-tolerant GPIO
3.3 V MCU
Trigger, measurement, conversion, and timeout
4. PCB Layout & Routing Guidelines
5. Common Pitfalls / Things to Watch Out For
6. Popular Alternatives & Equivalents
7. Sourcing & Purchasing Guide
Sources