This tutorial will teach you how to make a proximity/motion detector. (Can be done by following the diagram and copying the code)
Start by connecting the 5V power on the Arduino to the + rail of the breadboard and ground to the - rail. Next, place the ultrasonic sensor on the breadboard. Make sure it has space behind it for connections. Connect "Vcc" to the power rail and "Gnd" to the negative rail. Connect "Trig" to pin 13 and connect "Echo" to pin 12. Next place a LED on the breadboard. Connect the long side to pin 10 and the other side to the negative rail. Lastly, connect the the positive wire of the speaker to pin 11 and the negative wire to the negative rail.
Upload the code to the Arduino. Be sure to set the correct distance in the code for you needs. (I set it to 192 as I wanted it to beep when an object got closer than 192 cm)
You are now finished :)
Comments