The objective of this project was to create a device to capture the perpetrators that insist on leaving that fiery bag of animal feces on your porch or sneakily ringing the doorbell to get you off the couch for their entertainment. The motion sensor can be positioned a few feet away hidden in the shrubbery and the camera can be mounted above the door or even within a porch light for optimal concealment. Once the meddling kids run past the motion sensor the camera will be ready to catch their identity. Once the motion sensor is tripped and the event has been published a notification will be sent to your phone via an IFTTT (if this then that) applet, and you can retrieve the camera and view the pictures on any device with a USB port. If you already have children in the local school system you can confiscate their yearbook or sports team photos to identify the suspect; if not then you might need another means of capturing them or just posting a wanted poster around the neighborhood or on social media.
PIR Sensor Controlled by Photon
The PIR sensor (motion sensor) is the main component in the system, controlling the camera and outputting information to the ThingSpeak graph. The PIR sensor has 3 pins located on the bottom (ground, output, and V in); the power for V in is supplied by the Vin pin and the output is connected to the D7 pin on the photon. Once the PIR senses motion it sends a digital write of HIGH to the photon and publishes that motion has been sensed. Once the digital write has taken place the information is sent to ThingSpeak via a webhook integration in the particle console. Within the code there is an increasing count that will output a new total count number and graphs the number of times that the sensor has been tripped in a predetermined time interval. This time interval can be configured within the ThingSpeak channel being used and once the user wants to return the count to zero and start collecting data they can use the "clear channel" option in the channel settings page.
Camera Controlled by Photon
The camera is controlled by a particle photon, and two transistors. The transistors used for the project were 2N3904 NPN transistors. The transistors act as a switch on the camera, controlling the shutter switch and the mode buttons on the camera as shown in the picture below.
When somebody walks past the PIR sensor, an event is published which the camera's photon subscribes to. The photon then turns on the camera, takes one picture, and turns back off. One common ground must be connected to the photons ground and the negative side of the battery in the camera. The number on the small screen on the front of the camera displays the number of pictures that can be stored in the cameras memory. The camera can hold a max of 20 high resolution pictures. When a photo is taken, the number decreases to display how many more photos can be taken and stored in the camera.
The PIR sensor and the camera are housed in two separate containers so that the motion can be sensed before the camera captures a picture due to the small delay between the motion being published and the camera subscribing to the published event.
Graphing with ThingSpeak
Utilizing the webhook integration within the particle console to send data to ThingSpeak provides the above graph. The Y-axis displays the running count of motions sensed and the X-axis displays the time intervals of the motions.
How-to on Creating a Webhook and Generating a Graph with ThingSpeak
How we set up Push Notifications with IFTTT
Getting notifications sent to your phone via push notifications, SMS, or email is easy with IFTTT! First create an IFTTT account then go to applets on your account. Select "new applet" and search for "particle" and click on the particle icon. Next click on the word "this" in blue and choose "new event published". Enter your criteria, similar to what we have above and select "create trigger" when done. Then select the word "that" and search for notifications. Next, select "send a notification from the IFTTT app", select "create", and then "finish". Now you should have a notification sent to your phone whenever the event you chose publishes.
References:
Cover Picture: http://img.memecdn.com/genius_o_2449587.jpg
http://www.instructables.com/id/Hacking-A-Keychain-Digital-Camera-for-Arduino-Cont/
https://www.hackster.io/snack-squad/snack-security-06cf91
https://www.hackster.io/gr1m/particle-photon-pir-sensor-and-event-reporting-268aa0
Comments