loading

The ultrasonic sensor works by sending out sound waves and counting how long it takes for them to come back ( having been reflected from the nearest object.

In this circuit the ultrasonic sensor HC-SR04 plugs straight in to the Arduin, with pins 7 and 4 being used and GND and Vcc. The distance is calculated and every time the distance is less than a given threshold an alarm is raised, thus turning on an LED and a buzzer

Componentsused:

•Arduino Uno

•5mm LED

•Piezo Buzzer

•Ultrasonic Sensor HC-SR04

<p>Hi <a href="https://www.instructables.com/member/Robotix_au/" rel="nofollow">Robotix_au</a>, I like ur instuctable very much. I programmed exactly d way u showed but my LED remains on after few seconds and serial monitor shows 0 cm continuously. Can u help me plz?</p>
<p>Unfortunately the HC-SR04 has horrible quality control. I throw away fully a quarter of the ones I buy. This is why the code has a safety feature of connecting GND first then VCC. <br><br>To test your sensor, I suggest you copy the code I have in the video below at around 6 minutes: </p><p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/B-tMybBBNYM" width="500"></iframe></p><p>If it still shows 0, your sensor is busted :(</p>
<p>Many thx for the help and guidance <a href="https://www.instructables.com/member/Robotix_au/" rel="nofollow">Robotix_au</a> Thx for ur time :)</p>
<p>Neat little build! Thanks for sharing!</p>

About This Instructable

2,029views

47favorites

License:

Bio: I am robotics engineer and a teacher whose passion in life is breaking down the maths and academic jargon of programming and robotics into something ... More »
More by Robotix_au:Memory Trainer in Python LIGHT SABRE GAME in Sratch Button LED Input/Output Circuit 
Add instructable to: