The Technology Behind the Litter Cam
Hardware
An extension of our home server, the webcam setup is run on a moderate Dell N-Series desktop with a 2.4Ghz Celeron processor & 792MB of RAM running Ubuntu Linux.
The camera itself is an ancient Kensington VGACam web camera limited to 320×240 pixels of resolution. In the photos you can see two of these cameras strapped together. At one point we were using the second camera to stream live to Ustream, but with such huge amounts of time between litter uses, it was not only boring, but also a waste of bandwidth.
Software
The software running the camera is called Motion. Motion is an excellent piece of software with a very powerful feature-set. It can run multiple cameras and export video files in just about any format you can think of. Not to mention, the motion detection capabilities are excellent, as well.
When Motion detects motion from the camera, a shell script is called that uploads the captured video to our hosting server, updates the recent clip thumbnails using ImageMagick and posts an alert to the Twitter API. Since motion can be detected often several times per minute (depending on how busy the cats are) we’ve built in a function to not allow Twitter updates to be posted less than ten minutes apart.
Getting the Motion config file just right was one of the major tasks with this project. From brightness to motion sensitivity, it was a lot of trial and error, which we’re still tweaking.
Lighting
Lighting turned out to be a big task. While the camera could see in the dark space fairly well, whenever the laundry room light was flipped on, the software would see this as motion detection due to the amount of pixels that changed. This prompted us to leave the light on all the time, but shadows of people in the adjacent room resulted in the same false positives. The key was to flood the litter area with its own light, keeping the shadows of people in the other room from affecting the motion software. Now only the cats create motion.
The light is just an old desk lamp running a cool, low wattage CFL bulb.