Nicolas314

All my geeky stuff ends up here. Mostly Unix-related

Junior webcam support

leave a comment »

Just for fun: I have added a webcam to Junior. A USB webcam, the kind you can find for 20€ in any computer store out there. I bought one without checking for Linux support beforehand and was lucky enough to get one that is supported. For what it’s worth: the webcam is sold as Hercules Delux webcam. The package said it supports 1.3 Mpix images but that is a lie: the captor is 640×480, that is 300 kpix and they have software to interpolate (extrapolate) to larger images under Windows. Oh well… Next time I will check before going to the store.

Anyway: I needed to compile and install an extra driver to support this camera. The driver is called ov51x-jpeg and it can be found here:

http://www.rastageeks.org/ov51x-jpeg/index.php/Main_Page

Once the driver is loaded into the kernel, you get new devices corresponding to video and audio inputs (this webcam comes equipped with a microphone): /dev/video0 and /dev/dsp1. To check everything is working smoothly, I started up VLC (VideoLAN Client), chose “Open Capture Device” and provided these device names. Video is really smooth on this webcam and sound is working as expected.

Now I have video and sound acquisition capabilities on Junior, which finally enables me to implement a simple but powerful alarm system in my house. What I want is:

– A system running full-time when I am not home
– Keep acquiring images from the cam until some movement is detected
– As soon as something is detected, send the images to me by e-mail and send me an alert by SMS

I should also be able to log into Junior and listen to the audio flux remotely, and why not get the video flux too. I did not get to this last part yet but the rest is pretty easy.

You want to have a look at Motion, a pure command-line motion detector. This utility can be configured to take any kind of action upon detecting movement in a video feed, which is exactly what I want, and it is available from the Debian repositories. It took me a while to understand the configuration file and get it right but once put together it works really nice.

The last part I needed to solve was sending an alert over SMS. Un-surprisingly, there are still no SMS-brokers out there offering SMS sending services for free. You need to register and pay for these, and this is not cheap. I guess this is a good thing in the end to avoid spam on mobile phones in general. I checked out my phone subscription and found out that my provider also offers a Webmail that can be connected to my mobile phone: whenever I receive an e-mail at that address, they send an alert by SMS to my mobile phone containing the e-mail Subject line, and this is free of charge. There we are! The final algorithm can be summarized as:

– Run motion on Junior
– Whenever movement is detected, send the images by e-mail to me, and send an SMS alert to the e-mail account associated to my mobile subscription.

Since I do not want to be flooded with false SMS alarms, I limited the system to sending only one per day. This should be enough. Now I need to find a way to deactivate the alarm system when I come home, otherwise the alarm will trigger every day.

Yet another simple but nice project. Not sure it will ever be useful, I just wanted to know if it could be done!

Advertisements

Written by nicolas314

Sunday 12 August 2007 at 1:17 pm

Posted in junior

Tagged with , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: