Main Content

Doorbell Notifier

Convert your existing wired doorbell into a smart doorbell, allowing for notifications, integrations, etc.

One of the first projects I tackled after getting back into microcontrollers was converting my wired doorbell into a smart doorbell. I wanted to simultaneously trigger the appropriate camera to record on a doorbell press (even if I was home) notify me on my phone (in case I wasnt home) and blink all of the smart lights in my house (if I was listening to music, etc.). Originally, I used Stringify to achieve this integration beautifully (it is now defunct) but have since moved to IFTTT which has allowed me to do most of the same things. I constrained myself to make no permanent changes to my existing doorbell setup: I both wanted to leave everything intact so as to annoy my wife minimally but still allow for the integration I wanted. Homemade optocouplers proved to work splendidly for reading the doorbell states and I was ultimately able to give the entire project a polished and professional look while making it suitable for a wealth of other microcontrollers.

My first (recent) microcontroller project turned me onto Particle Photons and got me looking for projects that would specifically benefit from having Wi-Fi functionality. Having recently gotten both security cameras and ‘smart’ lights, being able to have the doorbell trigger them seemed like a logical progression. As mentioned in the description, I didn’t want to alter my existing doorbell setup: partly for aesthetics/functionality but also as an added challenge. The first and primary hurdle was figuring out how to read the (relatively) high voltage AC that powers my doorbells.

A quick primer on wired doorbells: in the U.S., 12V AC is pretty common for powering them. (While I know in my case the transformer is rated for 12V, for whatever reason the voltage that each of my doorbells sees is actually 20V.) A quick google search will show you some diagrams for how things are typically wired. At each doorbell there are 2 wires (20V difference in my case). When the wires are shorted, the doorbell is activated. What this means, is that I needed a way to tell when the voltage difference between the 2 wires at each doorbell went to 0.

After doing a fair bit of googling to see how other people approached reading the state of a wired doorbell, I was surprised to find very little. I did however stumble upon a forum where someone was attempting to do this (or something similar) and optocouplers were recommended. The forum never resolved whether this worked for the original user but I decided to try it myself. (Optocopulers allow for signal isolation and simply consist of one side driving an LED and another side with a photoresistor reading the state of the LED.) While you can buy pre-made ones for quite cheap, I initially opted for making my own. I should also mention the fact that this would ideally be done with a DC power source on the LED side as AC voltage is constantly pushing and pulling or going high/low, so when directly powering an LED it will flicker (since they only allow current flow in one direction). In the US, this will be at a rate of 60 times a second. Not terribly noticeable to the human eye, but happening nonetheless. At the time I honestly didn’t know if it would meaningfully affect my use.

To test this, I simply took an LED and photoresistor from my parts bin and faced them towards each other, held in place and covered by black electrical tape (being careful to avoid shorting any of the wires). Wiring each up as you normally would (with the LED being driven by the doorbell wiring and the photoresistor being driven by the microcontroller), I was able to read the voltage on the photoresistor side with a multimeter and compare the pressed and un-pressed states. Somewhat to my surprise, my homemade octocoupler worked quite well: I was able to see very clear differences between the two states. Subsequently, I wired in the microcontroller and arranged things so that I got a ‘high’ state when the doorbell was un-pressed and a ‘low’ state when it was pressed. While there was definite variation due to the AC voltage, my photoresistor seemed to lag enough that it stayed pretty constant.

Fast-forward a little further and I was able to wire things up inside the house, connected to the wiring for both doorbells. I put it in a project box (but left it all on a breadboard) and put together some simple code to send Particle Publish commands when either doorbell was rung.”

Link to article