Saturday, June 29, 2019

Ultrasonic Distance Measurement using Arduino uno

Ultrasonic Sensor Interface With Arduino Uno

Ultrasonic Sensor Distance Measurement Code 

In this post, I will tell you how we can make a distance measuring device with the help of ultrasonic sensors and Arduino Uno.


Ultrasonic Sensor -

Collect The Following Components -
  • Arduino Uno                                Buy on Amazon
  • Ultrasonic Sensor                         Buy on Amazon
  • 16x2 LCD Display                         Buy on Amazon
  • Jumper Wires
  • Bread Board
Follow This Steps - 

1) Make the electric circuit according to the picture given below.
PDF Download - HC-SR04
2) Copy the code given below.



 Or
Download Ultrasonic.ino file
3) Now open the Arduino software and create a new file in it. Paste the code you copied it or open the Arduino software by double-tapping on the downloaded file.
4) Compile And upload this code in Arduino UNO. 
5) Now you test your project. You can see the distance on the LCD screen as well as on the Serial monitor of Arduino Software. For this, you have to set the baud rate at 9600 of the serial monitor.

Note -

  • You can use this device only to measure the distance from 2 centimeters to 400 centimeters.
  • Low accuracy
Result -


If You Have any questions or suggestions please comment below.