I have regular ding dong door bell. Recently I started playing with Node-red for home automation. One thing I wanted to do was getting notified of door bell rings when no one was at home. There are multiple ways on how to sense if door bell switch was pressed. I finally settled on a very simple way with minimum number of parts. Here are details...
First some basics of how a doorbell works..
Most of wired home door bells work on ~16VAC. That means to get 120VAC to step down to 16VAC, a transformer is used. When switch is pressed, it completes the circuit and converts 120VAC to 16VAC in transformer. That 16VAC then activates the electro-magnet in door bell, which uses the plunger to hit against a metal plate which then makes the sound.
In this setup, like any transformer, a strong alternating magnetic field is generated in transformer when switch is pressed. While heavy shielding and specially designed core is used to minimize magnetic field leakage, some of it still leaks out from unshielded parts. I decided on using this leaked magnetic field to sense if door bell switch was pressed.
One of easiest way to detect magnetic field is 'reed switch'.
As seen in above picture, a reed switch has two contact blades which touch each other when magnetic field is present. When they touch, they complete the circuit. When magnetic field is removed, the contact opens again opening the circuit.
I ordered cheap reed switches on flea-bay (10 for $1). They looked like this..
These switches were very flimsy. I broke one when handling. So I decided to add some strength to them. To add strength, I took a piece of drinking straw about an inch in length, split it in half. And used glue gun to seal middle part of reed switch in hot melt glue while keeping metal contacts exposed.
Now I soldered ends of this switch to a wire.
This switch then went near the transformer.
Then I covered exposed contacts with insulating tape on both transformer and reed switch to avoid any accidental contact.
Next step was bit more of a trail and error method to find right place where switch would trigger on press of door bell switch. I found it to be on about 1/8 of inch on right side of two contact screws on my transformer. Reed switch needed to be vertical to get best results. (You can test if reed switch triggered by using a multimeter)
Once I found right place, I put heavy tape on it to keep it in place.
Now rest was easy. Connected two ends of the wire to GND and one of GPIO pins of my nodemcu (which was already in garage sensing garage door status).
I set the GPIO pin to INPUT and high on bootup. That way the pin remained high in normal course of time. When door bell switch is pressed, it sends current to transformer, which in turn creates magnetic field, which then triggers reed switch, making the GPIO pin to get grounded and read LOW.
Nodemcu is configured to send a MQTT message whenever that pin goes low. That message is read on my node-red setup which then --
- takes a snapshot of my front door using my security cameras
- and then sends those pictures to my family chat group in Telegram messaging app.
The whole time from switch press to alert on phone with picture takes about 2-3 seconds.
Let me know what you thought of this project. I have few more projects which I did using amazon's dash button to detect mail. If there is enough interest I will post those too.