Introduction: Measuring Distance Using the HCSR04 Ultrasonic Sensor and Arduino

Picture of Measuring Distance Using the HCSR04 Ultrasonic Sensor and Arduino

Hello, in this instructable i will show you how to use an ultrasonic sensor with Arduino. In this case i use the HCSR04 sensor, which can measure in a range from 2 cm to 5 mts.When it detects anything within the range of 15 cm, it will light up a LED, also you can see the measurement readings on the Serial Monitor of the Arduino IDE.

Step 1: What Do You Need?

So for completing this project you will need the following items:

  1. Arduino UNO board.
  2. HCSR04 Sensor x 1.
  3. LED x 1.
  4. Few wires.
  5. PC.

So when you have all of this you can go on the next step

Step 2: Diagram Connections

Picture of Diagram Connections

Just follow the diagram that i show you above and you will be ready to upload the program to your Arduino UNO board. Also check the video on the following step to see how everything is set.

Step 3: And Download the Arduino Program Code!

Picture of And Download the Arduino Program Code!

Now you are here just click on the link below to download the program code for Arduino.

http://www.mediafire.com/file/nggoo5bm3652ok4/Sens...

When you have it, unrar it, then open your Arduino program and upload the code to your Arduino board. If everything went ok until this point you can open the serial monitor on the Arduino IDE and you should see the distance measures that you sensor is taking.

Don't forget to watch the video and turn on the english subtitles to see how the sensor is set with the Arduino and how it works!

That's all folks, thanks for reading and remember, if you have any doubt you can let me know on the comments, i will be happy to help you. Happy coding.

Comments

RevanthK7 (author)2016-12-27

i did it! thanks...

fdr1929 (author)RevanthK72016-12-27

Yeah, that's awesome!!, thanks for letting me know Revanth, have a nice day!

ChetanS43 (author)2016-12-20

it's was usefull...

fdr1929 (author)ChetanS432016-12-20

Glad to hear that Chetan, thanks for reading, have a nice day!

About This Instructable

3,996views

60favorites

License:

Bio: I'm an electronic engineer and i love to learn new stuff and also share my knowledges with everybody and make tutorials to teach about ... More »
More by fdr1929:Steve Vai Ice Cream "Vai's Cream"Measuring Distance using the HCSR04 ultrasonic sensor and ArduinoHow to Repair Asus Laptop Charger?
Add instructable to: