Ultrasonic Sensor HC‑SR04
📏 Ultrasonic Sensor HC-SR04 – Distance Measurement Module
Measure distances accurately using sound waves
The HC-SR04 Ultrasonic Sensor is a widely used, low-cost module for measuring distances between 2 cm and 400 cm with high accuracy. It works by emitting ultrasonic pulses and measuring the time taken for the echo to return. Perfect for robotics, obstacle avoidance, level sensing, and automation projects.
⚙️ Technical Specifications
Parameter | Specification |
---|---|
Operating Voltage | 5V DC |
Operating Current | ~15 mA |
Measuring Range | 2 cm – 400 cm |
Accuracy | ±3 mm |
Measuring Angle | ≤15° |
Trigger Input Signal | 10 µs TTL pulse |
Echo Output Signal | TTL pulse (width proportional to distance) |
Module Size | 45 mm x 20 mm x 15 mm |
✅ Features
📏 Accurate distance measurement from 2 cm to 4 m
🚗 Perfect for obstacle detection in robots
⚡ Fast response time for real-time applications
🔌 Simple 4-pin interface: VCC, Trig, Echo, GND
🧠 Compatible with Arduino, ESP8266, ESP32, Raspberry Pi, STM32
🧪 Typical Arduino Connection
Module Pin | Arduino Pin |
---|---|
VCC | 5V |
Trig | D9 |
Echo | D10 |
GND | GND |
Simple Arduino Code Example:
cppCopyEdit#define trigPin 9 #define echoPin 10 void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); Serial.begin(9600); } void