Saturday, February 5, 2011

Digital Camera Surveillance with ZoneMinder

Quick side-trip to explore a usable video surveillance system:
  • A video camera with reasonably clear video
  • A PC running software to collect the video
  • Motion detection, so you don't have to go through years and years of video to get to your one event,
  • Event logging, so you can track when that motion happened and find it easily
  • A good web interface so you don't need remote software to access the server
  • The ability to post alerts out via the internet, or even send images to a remote device, like a smartphone

http://www.zoneminder.com meets all these requirements handily.  Turns out there's a delicious little virtual machine available for trying out ZoneMinder, so that you don't have to build up a full-custom machine to try it out. I had VMware Player already installed - getting the VM up and running only took about 15 minutes, and that includes the time it took to search the web to fix the VM...

Get VMware Player

Download VMware Player for free from http://www.vmware.com. If you have VMware Player up and running, you can then host virtual machines, try stuff out, and leave your important, fundamental desktop system configuration untouched and pristine. Nice stuff.

Get the ZoneMinder Virtual Machine

You can find this VM at http://www.vmware.com/appliances/directory/86653. There's some good initial information at the VMware page, but to download it, VMware links you to: http://viktorpetersson.com/open-source/zoneminder-virtual-appliance/. The VM runs OK under VMware Player:



There's a problem with the file /etc/udev/rules.d/70-persistent-net.rules. It has a bug in it. It should read "eth0" at the end, not "eth1". (it is fixed already in this image) You can fix this two ways:

Easy: edit the file, change "eth1" to "eth0" at the end. Save the file, reboot the VM. 

Slightly More Manly, No Reboot:
/etc/udev/rules.d/70-persistent-net.rules contains the MAC address to eth device mappings. Delete the lines like below, noting the module name on the "# PCI device" line:

#PCI device 0x1022:0x2000 (pcnet32
SUBSYSTEM=="net", ACTION=="add"....NAME="eth1"

This removes the MAC to eth1 device mapping info - you want it to map to "eth0" so the network on the VM will start up when it boots. 

Restart udev to allow the change to take effect:

/etc/init.d/udev restart
Bounce the kernel module for the ethernet device. Use the module name from the 70-persistent-net.rules file noted above:

modprobe -r module
modprobe module

"ifconfig" should now show the eth0 interface as up and running.

A Good Webcam To Choose
 
The text in the notes of the ZoneMinder VM suggests trying it out with a network camera. I tried out the Linksys WVC80N. Most cool is that it's a NETWORK camera - you plug it into an ethernet and it serves up images across your network. Here's how to configure it in ZoneMinder:


The username: admin and password: admin are default for the WVC80N.  Here's what's needed to make it work:

Remote Host Name
Remote Host Path
Capture Width
Capture Height

Here's the camera control webpage under ZoneMinder:


The camera always comes up amber colored when it's in "monitor" mode. If you set it to "Modect", or motion detection, it will go green. You can see all the events I've already captured just in testing. "Modect" works great. Here's what the "event capture" web screen looks like:


To Learn More:

Getting ZoneMinder:
http://www.zoneminder.com

Some config tips for the Linksys camera. Outdated, but serves as a good pointer:
http://www.zoneminder.com/wiki/index.php/Linksys

Cisco's WVC80N FAQ
http://www6.nohold.net/Cisco2/ukp.aspx?pid=80&login=1&app=search&vw=1&articleid=20535

Download a VM to try out ZoneMinder:
http://viktorpetersson.com/open-source/zoneminder-virtual-appliance/

Fixing the broken VM so it will run:
http://ubuntuforums.org/showthread.php?t=255018

Using basic webcams with ZoneMinder:
http://www.linuxscrew.com/2007/11/05/howto-home-video-security-with-zoneminder-and-ubuntu/

Brian Klug did a great writeup on making his ZoneMinder installation work well:
http://www.brianklug.org/2010/01/zoneminder/