Sunday 11 March 2012

IR Night Vision Xbox webcam birdbox

I've already talked about removing the red glass filter in an Xbox Live Vision webcam to make it infrared sensitive - what I did next was add some infrared emitting LEDs to the camera so it can see in the dark. Not for astrophotography, but for close range night vision - inside a birdbox.

My plan was to try mounting the webcam inside a birdbox (e.g. like Mark & Nicky's Birdbox Web Cam, Elizabeth & Malcolm's Bluetit pages or Catherine's Nest Box Webcams), which has very limited natural lighting during day time via the (small) entrance hole. To use a webcam in low light or darkness without disturbing the birds, it needs an infra-red light source - replacing the default green four LEDs with a set of IR LEDs does the trick.

You can buy IR LEDs online, e.g. from Maplins, but I got mine from eBay at just £1 for ten including postage which seems like a bargain. These were the given specifications - similar items also listed the reverse voltage as 5V.
  • 5mm Infrared LED
  • Forward voltage: 1.5 - 1.6V DC
  • Forward Current: 60mA Continuous
  • 120mA peak for 10% Pulse Width 
  • Wavelength: 940nM
  • View Angle: 15-30 degree
  • Lens Color: Water Clear
Note this frequency of light is completely invisible to humans (and I presume to birds too), so when testing the LEDs with a normal 1.5V battery I had to use a (second) webcam!

Based on the stated forward voltage, and knowing that USB provides 5V, as expected three of these IR LEDs in series worked fine. So too did four, which fit nicely in the corners of the camera so I decided to use that. If you want more light, then two sets of three should work out nicely too - assuming your USB supply provides enough current.

Four 5mm IR LEDs, with long feet for mounting
I decided the simplest way to mount the LEDs was on the exterior surface anchored by their wires going through the casing. Since the plastic is quite soft, I used a gimlet for this (a small hand tool intended for making a pilot hole in wood for starting a screw, basically a metal point with a nice handle), making a pair of holes for each LED.

I then twisted the four LEDs leads to connect them in a chain. For the positive connection I was able to slip the wire into the PCB's tiny USB mount, but I didn't have enough slack to do the same with the negative connection. Instead, I exposed the incoming cable (the outer wire sheath is the negative line) and was able to bend it close enough to the LED. This didn't give enough flexibility to screw the PCB back into place, but with judicious use of insulating electrical tape it was a nice tight fit, and it seems pretty stable as it is. Plan B was to borrow or buy a soldering iron.

The downside of this electrical setup is the LEDs are on as long as the USB cable is powered. They do not switch on and off with the camera. If you are very good at fine soldering, you could probably replace the four green LEDs in situ, which would be more elegant. Note I also disabled the existing four green LEDs as shown before.
Modified Xbox webcam with four IR LEDs
(Photograph using slightly IR sensitive webcam,
the four LEDs appear inactive to human eye)
Modified Xbox webcam with four IR LEDs
(Photograph using a visible and IR sensitive webcam)
Here's an example of how well it works in a dark room. Without the LEDs, the webcam can see practically nothing (even with the IR sensitive modification). The circle of illumination is because these are strongly directional LEDs, and they seem to be lined up pretty well, lighting up the wall from a few meters away. You could angle them for a greater spread if you liked - but this seems about right for closer subjects.
Dark room using modified Xbox webcam with IR LEDs
You can buy security webcams which come with infrared LEDs built in, but mine was significantly cheaper (just £4 for the Xbox webcam, £1 for the LEDs - the bird box was only £6 itself) and was more fun to setup. Also, because the Xbox Live Vision has a CCD sensor it should be more sensitive than the average CMOS camera.

Selecting a bird box with an easy to open roof (two screws) made mounting the cameras pretty easy. This was a Tom Chambers "Snoozy Bird Box" with a 32mm entrance, bought in store at my local Homebase. Most nesting boxes that I looked at in local garden centres had a side or bottom opening for annual cleaning - not great for installing a camera.
Looking back, things I'd do differently:
  • Include a microphone as well to hear the birds. Maybe an alternative webcam with a built in mic would have been a better choice?
  • Mount the camera thinking about removing it for annual cleaning. I used a few too many nails making sure the camera was secure.
  • Field of view - with the small bird box I picked, the camera doesn't quite capture the whole floor. On the bright side, the camera can be focused down to quite short range - I just hope got it set appropriately...
  • More diffuse IR LEDs? Perhaps these are too focused for a small box?

Inside the empty bird box, light from the four IR LEDs
Anyway, the camera is now mounted inside the birdbox using assorted bits of wood to make a firm platform, and attached to the eves of the house, right up under the guttering.
Birdbox installed below guttering, cable through window vent


Without drilling any holes in walls or window frames, the USB cable limited the range of potential bird box sites. At this point a wireless webcam has some appeal, but they still need a power cable. I've started reading up on how to extend the range of a USB cable, as this was a limiting factor in finding somewhere to place the box. Hopefully the current location will attract some occupants anyway. Maybe March may be a bit late in the year to setup a new bird box, but fingers crossed!

Update: First visitor photographed (and second visitor)


Update: See also Xbox Birdbox Mark II (an improved setup avoiding the 'white out')

3 comments:

  1. Brilliant.

    Exactly what I needed to know to set up a hedgehog cam using Linux on a Raspbery Pi.

    Many thanks.

    ReplyDelete
  2. Hi,

    Thanks very much for all the information. I am also looking into setting up a webcam with night vision (infrared). You talked about using security webcam with buildin infrared but do you know any way to connect them to rspberry pi.

    Also, it would be really useful if you can send me the links for webcam, ir leds, lens etc so that I can order the correct (already prooven) parts.

    Thanks very much.

    Syed

    ReplyDelete
    Replies
    1. I bought all my XBox Live Vision webcams, IR LEDs, etc on eBay.

      I've not used a security webcam - for use with a Raspberry PI I would avoid any camera with an analogue video signal as you would need a USB TV capture card to use it.

      Delete