HC-SR04
Overview
The HC-SR04 is a low-cost ultrasonic distance sensor module that uses a transmit and receive transducer to detect objects by echo time-of-flight. It provides a simple digital trigger/echo interface so a microcontroller can measure the round-trip time of an ultrasonic pulse and infer distance. The module is common in hobbyist and embedded projects for short-to-medium range proximity and distance sensing.
Why Choose This Part
The HC-SR04 is inexpensive, widely available, and has a straightforward trigger/echo digital interface that integrates easily with microcontrollers. There is extensive community support and example code for platforms like Arduino and Raspberry Pi, which reduces development time. The module is a practical choice when a low-cost contactless distance sensor is needed and environmental conditions are not extreme.
Applications
Getting Started
Connect Vcc and GND to a 5V supply and use a microcontroller GPIO to drive the trigger pin and measure the echo pulse width with an input capture or interrupt/timing routine. Be cautious when connecting to 3.3V microcontrollers: the echo output can be at 5V and may require a level shifter or a simple voltage divider. Libraries and examples are available for Arduino (many community libraries) and for Raspberry Pi (use gpio libraries with proper level shifting).



