Do-it-yourself infrared Monitoring

Quick summary: night vision video on a budget.

Apparently, or so I discovered recently, a baby requires care all the time. All the time. Even when sleeping peacefully. Just take at the
range of products and you’ll see that this did not escape some astute companies.

The most interesting part (also the most expensive and probably the most useless) is the video component. It comes in two parts:

  • a wireless webcam, with some infrared LED to be able to monitor in the dark
  • a receiving unit with a screen roughly the size of a post stamp

There is a huge range of products, with options ranging for 300 foot range (my place is not that big), support for 4 room camera simultaneously (don’t have enough rooms), belt clip, touch screen to zoom, waterproof, etc.

However, I was not very happy to go and buy one of these devices for several reasons:

  • there is no information about the protocol used for the wireless communication. Given the security record for this kind of device (for examples on how to spy on your neighbor baby, see here and here again), it’s better to assume that all the neighborhood can help you keep an eye on your baby. I’m not very comfortable with that.
  • it’s a one use device: you need to monitor the baby for a few months and then, you’re left with something to stuff in a cupboard (for a few years?).
  • it does what it was designed to do. And only that.
  • and it cost a few hundred dollars.

So I started toying around with the idea of making my own. The basic idea is simple: hook a webcam to an old laptop and stream the video over wifi, then pick the stream on a computer screen, the tv, or whatever you can imagine. I was pretty confident for the second part of the project: once I have the image on the laptop, the rest would be straightforward.

The tricky part is to get to see in the dark: if you need to shine a projector on your newborn to seen if he is sleeping well, that could be disruptive. So I’ve started to do some research on the technology used by these products. They are all using the same principle, few infrared (IR) LED around the webcam so illuminated the scene without being disruptive (the human eye can’t see infrared). So this is active imagery, I needed to find a solution for the receiver (webcam) and for the emitter (IR-illuminator).

Some constraints for the emitter: as I wanted to avoid pluging too many stuff around, it has to be powered by the USB port (5V).

Standard CCD are sensitive to IR and will be able to show it very clearly. The trick is that most webcam have a filter to remove it as most user want to see the same stuff with the webcam than with their eye. Without this filter, most of the vegetation is bright white:

IR photography example

This photo is from the wikipedia page on Infrared photography.

Just to be clear, this has nothing to do with thermal IR, the wavelength of these LED is just above the red color (ended up using 950 nm LED).

Apart from the artistic aspect of it, IR imagery using cheap webcam has two main markets it seems. One is baby monitoring as we’ve already established, the other one is security monitoring (I sure hope that they don’t come with the security flaws we’ve seen above).

In the security camera market, the device are more flexible in the sense that they are made to be combined, adapted to existing systems, etc. Two major problems for me: outputs are usually RCA (great if you want to plug it to a VCR, not if you have an old laptop) and power for the IR illuminators is 12V (usb port deliver 5V). So out are the security devices.

The best option was to build my own illuminator. There are plenty of IR LED available on the web: just combine a few of them, with some resistors, connect it to the USB port and voila! Few questions, though:

  • how many LED to use? I started with 3, tried 6 and settled on 12. It seems sufficient to provide some indirect illumination in a dark room
  • what resistor to use? I reused some basic rusty electronic skills, but it was great to check all on http://led.linear1.org/led.wiz.
  • where to buy the material? The radioshack I tried was hopeless (I just got some wire from there), ebay had plenty of LED sellers (but the quality was dubious), so I settled for SparkFun (no problem at all).

And few wire stripping later, here is the prototype:

IR illuminator

The laptop is an 8-years-old Thinkpad T40 (one of the most reliable piece of hardware I’ve seen), the webcam a logitech quickcam (as old as the T40) with the IR filter removed.

The thinkpad is connected to the wireless network (using WPA encryption) and the video streaming is started with:

<small>cvlc -vvv --color v4l:///dev/video0:norm=ntsc:frequency=543250:\
size=320x240:channel=0:adev=/dev/dsp:audio=0 --sout \
'#transcode{vcodec=mp4v,acodec=mpga,vb=500,ab=256,\
venc=ffmpeg{keyint=80,hurry-up,vt=800000}}:\
standard{access=http,mux=ts,dst=10.1.10.14,port=8080}' --ttl 2
</small>

On the other computer (which is conveniently placed in the middle of the living room), just open a vlc and open a network stream on

http://10.1.10.14:8080

And you get something like this:


vlc screenshot

One problem still, there is some buffering issues and the video suffers a delay of a few seconds on the receiving side that increases slowly. I reach 20s delay after one hour. No solution yet apart from restarting vlc on the client side.

So we are done with the basic minimal setup, but there is a lot of room for improvement, limited only by imagination and by the sleepless nights to come.

2 thoughts on “Do-it-yourself infrared Monitoring

  1. I did the same with gstreamer running on a beagleboard. Udp streams have less lag,jpegenc to a udpsrc on the client side. $4 cameras rock.

  2. I was too rush to go for the embedded solution (lot of additional googling for me!), that will be for the next project. Thanks for the udp suggestion, I’ll give it a try…

Leave a Reply

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