HC-SR04 Ultrasonic Distance Sensor Module
📡 HC-SR04 Ultrasonic Distance Sensor Module
Accurate • Affordable • Widely Used in Robotics
The HC-SR04 Ultrasonic Distance Sensor Module is one of the most popular distance-measuring sensors used in electronics, robotics, and IoT projects. It measures the distance between the sensor and an object using ultrasonic sound waves, making it ideal for obstacle detection, automation, and smart systems.
📊 Infographic Overview
🔹 Basic Specifications
| Feature | Details |
|---|---|
| 📏 Measuring Range | 2 cm – 400 cm |
| 🎯 Accuracy | ±3 mm |
| ⚡ Operating Voltage | 5V DC |
| 🔌 Working Current | ~15 mA |
| 📡 Working Frequency | 40 kHz |
| ⏱ Measuring Angle | < 15° |
| 🧩 Interface | 4 Pins (VCC, Trig, Echo, GND) |
🧩 Pin Configuration
| Pin | Function |
|---|---|
| VCC | Power supply (5V) |
| Trig | Trigger input signal |
| Echo | Output signal (pulse width indicates distance) |
| GND | Ground |
⚙️ How It Works (Simple Explanation)
1️⃣ The microcontroller sends a 10 µs pulse to the Trig pin.
2️⃣ The sensor emits 8 ultrasonic sound waves at 40 kHz.
3️⃣ The waves travel through the air and reflect from an object.
4️⃣ The reflected wave returns to the sensor and is received by the Echo pin.
5️⃣ The sensor calculates distance based on the time taken for the echo to return.
📏 Distance Formula
Distance=Time×Speed of Sound2Distance = \frac{Time \times Speed\ of\ Sound}{2}Distance=2Time×Speed of Sound
(Speed of sound ≈ 343 m/s)
🔧 Main Components of the Sensor
📡 Ultrasonic Transmitter – Sends sound waves
🎧 Ultrasonic Receiver – Receives reflected waves
🧠 Control Circuit – Processes timing signals
🔌 Pin Interface – Connects to microcontrollers
🤖 Common Applications
🔹 Obstacle avoidance robots
🔹 Smart parking systems
🔹 Distance measuring devices
🔹 Water level monitoring
🔹 Automatic door systems
🔹 Smart trash bins
🔹 Drone altitude measurement
💡 Advantages
✅ Low cost and widely available
✅ Easy to interface with microcontrollers
✅ Good accuracy for short distances
✅ Works in dark environments (not affected by light)
⚠️ Limitations
❌ Soft materials absorb sound waves
❌ Not ideal for very small objects
❌ Performance affected by temperature and air conditions
❌ Limited detection angle
🔌 Compatible Microcontrollers
The HC-SR04 works easily with:
Arduino Uno
ESP32
Raspberry Pi
Arduino Nano
📐 Typical Sensor Layout
[ Ultrasonic Transmitter ] [ Ultrasonic Receiver ]
( O ) ( O )
HC-SR04 Ultrasonic Sensor
-----------------------------------------
| VCC | Trig | Echo | GND |
-----------------------------------------
✅ Tip: Since you often work with robotics kits and sensors (like ESP32 and Arduino projects), this sensor is excellent for robot obstacle avoidance and distance detection systems.
