HC-SR04 Ultrasonic sensor for Arduino/Raspberry Pi
The HC-SR04 Ultrasonic sensor for Arduino/Raspberry Pi is a non-contact distance measurement module using ultrasonic waves. It offers reliable object detection and ranging from 2cm to 400cm for robotics, automation, and IoT projects.
Key Features
- Non-contact distance measurement from 2cm to 400cm
- High accuracy of ±3mm across the measurement range
- Easy trigger/echo interface works with any microcontroller
- 5V operation directly compatible with Arduino
- 40kHz ultrasonic frequency outside human hearing
- Compact module size for easy mounting
- Low cost compared to IR and laser distance sensors
Technical Specifications
| Parameter |
Specification |
| Model |
HC-SR04 |
| Operating Voltage |
5V DC |
| Measuring Range |
2cm – 400cm |
| Resolution |
0.3cm |
| Accuracy |
±3mm |
| Measuring Angle |
15° cone |
| Ultrasonic Frequency |
40kHz |
| Trigger Pulse |
10μs TTL |
| Echo Pulse |
TTL (duration = distance) |
| Current Draw |
< 15mA |
Applications
- Obstacle avoidance robots and autonomous vehicles
- Liquid level monitoring in tanks and reservoirs
- Parking assistance systems and proximity alerts
- Security systems for intrusion detection
- Industrial automation and object positioning
- Distance measurement tools and rangefinders
Pinout
- VCC: 5V power supply
- Trig: Trigger input (10μs pulse starts measurement)
- Echo: Echo output (pulse width = distance)
- GND: Ground
Important Notes
- Works best with flat surfaces perpendicular to sensor
- Soft or angled surfaces may absorb or deflect sound
- Multiple sensors may interfere – use sequential triggering
- Temperature affects speed of sound – add compensation for accuracy
- Minimum 60ms delay between measurements recommended