Web cams are fairly ubiquitous things these days and by no means expensive. They can be good or bad depending on how much money you want to spend, but there is one almost-universal rule, which is that they connect to a host PC over USB. IP-based cameras that connect to a LAN via an RJ45 connector or wirelessly over 802.11 are quite a bit more useful, because they can be put almost anywhere, but they tend to cost a surprising amount and not provide much resolution. A low-end one like the LevelOne FCS1030 is NZ$260, and they go a lot more expensive than that. For example, the wireless D-Link DCS5300 sells for NZ$930 and it only does 320×240 pixels.
After all, IP cameras have a processor in them, and do web serving, and that… well, that really isn’t a reason for them to be expensive. Some sort of premium seems to go on anything connected with the security industry.
As an illustration of this, the Linksys NSLU2 is a little network storage controller which does web and file serving. It sells here for about NZ$145. Its a complete computer with a 266MHz RISC CPU, 8M of flash and 32M of RAM, two USB ports, and an RJ-45 connector. Not much by todays standards, but not very many years ago those would have been respectable specs for a desktop. It runs off a 5V plugpack. The really interesting thing about it is that the open source community has developed something like five alternative firmware distributions for it which are very capable, and can do almost anything that the hardware will allow. Including acting as a camera server for an attached webcam.
Webcams have also made some interesting strides forward recently. A number of new webcams with true resolutions greater than 1 megapixel have appeared, and a standard for USB web cameras has finally been agreed on. This standard, known as the USB Video Class or UVC, means that newer webcams no longer require proprietary drivers but will work with a generic UVC driver. The Logitech Quickcam Pro 9000 is a good example of a UVC camera, capable of up to 1600×1200 pixels complete with optics to match. It sells here for about NZ$128.
I have been working on combining these two devices with one of the open-source firmwares that has the rather disconcerting name of OpenWRT Kamikaze. Despite the name it has proved to be quite reliable and full-featured, although not terribly well documented, as it is constantly being worked on and improved. Recently it has got to the point where it can easily make the NSLU2 and the QuickCam 9000 work together to make a high-resolution IP camera server, for a total of NZ$275. As it stands the combination is only suitable for indoor use, and it has some limitations, but it still produces a very good image for the money and it works with any web browser — or with my Linux-based ZoneMinder security camera software. If you want indoor high-resolution imaging over a LAN, this could be quite useful. Compiling OpenWRT and selecting the necessary bits is a bit involved and can take a few hours, so I am making the end product, a firmware build called openwrt-nslu2-uvc-webcam1.bin, available here.
To use it yourself you will need:
- An NSLU2
- A UVC-compatible webcam such as the QuickCam 9000
- A host computer running Linux
- The firmware image
- Access to a DHCP server on your LAN
Installing the replacement firmware on the NSLU2 is a Bit Technical, but not difficult. You will need to run a tool called UpSlug2 to install the firmware. UpSlug2 is described here. I would recommend running it from Linux. I used my Ubuntu machine, but booting a Knoppix Live CD on a Windows machine should work fine. UpSlug2 can also be used directly under Mac OS X: see here. Under Ubuntu, getting UpSlug2 is as simple as
apt-get install upslug2
The next step is to power-up the NSLU2 in “upgrade mode”. It should be connected to the same LAN as your Linux machine, but do not plug the camera in at this stage. Use a straightened paper clip or other thin probe inserted in the Reset hole at the back of the NSLU2. Apply gentle pressure and the reset switch will click in. Hold it down and press the power button at the front. The Ready/Status LED will come on orange, but after nine or ten seconds will turn red. Release the reset switch as soon as this happens. The Ready/Status LED should start alternating red and green, indicating that the device is ready to upgrade. Now issue the command:
sudo upslug2 --image="openwrt-nslu2-uvc-webcam1.bin"
If all is well and UpSlug2 can find the NSLU2 you should see a nice animated summary of the upgrade process, which will take about one minute twenty seconds. When it finishes you should wait for three more minutes for it to perform initial setup. You can then disconnect the power, plug in the USB webcam (to the USB port nearest the LAN socket – the other one isn’t powered), and power it up again. After about 55 seconds the red ring light on the camera indicating that it is recording should come on.
The firmware has been set to use DHCP to dynamically determine its IP address. This has the advantage of working in almost all network setups, but it does mean that you will need access to the DHCP server log on your local LAN to find out what IP address it has been given. The logs should show a DHCP discover/offer/request/ack sequence at the time the NSLU2 powers up, which will tell you what IP address it was given.
The log will also give its Ethernet or MAC address (which is on a label on the outside of the box as well, if you still have it). If you have access to the DHCP servers configuration files, you can tell the DHCP server to give the NSLU2 with that Ethernet address a consistent IP address at which it can always be found.
Once you have the IP address, use any web browser to go to http://<IP address> (e.g http://192.168.10.154) and you will find an About page for the M-JPEG streamer software, offering various forms of static or moving images from the webcam, which is running at a resolution of 960×720. For an unadorned single frame, try http://<IP address>/?action=snapshot.
A sample image looks like this
Which is not bad for a webcam at all. A bit fuzzy around the edges, but resolution in the middle is fine. Your cat may look different.
This firmware should work with any UVC-compatible webcam, which includes a number of models from Logitech, Creative, Philips, and other manufacturers. A list of compatible ones can be found here [Warning; the Microsoft Lifecam NX-6000 is listed, but I am told it doesn’t work]. The firmware will not work on anything other than an NSLU2. I intend in due course to describe how to build the firmware in another post, but I had to build the “trunk” version to do this and I’m hoping that a formal release of OpenWRT that supports the mjpg-streamer package that makes this possible will come out and make the whole process much easier.
The NSLU2/QuickCam combination is a powerful one that could obviously be used for a good deal more than a simple image server. The NSLU2 isn’t powerful enough to run anything like the ZoneMinder software except at low resolutions, but it could still be used as a stand-alone remote survey camera with a few additions. I also intend to post about this in the future.
I won’t actually be using this camera with my ZoneMinder setup because it is a bit too demanding. IP cameras require more CPU cycles from ZoneMinder than directly-connected cameras, because ZoneMinder has to decode the JPEG format that the images are sent over the network in. My 1.2GHz Pentium III can only just manage 4 frames a second from this camera at 640×480 with not enough margin to handle another camera. I would guess that if you wanted to use several of these with a ZoneMinder setup nothing short of a 2.5GHz dual-core CPU would be enough.