2013-04-08 doorbell with webcam

no worries, there are pictures below all of this text


I had a doorbell with mp3 functionality. It ran on batteries. Every few months it stopped working as the batteries ran out. This duration became shorter and shorter. Something had to be done.

In the meter cupboard there was already some infrastructure like a laptop, power and network connectivity.

and then...

Then, I connected a doorbell (simple button) to a digital i/o converter and connected that to the laptop. Initially it kept signalling a key press untill a friend had the epiphany that those buttons usually have a light in them which gets its power from the same 2 lines it shorts when the button is pressed. After removing the lamp, it worked fine. For the sound I used regular multimedia boxes.

A couple of lines of C++ further, it then invokes a python script which does the real processing. This script receives a timestamp at which the visitor started to press the doorbell and a a value which tells you how long the button was pressed. This python script then selects at random an audio file (mp3, wav, etc.) and plays that using mplayer. The timestamp and duration are stored in a database: I now know for example that most people press that button on average for 0,53 seconds (calculated after 74 presses).

The next step was sending an e-mail to me and my wife: in python that is only a couple of lines of code and it works. I also added which audio-file was played.

We then find out that during the day all kinds of people are ringing the bell, but they don't always leave a note. So the next step was: a webcam which takes a picture and adds this to the e-mail. I had to develop a special program to this as most programs "open" the webcam, ask it to take a picture and end. But, especially at the darker or brighter hours of the day, the webcam needs some time to adjust the input levels. Because of this most pictures were either too bright or too dark. Waiting for the webcam to settle would take at least 3 seconds, way too long. So I wrote a program which "opens" the webcam and then keeps it open and then when it receives a signal, it writes a photo to a specific file.

Not everybody stands still in front of the webcam so not all the photo's are recognizable. I solved this (somewhat) by scanning for bluetooth devices in the neighboorhood at that time. Also wifi enabled devices can be scanned: they occasionally send probes to look for certain access points.

The last tweak was removing the power from the speakers when we're not at home. My wife and I could already switch of certain parts of the infrastructure with our travelcard and now this was extended to power off- and on the speakers.


The final result: a doorbell that stores the timestamp and duration of the press in a database, sends an e-mail with a photo of who's in front of the door, the file name which was played, and any detected bluetooth- and wifi devices to the e-mail boxes of me and my wife. Ideal when we're working at home (usually upstairs)!


digital i/o converter

connector on i/o converter

resulting cables and such


camera setup

This is a friend of mine, 0.1s after she pressed the doorbell.
Note to my neighbours: the output of this webcam is normally NOT available over the internet! So no, you will NOT end up on the internet if you press my doorbell. In fact, your photo never leaves the house.

The Lotter allows you to participate in lotteries from all over the world!