Tuesday 27 March 2012

CCTV lenses on an Xbox Webcam

Anyone following this blog will know I've been hacking Xbox Live Vision web cameras for fun. This started with removing the lens, and attaching a telescope - which is great for photographing the moon, or the bottom of the garden. The M12 x 0.5mm thread (aka S-Mount) is also used on many CCTV cameras, so you can get alternative lenses covering a range of focal lengths. I decided to buy a £10 set on eBay and try them out.

Three of my Xbox web cameras have been modified for infrared and installed in bird nesting boxes. The first bird box was the smallest, with the floor only about 12cm from the lens, and as a result only the centre of the floor is in frame. The second bird box is unusually tall, and just captures the whole floor (and some of the sides). The height of the third bird box is in between - also the camera is slightly off centre. They're all using the provided lens, which while it can focus at these short ranges, doesn't give quite the field of view I need. So, a wider angle lens would be interesting - provided it works with infrared, which fortunately is the case with most CCTV lenses.

It would also be nice to have an intermediate zoom setting between the default webcam lens and a full telescope - something that could be used to monitor our bird table perhaps? For this I was thinking primarily daylight usage to photograph the birds with sunlight plumage for natural colours.

I bought a six pack of fixed iris webcam CCTV lens for £10 via ebay, covering wide angle 2.8mm, normal 3.6mm, and zoom lenses of 6mm, 8mm, 12mm, 16mm. This said it would support both 1/4" and the larger 1/3" sensor sizes commonly used in CCTV cameras, so I assumed it would be fine with Xbox webcam's sensor size. Individual lens are cheaper, but this was a better deal than getting any two lenses. I also found reasonably priced 2.1mm wide angle and 1.8mm fish eye lenses which might work too - but their threads looked a bit odd so I didn't gamble on them.

2.8mm CCTV wide-angle lens
3.6mm CCTV lens (held)
Xbox webcam with original lens
6mm CCTV low-zoom lens (held)
8mm CCTV zoom lens (held)
12mm CCTV zoom lens (held)
16mm CCTV zoom lens (held)
I've included an example with the Xbox webcam's original lens - which would appear to equate to about 5mm if used on a CCTV camera.

The good news is that the lenses do all screw on nicely. Also none of them have built in IR filters, which is perfect for the Xbox webcam as it has a separate red glass filter directly above the CCD sensor. If you're using a webcam where the filter is part of the lens (e.g. this or this) that might be a problem - unless you wanted night vision.

The bad news is that in my indoor testing, in most cases the focal point required the lens to be outside the mount. i.e. You would need to replace or modify the thread block to use them with this webcam. I've read other people had this trouble and solved it by raising the block with washers or otherwise (hey - I recognise their webcam!). For these lenses I took the test images shown above by holding the lens in front of the sensor with some small pliers - as a result the focus and image stability is less than perfect, and the framing a little inconsistent - but it shows the zoom effect quite nicely.

The exception (fortunately) was the 2.8mm wide angle lens, which seems to work fine on this webcam both at room distances, and at the close range I was considering inside a bird box. I have not yet tried this under infrared though, but assuming that's fine this seems like a useful modification to make for a bird box camera.

Notes on lens mounts

The Xbox webcam's M12 mount is (as shown in previous post photos) a black plastic unit with a squarish base, with two protruding screw points by which is it attached directly to the board. The screws are approx 2cm apart, with Phillips cross heads. The total height of the block is approx 1cm, of which about 8mm is the circular barrel. Within that, only about 4mm is threaded, starting approx 3mm above the CCD surface. These are all crude measurements - I should get some callipers.

I spotted a potential replacement part on eBay, "S Mount (M12) Board Lens Holder" for £2 plus postage, and asked them for the size details - Alun at Stock Optics Ltd (eBay store) replied just one day later to say:
Overall height: 15mm
M12 Thread (in top part of the holder) length: 8mm
The two mounting screw holes: Hole diameter: M1.8
Distance: 20mm Center of each hole.
I was impressed with the pre-sales service for a cheap part like this, which is why I've included the links above. Those dimensions sound like it has double the usable thread of the Xbox mount, and if it fits I think it would suit at least one of these zoom "board lenses" giving me a DIY zoom webcam. However, before buying this it occurred to me to try transplanting the mount from a spare webcam, which although not quite as tall also does the job:

With 2.8mm lens (no IR filter)
With 3.6mm lens (no IR filter)
With transplanted lens (with IR filter)
With 6mm lens (no IR filter)
With 8mm lens (no IR filter)
With 12mm lens (no IR filter)
With 16mm lens (no IR filter)
I didn't even need to modify the case except for removing a tab on the inside of the nose cone to allow the new lens the full required range of motion to focus. So, I can now use the Xbox webcam with a wide-angle lens (with or without an IR filter), or several fixed zoom lens (but sadly without an IR filter).

Given I planned to use the wide angle lens in a bird box with IR light, and the zoom lens for watching a bird table in daylight, the filter situation is a bit unfortunate. Other potential downsides include the fact there is no safety stop preventing the lens being tightened down onto the sensor, and there is now a small gap round the lens which could let in dust or moisture.

My next project is to combine an IR sensitive wide angle lensed Xbox webcam with infrared LEDs to use in a bird box. Maybe I can capture the entrance hole as well as the floor like this...


Update

I've now used the 2.8mm lens in a Wood Pecker nest box, and bought another wide angle lens which went upgrading the camera in my original smallest nest box. Neither nest box was quite the right shape to try and capture the entrance hole as well as the whole floor.

No comments:

Post a Comment