The HC-SR04 is a widely used ultrasonic distance sensor that measures distances from 2cm to 500cm (approximately 5 metres) with 1cm resolution. It works by emitting a 40kHz ultrasonic pulse, then measuring the time it takes for the echo to return — making it ideal for obstacle detection, range finding, and proximity sensing.
Send a 10μs trigger pulse and the module emits eight 40kHz ultrasonic bursts, then outputs a pulse proportional to the measured distance. If no object is detected, the output pin goes high for 38ms. A minimum cycle period of 50ms is recommended between measurements for accurate readings.
Specifications
-
Power Supply: 5V DC
-
Idle Current: <2mA
-
Measurement Range: 2cm – 500cm
-
Resolution: 1cm
-
Effective Angle: <15°
-
Ultrasonic Frequency: 40kHz
-
Trigger Pulse: 10μs minimum
-
Recommended Cycle Period: ≥50ms
Key Features
-
Non-Contact Measurement – Ultrasonic ranging without physical contact
-
Simple Interface – Single trigger pin and echo output; works with any microcontroller
-
Wide Range – Detects objects from 2cm to 5 metres away
-
Low Power – Under 2mA idle current
Ideal For
- Robot obstacle avoidance and navigation
- Drone low-altitude sensing
- Proximity detection and distance measurement projects
- Arduino and Raspberry Pi sensor projects
Jargon buster
Plain-language definitions for the technical terms used above.
- DC
-
DC means direct current, where electricity flows in one constant direction, as supplied by batteries, USB ports and many plug-pack power supplies. When a product specifies DC, it runs from a DC supply rather than mains AC, so you need to provide the correct voltage and polarity.
- microcontroller
-
A microcontroller is a small computer on a single chip that runs a stored program and controls connected inputs and outputs such as buttons, sensors, displays and communication interfaces. In a device built around one, it is the part that executes the code and coordinates the device's behaviour.