BuildCircuit has previously published a project on HCSR04 ultrasonic range finder module. You can checkout the article from this link.
Now, we have another article on HCSR04. It is as simple as the previous project.
HCSR04 ultrasonic range finder module: The HC-SRO4 is an ultrasonic sensor which uses sonar to detect objects at a distance of 2 cm to 4 meters. This sensor is widely used in robotics to build robots that move and should divert or avoid obstacles. You can read more about this module on this article.
The ultrasonic range finder can be used in several ways for range detection and robotics projects. It is able to detect the distance to obstacles are in front of a mobile robot, allowing a maneuver movements before a collision occurs.
Arduino and ultrasonic range finder will give you full control, allowing you to schedule the most convenient way for your project moves your robot.
This project uses Arduino UNO R3 and one ultrasonic sensor HC-SRO4. The sensor HC-SRO4 is easy to find and has a good price. You can buy one from buildcircuit.net.
Moreover, it is easy to control it through the Arduino, because it only has 4 pins described below.
VCC – 5V (ranging from 4.5 V to 5.5 V)
Trig – Sensor input (trigger)
Echo – Output Sensor (Echo)
GND – Ground
Components required for this project:
- Any one arduino version, UNO, Duemillanove, Leonardo, Mega, etc.;
- One breadboard;
- HC- SR04;
- The library SRO4 sensor HC-click to download
- Jumper wires;
- Three LEDs of different colors;
- Three resistors of 220 ohms.
Assembly of the project:
The operation of the project is simple. As you approach an object sensor LEDs light up according to the distance of the object. The green LED switches on if you are away, yellow if in the middle distance and red if it is close. The sensing distances LEDs are programmable, if you want to change just do it in the source code of the project.
The first step is to install the library HC-SRO4 for your program to work. Download this library on your computer, then unzip the file. After unzipping a folder called HCSR04Ultrasonic will be created on your computer. Copy this folder to the libraries of the Arduino IDE and it’s ready, you can now use the library resources into their programs.
Now connect the components as shown on the layout below.
- Digital ports 11, 12 and 13 of the resistors connected Arduino, which in turn are connected the legs of the LEDs positive;
- Cathode pin of the LED in the GND (ground) of the Arduino;
- VCC pin of the ultrasonic sensor HC-SRO4 in Arduino 5V;
- TRIG pin sensor HC-SRO4 digital port on the Arduino 6;
- ECHO pin sensor HC-SRO4 the digital port 7 of the Arduino;
- GND pin HC-sensor SRO4 in Arduino GND.
Arduino sketch: DOWNLOAD
Other experiment images:
Watch the output(Video on youtube)
Other related posts:
This project has been taken from fritzing.org. All the images have been downloaded from fritzing.com. The maker of this project is ComoFazerAsCoisas.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic - Simulation - PCB Layout - Gerber Viewer
JLCPCB Prototype & Small-batch PCB: Only $2 for 10pcs 10×10cm PCBs, 24 hours Quick Turn, DHL Delivery in 3 Days