Wireless IP Camera – Part 3

What is a camera without eyes? This part we’ll discuss adding the webcams to the security cam.

My goal is to have one webcam for use during daytime, and one webcam for use in low-light conditions. This way I’ll be able to snap pictures from tresspassers both during the day and during the night.

In the first post you can see on the Bill Of Materials that I’ve chosen two Trust camera’s for my security camera. I have to confess that since then, I’ve switched one out for a better unit. The problem was that the camera for day-time use was getting over-exposed and the electronics in the devices could not compensate for that. So now I’m using a Logitech C270 webcam. This device can cope much better with the lighting conditions and has the additional benefit that it supports higher resolution.

The first step to adding camera’s to our setup is to make one unit (the cheap one) fit for use in low-light conditions. Webcams use a CCD chip to capture images. These chips are sensitive to a broad spectrum of light including infra-red (IR). Without filtering the images coming from a CCD chip seem “odd”. That’s because the infra-red exposure is influencing the image. So webcam manufacturers install IR filters in the webcam to filter out this unwanted light.

This image shot with a IR-filter-less webcam shows nicely how much IR energy is radiating from those palm leaves. You can actually see them photosynthesizing.

The IR-filter also makes webcams less useful in low-light conditions. People, like those palmtrees, also radiate IR light. So by removing the IR-filter from a webcam we can make people show up in the dark where they would normally be invisible.

This little bit about webcams and IR-filter is widely known and there are many places on the web that describe how to remove the IR-filter from a webcam, so I’ll refer you to those instructions. Jake Ruppal made a great youtube video about how to do it, for instance. Sures Kumar has a nice written version of similar instructions.

Once you have removed the IR-filter we can simply hook-up the camera’s to the USB-hub we’ve attached to the USB port of the bifferboard. When you boot OpenWRT you’ll see messages saying something about a video4linux (v4l) device. This means the kernel has recognized the camera’s and that they can now be controlled through the video4linux driver (which is built into the kernel). No need to install drivers for these camera’s.

Now, to test if the webcams are working. We’ll need to install an additional program called fswebcam. This program was written to control webcams from the command line. It can do al kinds of fancy things (such as embed the date-time into a webcam snapshot). You can compile it as a package through the make menuconfig command as I’ve discussed before. Once built and installed you can issue a command like

This will tell the webcam connected to /dev/video0 (which the video4linux driver has created for you on your BB) to snap a picture. By default fswebcam will save the resulting image in the directory where you called it. To snap a picture with the second camera you’ll have to replace the /dev/video0 with /dev/video1 depending on how the system has recognized your camera’s. You can check the names in the /dev/ directory on your BB.

Here are some examples from my security cam:

Image shot during night-time with night-time camera
Image during night-time with the day-time camera
Image shot with the new Logitech Cam

Let’s review what we’ve done so far. If all went well you now have a Bifferboard that:

  1. Signals movement via the connected PIR sensor on /sys/class/gpio/gpio7
  2. Connects securely to your WiFi network using WPA security
  3. Can snap pictures from two webcams

We almost have all the ingredients we need in place to make a smart security camera. In this post I’ll add to this mix how to connect a memory stick and mount it, so you actually have the space to store the snapshots.

For the memory stick I’ve used a generic stick. I just plugged it into the USB hub on my BB and looked with the command:

To see if the kernel was able to detect the memory stick. The output of this command will also tell you which device on /dev was added so you can mount the memory stick. Linux will usually call solid-state memory (like usb-sticks and SD cards) /dev/sdX. In my case it was /dev/sda1

I’ve added a little startup script to my BB to auto-mount the memory stick on each boot. The startup script is called /etc/init.d/usb-stick and it contains:

Now we can add the final ingredient to our mix:

4. Storage to keep all our security cam snapshots safe.

The next post in this series looks like it will be a long one. Next time, I’ll describe how to write the code that automates all the tasks of a security cam (detecting motion, snapping pictures, etc.). So we’re finally done with the hardware business and can move on to the software development side of this project.

For those who can’t wait, you can take a look at the code on github.

  • StumbleUpon
  • Facebook
  • Twitter
  • Google Bookmarks
  • email
  • RSS
This entry was posted in Security. Bookmark the permalink.

5 Responses to Wireless IP Camera – Part 3

  1. Prajwal says:


    Nice work. Learnt a lot from you site. Thank you.

    I am presently working on a project where i have to take a surveillance video of the area and live stream it. This is possible using a webcam and software which are already available on the net. But i wanted to build a hardware setup for it so that the computer is not used. Using your setup is it possible to steam the video live?? Or do you have any other idea which i can use?


    • Hey Praiwal,

      You could try to stream from a BB but I’m not giving you much hope of succes. The BB is probably too underpowerd to move much more than a very low resolution stream. I’d recommend looking at a hardware-platform that is a bit more powerful such as the Raspberry Pi or the BeagleBoard. They also have the benefit that you can use mainstream linux distributions on them (Debian and Ubuntu respectively). That should make your project that much easier.

      By the way I went with a movement sensor precisely because I wanted to go as low-power as possible. With this setup streaming is not necessary because the sensor detects whenever something interesting happens and an image needs to be captured.

      Here is a link to an article about using fswebcam to stream your webcam.

      Keep us posted on your progress!

  2. Fabrizio Rauso says:

    Hi! First of all I want to compliment you for your excellent work!
    I’m an openwrt user from Italy and I have a problem with fswebcam and openwrt on a router tp-link 1043ND.
    All works fine but I have a problem with font support…
    Can you help me? Maybe do you have a compiled version with font support for my hardware?
    I’ve read your post on stackoverflow about a similar problem, but I think that your work is based on bifferboard hw, my cpu is a ar71xx.
    Maybe I have to cross-compile fswebcam but I don’t know how to start.
    Thanks for all the help you can give me!

    • Hi Fabrizio,

      To get started with cross-compiling for OpenWrt you neet to look at the . The official documentation outlines quite neatly how to build OpenWRT for different hardware. The only thing you need to get started is a linux machine which you can use to develop on. Something more powerful then a router 🙂

      Just start with compiling OpenWRT for your device first and use “make menuconfig” to select a package to build as installable package. After that open an http server that contains your package folder. Tell your NAS to look at your package by configuring IPKG. Then try to install a package on your nas using IPKG which by now should pull the package from your own development machine. Alternatively you could also upload a package to your nas and store in on your nas and install it. I like to setup my own development machine as repository because I pull all my packages from that machine. It becomes a hassle to upload everything constantly.

      If your own-built package executes then you have cross-compiled your first program! If you got this far then you can add or change packages in the package feed. A suggestion was given in answer to my question on StackOverflow.

      Sorry for the convoluted answer. But to play around with hardware dedicated linux distributions means you’ll need to learn about cross-compiling. This is a great opportunity to do so. Good luck!

  3. John Saran says:

    Thank you for Explain. this nice Post …Helpful to me

    also View  fswebcam: Unable to load font ‘luxisr’: libgd was not built with FreeType font support  at http://allinonescript.com/questions/5452286/fswebcam-unable-to-load-font-luxisr-libgd-was-not-built-with-freetype-font-s

Leave a Reply

Your email address will not be published. Required fields are marked *