WiFi Doorbell – Proof of Concept
It’s been a little while since I posted about my smart home journey because I’ve been pretty busy of late with other things (like my actual job), but rest assured that there has been progress – albeit slow.
As I mentioned before, I’ll be adding three microcontrollers to our smart home setup in various parts of the house. Each project is going to go through three stages: proof of
concept, prototype, and final product.
Today is our first proof of concept, and it’s going to test whether or not I can hook our existing doorbell up to WiFi.
Getting a notification when someone rings the doorbell was the first thing Flo asked for when I mentioned I was going to start making our home smarter, and I quickly set
about figuring out how to do it: happy wife, happy life.
Some initial ideas (adding a relay to the doorbell circuit) were fairly quickly dismissed, and so I came up with a piece of out of the box thinking that I’m actually very proud of.
I’ll be using magnetic switches, also known as reed switches, elsewhere in the house. In fact, we already have them on many of the doors and windows as part of our burglar alarm, and you may well have some in your house too. They work by opening and closing when a magnet is brought into proximity with the switch. My flash of inspiration came when I was thinking about how a doorbell works: an electromagnet pulls a hammer into one chime when the doorbell is pushed, and then a spring pushes it into a second chime when the button is released and the electromagnet turns off. So, if I put a reed switch next to the electromagnet then the switch will flip when the magnet
turns on. Genius!
Happily for me, our doorbell has two chimes: one in the main floor hallway, and one in the basement. I wouldn’t want to run cables up the wall to the chime on our main floor, but the basement one is the mechanical room so the aesthetic is really not a consideration.
Using a switch as an input for the NodeMCU is simple. Really the only thing to think about is that the digital input pins are “floating,” which means that if nothing is connected then the result you get from them is unpredictable. To account for this you use either a “pull up” resistor between the input pin and the 3.3v pin, or a “pull down” resistor between the input pin and the ground pin. I went for a pull down resistor between the input pin and ground, then put the switch between the input pin and 3.3v.
For the proof of concept I wrote some simple code to display the input pin state over the serial console, taped the reed switch place and, despite some protest from the dog, rang the doorbell a few times.
Next step: prototype.