Turning the IR (night time) security camera on automatically

Hey all!

I’ve just modified the webcam PHP scripting to detect a dark image. If it detects a dark image it will attempt to turn on the Infra Red lighting, which will make a better image 🙂

We chose this method over the simple IR timer because the nights we are there late with all the lights on we do not want the IR bulbs burning away. Plus this way is cooler.

Also updated the javascript a bit so it waits for all images to “refresh” before it starts the countdown again.

Pretty cool! Learnt a few things too.

You can see a screencast showing the lights coming on automatically below (or click here).

Next challenge is to work out when to turn the IR led off. I think I’ll just setup a cron job, and if the webcam is not in use by anyone after 5 minutes I’ll turn it off.

Possibly improvement could be to skip the “turning IR on” image and just wait a few more seconds to load the IR image. might do that mod next, see how it goes.