11.27.2013

A Raspberry Pi Project the NSA Would Be Proud Of

A few days ago I looked up, from jumble of monitor windows and labs that occupy my desk, at my Raspberry Pi sitting there sulking at me. It had that 'sad microcomputer look' to it, notably from a general lack of usage. I've had the Pi for nearly a year now and I've played with it off and on but nothing ever really started clicking enough that got me serious about any projects with it. This is largely to blame on my lack of Linux knowledge and eventual frustration. Sitting there, in that moment, pondering the nearly thousands of things you can do with a Pi, I looked over and noticed my old Xbox camera. It too has been abandoned by the apathy of technological progression. This spark of inspiration got me digging through one of my "Drawers of Misfit Toys". Basically, it's all the wires, adapters and little odds and ends that I don't use anymore, but am too afraid to throw away for this very reason! Inside I resurrected an old WiFi dongle that I never had any use for. Are you thinking what I'm thinking?

Wireless
Really what made things start to get interesting is when I got the Wireless adapter working on the Raspberry Pi. This by no means is anything new and, in fact, there are hundreds of tutorials out there to get it to work. What's interesting though is, once you make the Pi wireless, how much more possibilities open up of what you might do with it. I could have it down in the basement helping automate my Curing Chamber processes (see Charcuterie). I could buy a solar powered battery case for it, place it in a weather proof container, and make it a DIY weather station. Really I plan on doing all these things as time goes on, but first things first. Let's use what we have available!

Motion Detection
After making the Pi wireless, I checked out 'Motion' to see if I could turn my webcam into a motion detecting security camera. After a few days of tweaking I got it running very nicely. Motion comes with tons of customization, and you can tweak anything and everything to get it to do what you want. Basically I have the camera set up to watch an area of my house (let's say the backyard) when anything moves in front of the camera it takes a picture and time stamps it.  The picture is then saved onto the Pi.

Web Stream
In the process of setting up Motion I also let the Pi broadcast the stream over the internet (with authentication). From there all I have to do is use a web stream app (VLC player, MJpeg Viewer for Android) and I can check in on my house from practically anywhere in the world on my phone or tablet.

Motion Alert
Not only does the Pi take a picture of a would be trespasser, but I also set it up so that upon the event of a picture taken/motion detected it sends me a custom email (via sendEmail) notifying me that it has seen something! This was by far one of the more fun moments of configuring on the Pi. Having my phone ring because I wave my hand in front of the camera is a neat 'magic trick' to show to my friends.

Off-site Image Storage
In my quest to turn my Pi into the ultimate Motion Detecting, Burglar Catching, Alert System ever conceived,  I thought.. "Why not have the pictures FTP directly to my Dropbox  (or any cloud storage) so that the images don't only reside within the house. With a few tweaks to the motion.conf file that's exactly what it does. Upon saving images, and notifying me of detection, it also FTP's a second set of images over to my Dropbox. So after I get the message I could go check the files from my phone and make sure it wasn't a stray cat or something.

So what's next? One of my friends suggested (jokingly) that I have it upload the images to some sort of Google facial recognition database. Maybe I could rig it up to turn on the porch lite at night, and launch my own 'home defense drones'.  I have no idea where I'll go with this project really, or where it will end up. In all honesty though, it's just really great to have something exciting to do with my Raspberry Pi and actually understand and make progress towards it. As a bonus I'm starting to understand Linux better as well. Be on the lookout for more inspired Pi projects to come!

Sites that helped in this project:

How to Make a DIY Home Alarm System with Raspberry Pi- https://medium.com/p/2d5a2d61da3d

Linux File Access Permission Reference - http://www.penguintutor.com/raspberrypi/file-permissions-reference

Setting Up Motion with FTP & Email - https://raymii.org/s/tutorials/Setting-up-motion-with-ftp-and-email-support.html

Send Email from Command Line - http://danielthat.blogspot.com/2012/10/how-to-send-email-from-command-line.html

2 comments: