
In conclusion, this project was beneficial because I learned a lot and was able to obtain a solution to my problem of protecting confidential items in my office. I am beyond thankful for the opportunity that this course provided me which allowed me to create something and add my own features to it. In the future, I wish to add a feature that sends a text message alert when someone is detected and also have an increase in the alarm volume once someone is in front of the sensor for an extended period of time.
References:
https://diyhacking.com/raspberry-pi-gpio-control/
http://www.tutorialspoint.com/python/python_sending_email.htm
I used RPi.GPIO to connect the LEDs to GPIOs, time for sensor purposes, pygame for the alarm to sound and stop, smtplib to send emails from the pi to my email, and email libraries which forms the structure of the email. I started by initializing which GPIO’s I was using, then writing the IF statement which set the condition for the LED to react when the sensor detects something or someone. The sensor detecting someone leads to LED blink. LED blink triggers the alarm to go off. As a result of the alarm going off, I receive an email notification which tells me that someone was detected.
Final Code:
import RPi.GPIO as GPIO
I cut a whole in a black plastic for the sensor, and nailed wood to surround the breadboard and portable speaker. The final project is shown as the sensor poking out ofthe front, and Pi strapped on the side. The casing took lots of trial and error, broken wood, wasted nails, and mistakenly injured my finger hammering so BE CAREFUL!
This is my demo of what has been completed so far. The system will print “Coast is Clear 0” when nothing is detected. It will print “Person Detected 1” when something is detected. Also, when something is detected, the LED will begin to light up. As a result of the LED lighting up, the alarm will begin to sound. Moving forward, I will begin looking into receiving an alert message to my phone when the alarm sounds.

After selecting my sound, I used “Ctrl + C” to cancel the sounds from continuing. Then I played the sound I selected separately as shown below, beginning with “omxplayer Wave…”

Before I use the speaker, which is used for the alarm, I have to make sure all ports are fully plugged in. After, to make sure the volume is up, use “alsamixer” to check the volume. Thirdly, once volume was up, I was able to test the speaker for sound using “speaker-test”. This gave me a blank white sound which let me know the speaker was ready to go.
