Get object/distance detection in your project using the low-cost HC-SR04 Ultrasonic Distance Module. Using the same principle as bats (Echo location), this module uses Trigger and Echo pin to send a signal and listen for it to be 'bounced back'. With a few lines of code you'll be detecting objects for your project. This module is the perfect option for detecting objects between 2cm-450cm in front of your project.
- Range - This module can detect objects between 2cm and 450cm in front of itself with an angle of 15 degrees either side.
- Accuracy - The readings of the module can be broken down into 0.3cm increments, which is plenty for most robotics projects
- Mounting - Used by many makers, in many projects, the 4 holes on the circuit board make for easy mounting into your project
- Software - As a favorite distance sensor, there are plenty of libraries and examples available to use with Arduino, Micro:bit, Raspberry Pi and other maker platforms.
- Distance calculation - Once it's wired up, you'll use the formula: distance = (traveltime/2) x speed of sound for a measurement in centimeters
How to use this Ultrasonic Distance Sensor
As this module is a 5V sensor, it will work great with Arduino and other 5V microcontrollers. You'll simply need to wire the device up to your board and configure the trigger and echo pins as Output/Input pins respectively. Once you've got it configured correctly, use your code to take the Input reading from the Echo pin and plug it into the distance formula: distance = (traveltime/2) x speed of sound to get a distance reading.
It's really that easy. There's even a library for Arduino, NewPing, that makes the process even easier for you. We've written a pretty comprehensive guide on how you can use this module in your projects. It's guaranteed to get you up to speed as fast as possible.
Technical Specifications
- Power Supply :+5V DC
- Quiescent Current : <2mA
- Working Current: 15mA
- Effectual Angle: <15°
- Ranging Distance : 2cm – 450 cm/1″ – 13ft
- Resolution : 0.3 cm
- Measuring Angle: 30 degree
- Trigger Input Pulse width: 10uS
- Dimension: 45mm x 20mm x 15mm