So, in the midst of being a paranoid little geek, i've been mucking about with the idea of setting up some cameras around my house. Fortunately, that's something that's become a tad more affordable as of late. Mostly thanks to the fact that folks insist on getting the latest generation of electronic gizmo and orphan the old one.
This is interesting because many of those said gizmos have wifi and cameras built in. In addition, you can get real wireless cameras for a lot less than you could a few years ago, so there's that.
Here's how i set up my configuration (or at least the bits that are interesting):
What you'll need:
a Linux server with a fair bit of space on it (Pics and videos take space)
1) The pre-install.
Technically, N wireless does 300Mbps per channel, with bursting up to 450Mpbs. A lot of devices top at 100Mbps. i'd recommend getting a dual band router and keep the devices on the broader 2.4Ghz channel.
The linux box is also kinda key. It doesn't have to be spectacular (i run a dual core franken-box i built about 7 years ago), and has Ubuntu server loaded on it. It runs headless, so there's no need for anything fancy.
2) The real webcameras
i picked up some FOSCAMs that were on sale on Amazon. These are nice little cameras that have built-in wifi, as well as remote movement controls. They also have the ability to do motion detection and have a pretty powerful set of IR lights. They're not without a few problems, though.
For one thing, getting the camera on the network. The easiest way to do that is to plug it into the router, find the IP in the attached device list and then http to that. Once you're there you can set the network, IP address, port, and all the other settings you'll need. Fortunately, once they're configured, they're pretty autonomous.
Another issue is that they reboot every so often. When they do, they turn on the IR lights. The problem with that is IR reflects amazingly well off of glass which blinds the camera. Sadly, there's no way have the camera remember to not turn those on, but you can use a remote command to force the IR off.
/usr/bin/curl -n --silent http://$CAMERA_ADDR/decoder_control.cgi?command=94 > /dev/null
i have a crontab entry that sends that command every so often to make sure the damn lights stay off.
3) The more disposable webcams
Like i said, depending on where you are and how tech savvy your community happens to be, you can get things like first generation ipod touches for as low as $1. Old Android phones can also be had for darn cheap, so it can be fairly easy to load up just by visiting craigslist. Once you have your handfuls of junk cameras, you can then load them with ipCam for iOS or IPWebcam for Android. Both of these apps let you route the camera to the local LAN, and that's a delightful thing, as we'll discover in a second.
4) Setting things in Motion
Now comes the fun bit…
On the linux box, grab a copy of motion. Motion will pull the cameras for images and do some quick analytics to detect motion. It will also capture snapshots and compile a stream of activity for the day.
Be sure to point motion at a directory with "ample space". In my case, i record about 2GB of data for 4 days. i have a script that goes through the directories and purges files older than that, but that's me. Granted, in an era of sub $100 2 TB drives, this is probably being overly aggressive. Here's the cleanup code:
/usr/bin/find /d2/media/ipcam -type f -ctime +2 -delete
for i in `ls -1` ; do
/usr/bin/find /d2/media/ipcam/$i/jpg -type d -empty -delete
/usr/bin/find /d2/media/ipcam/$i/swf -type d -empty -delete
And for those that are interested, my motion.conf file is below. i've trimmed out the comments and blank lines, but this shows the values.
And the main camera config (remember, this replaces the values from motion.conf)
on_picture_save /home/jrconlin/bin/newPic.sh %f
The "on_picture_save" bit stores a copy of the latest picture to my remote server. i have something else pull movies, but i could have also had motion push them just as easily. It's also possible to have motion monitor just parts of an image and fire a script when it sees activity at that position. i've thought about rigging that up for Halloween one year to scare the pants off of kids coming up the driveway.
That's it! Happy monitoring.