Motion Activated Security Alarm
For my computer engineering project, I built a Motion Activated Security Alarm. The goal is to create a device that can be used at home to detect movement and then trigger a sound and a light alert right away. This project shows how basic home security systems work by combining sensors that detect motion with software that controls lights and sounds.
It uses a PIR motion sensor to sense when someone moves nearby. When motion is detected, an LED light flashes and a buzzer makes a sound. The main idea is to demonstrate how motion detection systems operate in homes and other places.
Downloads
Supplies
Here are the list of supplies you'll need for this project:
Planning
I built my circuit on Tinkercad to test my ideas before moving on to the real circuit. If you're interested there is also a schematic view of the circuit. Furthermore you can visit this link to see how i connected them.
Assembling the Circuit.
1. Connecting the Power Rails
- Connect a red jumper wire from the 5V pin on the Arduino (Power section) to the positive rail of the breadboard.
- Connect a black jumper wire from the GND pin on the Arduino (Power section) to the negative rail of the breadboard.
- Connect a black jumper wire from the bottom negative rail to the top negative rail on the far left side. Then, connect a red jumper wire from the bottom positive rail to the top positive rail on the far left side.
2. Connecting the HC-SR501 PIR Sensor
- Plug the PIR Sensor pins into rows 9, 10, and 11 on the top section of the breadboard (columns i, j,h).
- Pin 1 (Middle - VCC): Connect a red jumper wire from j)10 to the top positive rail. Then, connect another yellow jumper wire from i)10 straight to Digital Pin 7 on the Arduino.
- Pin 2 (Left - OUT): Connect a yellow jumper wire from j)9 to h)9.
- Pin 3 (Right - GND): Connect a black jumper wire from j)11 to the top negative rail.
3. Connecting the Red LED & 330Ω Resistor
- Plug the Red LED across the row in the middle gap. Place the Anode (long leg) at f)20 and the Cathode (short leg) at f)19.
- Connect a blue jumper wire from the Cathode at f)19 directly to the e)19.
- Connect a black jumper wire from a)19 to the bottom negative rail.
- Plug the 330Ω Resistor into the board to the LED Anode with small a red wire.
- Connect a red jumper wire from f)25 straight to Digital Pin 8 on the Arduino.
4. Connecting the 2N3904 NPN Transistor
- Plug the NPN Transistor pins into rows 26, 27, and 28 at column e) spanning across row segments.
- In the diagram, it aligns at rows 26 (Emitter), 27 (Base), and 28 (Collector).
- Connect a red jumper wire from the Collector at a)28 down to the bottom positive rail.
- Connect a black jumper wire from the Base at a)27 down to the bottom negative rail.
5. Connecting the 10kΩ Resistor
- Plug the 10kΩ Resistor into the board from c)20 to c)24, connecting straight to the Emitter of the transistor.
- Connect a blue jumper wire from c)24 to c)26 to the Emitter of the transistor.
- Connect a green jumper wire from b)20 straight to Digital Pin ~11 on the Arduino.
6. Connecting the Piezo Buzzer
- Put the Piezo Buzzer on the far right edge of the breadboard.
- Connect the Positive (+) terminal row to the top positive rail using a red jumper wire at i)30.
- Connect the Negative (-) terminal row to the bottom negative rail using a black jumper wire at d)30.
7. Powering the Circuit
- Lastly once you're done assembling the circuit with all the components and wiring's are connected, You need to upload the code into the Arduino board. So below this there is a code you can copy and paste it into the Arduino app, IF you don't have windows or are using a school laptop/Chromebook that doesn't support Arduino or that doesn't let you install app due to the admin restrictions you can luckily use the Arduino Cloud website online to upload the code into the Arduino board. Click on "Get started for free" and then just login or create your account, next in your homepage click on the "Create new" button and select "Sketch" after that paste the following code below to your sketch and once done, plug in the USB cable of Arduino board to your device, select your board, brands and the port. Once your done that click on "Verify" then lastly click on "Upload". Hope for the best as your circuit should work as you connected it, If you encounter problems or your circuit isn't working, you should check the common issues like if your jumper wires are connected properly, as loose connections can prevent the circuit from functioning. If it still doesn't work visit this link and this link to help you out.
The Code
Conclusion
This project taught me about troubleshooting, circuit design, and coding for Arduino.
And as for you, Have fun building this circuit!!!
Thank You!
Thank you for reading this Instructable! Feel free to ask questions or suggest improvements in the comments.