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.
It works!
Next step: prototype.