27
TASK 8.2 SIT 210
SIT 210
The problem is based on a real-life issue. In 2019 there were 11,775 more cases (as compared to previous year) of robbery in Australia, increasing by 16% from the previous year. This was the fourth consecutive annual increase and the highest recorded number of victims since 2012.
Other estimates show that 2.4% of all Australian households experienced a break in i.e. a whopping 231,000 cases in just one year. As the number of cases are on rise, there arises a need to protect the house from the such break-ins.
There are a lot of industry options available. They cost a huge sum of money and are not reliable and use one sensor or they just use a keypad/camera which in today’s high-tech world is not enough.
To provide with a cheap alternative/ solution, I have built a RPi project which provides with the best motion sensing and has excellent scalability option putting all the best parts of industry solutions into one cheap but effective product.
Requirements:
• Software requirements: IFTTT website, Raspberry Pi OS, IDE to write the code (Preferably Thonny IDE), VNC viewer (in case of no screen available), Python (2.8 and above)
• Hardware requirements: Jumper Wires (Male to female), PIR motion sensor, Raspberry Pi 3 or higher, LED, breadboard, Power Source for the Raspberry Pi, Buzzer. resistor
Using PIR instead of the supplied ultrasonic sensor was also a crucial choice as Using ultrasonic sensor would have increased complexity for no reason
DRY (Don’t Repeat Yourself): This principle states that the code must be reusable. I tried making functions where possible to minimise the re occurrence of the code.
Connectivity and ease of use: This principle involves the use of IFFFT to send mails to the owner to let them know if any motion was detected or not. The ability to just plug the RaspberryPi to a socket. It also brings in the portability of the RaspberryPi making it one of the smallest computers powering our system.
CODE:
• First, we need Python IDE on raspberry Pi to write all our code.
• First, I setup all the pins via GPIO.setup command and set PIR motion sensor as an input pin and set the others (LED AND BUZZERS) as an output pin
• After that I initialised the mode as BCM which would then allow me to use RaspberryPi pins.
• Then I made a continuous loop to keep on checking if any motion which is detected.
• If any motion is detected LED turns on (using GPIO.output(LED, GPIO.HIGH))
• The buzzer also turns on if any motion is detected raising an alarm (USING GPIO.output(buzzer, GPIO.HIGH))
• It also sends a request TO IFTTT to do actions based on events .IT sends a mail to the owner if a motion is detected using command
(r = requests. Post ('https://maker.ifttt.com/trigger/motion_detected/with/key/dm9_XXXXXXXXXXXX, params={"value1":"none","value2":"none","value3":"none"}))
Prototype Code:
https://github.com/EkamBehl/Task11.2.git
Testing the system:
To test the system, I did a lot of things which are as follows:
• First, I tried to swing the door (which had motion sensor near it) as fast as I could and checked if the sensor sensed any motion or not. To tweak this problem the best way was to place the sensor vertical to the door such that it senses a change irrespective of the speed.
• The next thing to test was to check if double motion of the door is captured or not because if we use it in a kid’s room which a parent comes to check we don’t need to turn the buzzer on this case. It would still register an intrusion and send a mail, but it shouldn’t do so if a third motion is detected in just an interval of 3 seconds.
• I tested it over 10 times and ensured that I get a mail every time a motion is registered and ensured that the buzzer as well as light turn on every time the motion is sensed.
User Manual:
Hardware:
• Take a pir motion sensor and connect VCC pin 5.5V pin ,connect GND to GND pin ,connect the last pin(out pin) to GPIO 14.
• Take an LED connect one end(smaller end ) to GND and larger end to the GPIO pin 23.
SOFTWARE:
• Open raspberry Pi and open Thonny IDE and put the github code in it.
• Open IFTTT website and make a new applet and call the event as motion_detected. Click on explore and search webhook and click on documentation and copy your “key” paste the key in r=requests code on github where it says to paste your key.
• Make sure that the event name in matches the event name given in your webhook.
• In then that select gmail and then select send yourself a mail to send one regarding the intrusion.
How to make the hardware for the project:https://youtu.be/R2STWT91a_E
How the project will work:https://youtu.be/el4c-S_zjkA