Saturday, 8 October 2016

Trick or Treat Detector

Detect those pesky kids before they get to the front door. Put it outside to spook the Trick-or Treaters as they walk up to your door.   This project is motion activated using a PIR sensor, upon activating the Owl and some cheap LED string lights turn on.

Step 1.  Prototyping
I built the circuit on a breadboard to test the idea. I used the PIR sensor and breadboard from the brilliant CamJam EduKit 2.  I used transistors to drive the LED’s as the Raspberry Pi GPIO pins cannot supply a lot of current. The code was written in Python using the great GPIO Zero API.  I set the Python script to load on start-up.




















Breadboard layout
























GPIO Connections

GPIO 4 -  PIR sensor
GPIO 5 - Owl via driver transistor
GPIO 6 - Bat lights  via driver transistor
GPIO 12 - Hand lights via driver transistor
GPIO 17 - Shutdown switch


Step 2.  Transferring the circuit onto a PCB

The circuit worked well so I decided to transfer the breadboard prototype onto a more permanent Adafruit Perma-Proto HAT.   



















Step 3. Building into an enclosure

While looking for suitable enclosures in Poundland I came across a nice plastic pot full of Halloween sweets, having removed the sweets to eat later.  I set about cutting some holes in the pot for the PIR sensor and 3.5mm mono jacks.   I connected all of the cables and checked that it worked. 





















Parts List:
1 x  Raspberry Pi board, any model will work
3 x  NPN Transistors
3 x 10KΩ Resistors
3 x Suitable resistors for the LED’s ( I used 22Ω resistors)
1 x PIR Infrared Motion Sensor (HC-SR501)
1 x PCB tactile switch
3 x 2 way Molex KK type 2.54mm headers and housing
1 x 3 way Molex KK type 2.54mm headers and 2 housings