Monitoring the doorbell

I thought it would be fun if I would get a text message with picture every time someone presses the doorbell. It woud be nice if the currrent doorbell was not affected and no obvious cameras would be visible.

First of all I needed to get the Pi noticing a keypress. There are numerous walk throughs to help you on your way like this one. Problem is that although i do have a momentary switch at my door, it is connected to a 8V AC circuit with the bell and a certain way to fry your Pi is to put 8VAC on a GPIO pin.

So to separate the circuits I needed a relay or something that switches when someone uses the bell. I happened to have some left over solid-state relays (G3MB-202P) from other projects so that shouldn’t be a problem except for the fact that need an DC current. Ah well, who hasn’t have some bridge rectifiers in their drawers.

All in all the schematic of my interface looks like this:

which translates in this

so, when someone presses the doorbell the relay will activate the switch and connects pin 18 and 20 (GPIO24, GND) and than we are at where the earlier mentioned example talked about and can we do some of the programming…

When i came across a so called endoscopic camera I thought that would make the perfect camera for this purpose. Ordered from hong kong these things are very cheap (< 10 euro’s) and are waterproof, small and acts like just a standard USB webcam so it works great with fswebcam ( sudo apt-get install fswebcam ).

I used a python script that waits for the doorbell and takes a foto using fswebcam when needed. I used python interrupts but you can use of course a polling mechanism to achieve this.

fswebcam uses a confuguration file, this is mine

The last step is how to get the image on your phone. This can be done on many ways but the most easy and failsafe way to do that is to use one of these services.

I like to use Telegram for all communication between my phone and the Pi’s. If Telegram-cli is running in the background all you need to do after taking the picture is send it on its way with the command:

echo send_photo Someone_Ontelegram /var/tmp/deurbel.jpg | nc 127.0.0.1 1208

And enjoy pictures like this