In this exercise we will create a motion sensor that will trigger an alarm.
To begin this lab you will need:
1 Arduino Micro-controller
8 Copper Wires
1 Passive Buzzer
1 Ultrasonic Sensor
Step 1: Connect the Sensor
At this point you should have all of your parts ready. Begin by connecting the ground rail to the GND on your Arduino. Next up, connect a wire to the power rail from your 5V pin on the Arduino. From here, connect the ground rail to the GND on your sensor, connect the power rail to the VCC, connect echo to pin 12, and lastly connect trig to pin 10.
Step 2: Connect the Buzzer
At this point you should have your ultrasonic sensor connected properly. It is now time to add our buzzer. Place the buzzer into the breadboard. Connect the (+) side of the buzzer to pin 8, and connect the other side to the ground rail.
Step 3: Testing Your Project
Now you have both a device capable of reading distance inputs and one capable of producing sound. Using the attached source code any variation in distance will trigger a tone to be played, based off distance.