Introduction: ARDUINO With Ultrasonic Sensor (distance Measurement)

In the following video a distance measuring equipment has been designed with the help of the ultrasonic sensor.
the following tutorial will be helpfullto get the overall idea about the ultrasonic sensor in very short time

Step 1: WATCH THE VIDEO

Step 2: SMALL OVERVIEW ABOUT HC SR04

SPECIFICATION

Power supply : 5V DC

Quiescent current : <2mA

Effectual angle : <15°

Ranging distance : 2cm – 500 cm

Resolutio n: 1 cm

Ultrasonic Frequency : 40k Hz

Step 3: HOW DOES THAT WORKS

Initially a pulse is transmitted by the ultrasonic sensor and if there is any object detected by the ultrasonic sensor then it will return that waves to the sensor. On the base of the distance a pulse is generated at the ultrasonic sensor to send the data to arduino or any other microcontroller. the stating pulse is about 10us and the pwm signal will be 150 us-25us on base of the distance

if no obstacle is there then a 38us pulse is generated for arduino to conform that there are not objects detected

Step 4: Arduino With HC SR-04

connect the arduino as showing in the following schmatic

ARDUINO UNO HC SR-04

+5v ----------------------------------------vcc

gnd ---------------------------------------gnd

12 pin ------------------------------------trig

11 pin ------------------------------------echo

Step 5: Upload the Program

upload the following sketch to the arduino ny using the arduino ide

in the code this part is used to calculate the distance

long microsecondsToInches(long microseconds)
{

return microseconds / 74 / 2; }

long microsecondsToCentimeters(long microseconds)

{

return microseconds / 29 / 2;

}

Step 6: Thanks for Watching

You can modify the following code and make something innovative and don forgot to subscribe to my instructables as well as my youtube channel

in my youtube you can get so many projects in the electronics side as well as so creative videos about the leds and fan dc motors etc..

link to my youtube is

https://www.youtube.com/channel/UCZE35bOktFxu8dIad...

thanks for watching

Comments

author
PraveenP71 (author)2017-07-21

where do we can see the measured distance