🛠️ Dive into our collection of DIY Kits, 🔊 Audio Amplifiers, Digital Scoreboards, FM transmitters, and more!
🎶 Explore endless possibilities at our new store.


Obstacle sensor using Arduino and HCSR04

arduino-sensor-ultrasonico-hc-sro4-01

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

ultrasonic range finderThe 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.

try this also

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:

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.

arduino-sensor-ultrasonico-hc-sro4-06

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.

hc-sro4_esq

Connection:

  • 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.

The library SR04 sensor HC-click to download

Arduino sketch: DOWNLOAD

Other experiment images:

arduino-sensor-ultrasonico-hc-sro4-03

arduino-sensor-ultrasonico-hc-sro4-05

try this also

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.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.


🛠️ Dive into our collection of DIY Kits, 🔊 Audio Amplifiers, Digital Scoreboards, FM transmitters, and more!
🎶 Explore endless possibilities at our new store.


Leave a Reply

Your email address will not be published. Required fields are marked *