Build It: The Pizza Cam
SHARE

There’s nothing better than Guys’ Night, an evening of gaming or movies in my basement media room. The only trouble is when we (invariably) order pizza, because I can’t hear the doorbell from there. The solution: an inexpensive DIY digital surveillance system tied to Twitter.

We started with Linux, which could be customized to include just the parts needed to run the camera. Then we installed a camera-management app, ZoneMinder, that can record video frames and compare them to detect motion. Throw in an old video-capture card and a $50 camera, and we’ve got a pro-quality video surveillance rig. Better still, when the system detects motion at the door, the software posts messages to Twitter, texting my phone (for free!) that the pizza has arrived.

Make a Pizza Cam

Time: 14 Hours
Cost: $70

Rescue an old PC
It’d be easy to set up any number of modern services to accomplish some sort of basic monitoring – assuming you have the spare case for a modern PC and related gear. But for something this frivolous and fun we sought to construct it as much as possible from low-buck rescued gear. So we found a nine-year-old 1 GHz PIII with 256 meg of RAM lying around the closet. Before it was abandoned, it was an office desktop.

Install Your Favorite Flavor of Linux
The key to the low-buck program: selecting an operating system that doesn’t hog so much of the PC’s resources that it can’t still run the camera. Though there are tons of options available-–check Wikipedia for a great comparison of what’s available–-we chose Gentoo.

Best of all, Gentoo is free. You can download an ISO file of Gentoo’s “rescuecd” – a boot disc that lets you try out the operating system and install it on your rescued PC.

Some Linux geeks dislike Gentoo because its installation package forces you to include or exclude every single driver and bit of functionality. But this works to our advantage, as we can remove virtually everything. The options you select will depend on your PC, but just remember to keep it as slim as possible.

Install ZoneMinder
Zoneminder is a free, open source camera control application which will allow you to view your camera’s output via a web browser – plus record and perform other tasks upon motion detection. And since Zoneminder detects motion by comparing each frame to the next, you won’t need any special equipment.

Zoneminder requires the Apache web server as well as the MySQL database server. These are also free and easily obtained from their respective homesites – or better yet directly via the Gentoo emerge command.

Buy and install a camera and (if needed) capture card
We scored a small infrared camera at CompUSA complete with mounting bracket and 100′ of wire for $50. It can’t see very far with just its tiny infrared LED lights, so it’s no night-vision wiz. But it handles twilight very well, and my porch light provides plenty of light to deliver a great picture at night.

Since our camera terminated in a standard composite video connection, I also picked up an inexpensive capture board. Almost any capture board will work, but when you’ve found a good deal on a board it never hurts to do a Google search or two to see if anyone else has run into issues with it. You’ll also save yourself cash by buying an older capture board; you don’t need the functionality of new ones, and you’re more likely to find Gentoo drivers for boards that’ve been around for a while.

Zoneminder can also work with a number of webcams, including some wireless models. So if you have an old one sitting around, you might consider using it instead.

Regardless, you’ll want to plug in the camera and test it before you pull a lot of wire. I ended up using almost all of the provided 100′ to run the wire out from an upstairs office equipment closet into the attic, out a vent under the edge of the roof, down a gutter, and across to the front of the house.

Write a script (or use ours)
Inside Zoneminder you have the option to create “event filters.” While you can use this feature to archive old video files, you can also use it to run a script. Just define your event and add the location and filename of your script in the “Execute command on all matches” field.

Note that you can’t pass parameters in this field, which means that your script won’t know a lot about the specific event.

To keep us from restarting the server over and over again, we wrote a single script called zm-walkway-event.sh that calls others (download them all here).

You can then create secondary scripts to take whatever action you’d like on motion detect. We started with a simple tweet using this script:

As you can see in the code, you can choose to either Tweet publicly or to send a direct message. If you want to Tweet to a normal stream privately, just create an account for your house and set it to protect its updates. Then send follow requests from your normal account and any others you’d like to see the updates.