Have you ever missed answering a guest that rang your doorbell just because you're in a part of the house that's too far to hear the doorbell chime? such as basement, closed door bedroom, or maybe you were watching TV or listening to music.
If like me, you have one or more google home speakers on several location throughout your house, this instructable may be what you need.
In this Instructable I'm going to show you how to add MQTT client to an existing doorbell chime to communicate to MQTT broker with announcement to google home / pushbullet, using NodeRED. This project does not replace the doorbell switch nor the chime. It still uses regular mechanical pushbutton for the doorbell.
We will add ESP-01 module into existing 16VAC doorbell system adding MQTT functionality to send message to MQTT broker (when doorbell switch is pressed). MQTT broker would relay the message to NodeRED. Upon receiving MQTT message, NodeRED would send announcement to multiple google home devices and also optionally send message to cellphone/browser via pushbullet.
I have a passion for DIY home automation, and slowly adding IOT to my home. Google home has been one of the central function in my home automation.
My son gave me the idea for this project when he asked me if I can make the google home announce each time someone rings our doorbell. We have 2 stories + finish basement home, and many times we couldn't hear the chime when we're in our basement or upstairs in bedroom with door closed or with TV on.
We have 4 google home mini in our house placed in various places/rooms, and by using google homes to announce a doorbell, we know immediately anywhere in the house if somebody ring the doorbell.
In my house, I use RaspberryPi ZeroW to host Mosquitto MQTT server and NodeRED. It has been running for over a year without any issue.
- Doorbell wiring diagrams: https://diyhousehelp.com/how-to/doorbell-wiring-d...
- Install Mosquitto MQTT Broker on Raspberry Pi: http://www.switchdoc.com/2016/02/tutorial-installi...
- Install NodeRED on Raspberry Pi: https://nodered.org/docs/hardware/raspberrypi
Step 1: Create the Circuit to Interface ESP-01 and Door Chime
The first step would be to create the circuit that would be the interface between ESP-01 and Door Chime. Typical door chime is activated when there is a 16VAC between the "TRANS(former)" and "FRONT/REAR" Pins as shown in my first photo. The voltage presents on those pins when the doorbell button is pressed.
The circuit that I designed is to sense this 16VAC signal and converting it to around 3.3VDC digital signal. It is a basic half-wave rectifier formed by D1 and C1. We don't need to have full-wave rectifier in this situation since there is very little loading to the DC output, saving us a little bit real-estate on the board. I want to make the board as little as possible so that I can place it inside my existing chime.
R1 and R2 forms voltage divider to bring down the peak DC voltage down to around 3.3V.
R3, TR1, and R4 form an inverter to provide reverse logic for the ESP-01 GPIO-2. This is necessary to provide logic HIGH during bootup (with the pull-up R4 and R5) for ESP-01 to boot from flash. When the doorbell pushbutton is pressed, it presents logic LOW to the GPIO-2.
TR1 can be any small power NPN transistor, in my case I used 2N3904.
The V1 is a 3.3VDC power supply that I built using an old 5V cellphone charger coupled with AMS1117 3.3VDC regulator that I will show in the next step.
For the ESP-01 socket, I use an 8-pin standard IC socket, and cutting the plastic bridges that create the gap between the rows, and then glue the 2 rows together.
Step 2: 3.3VDC Power Supply for ESP-01
In this step, we will be building the 3.3VDC power supply for the ESP-01. I have a few old 500mA and 700mA 5VDC USB charger adapter that I re-purposed for this project. We also need 3.3VDC regulator to drop the 5V voltage to 3.3V, for this I'm using a cheap pre-built AMS1117 based regulator module that I bought from ebay. You can search for "3.3V AMS1117 module" and find what works for you.
This 3.3V regulator module is very small that I can actually stuff it inside the original 5V USB charger enclosure making it safer from potential short-circuit. I removed the AC wall prongs from the charger module and replace it with two cables that will be connected to 120VAC from the wall behind my existing chime. But don't remove the prongs on this step until we do test run on the next step.
If there is a wall outlet nearby, or if you're not comfortable with wiring the power supply directly to house wiring, you can optionally just plug in the modified power-supply to the wall plug, and run cabling to the chime, though it may not look as clean as connecting it directly to house wiring.
See one of my photo to see that behind my chime is 120VAC wiring and the 16VAC transformer for the chime.
Output from the 3.3V regulator would then connect to the ESP-01 interface board according to the previous step.
Step 3: Flashing the ESP-01
In this step, we will flash the ESP-01 with arduino sketch. If you've never flashed ESP-01 module, you can follow my instructable to get you started: https://www.instructables.com/id/USB-to-ESP-01-Boa...
You can find my sketch in my github page: https://github.com/andyjawa/DoorBell_to_MQTT_using...
In the sketch, at the minimum you need to change the following information pertaining to your home network/setup:
#define MQTT_SERVER "10.0.0.30"
const char* ssid1 = "SSID";
const char* password1 = "MYSSIDpassword";
const char* ssid2 = "SSID1";
const char* password2 = "MYSSIDpassword";
In my home network, I have 2 different access point that broadcast 2 different SSID's, and this sketch would allow redundancy by connecting to the next SSID if the communication to the current AP is lost. If you have only one SSID, populate both ssid1 and ssid2 with the same value.
Once you made the modification, upload the sketch into ESP-01, and plug in the ESP-01 into the interface board.
Step 4: Test Run
From step 1 we have built the ESP-01 interface board, and from step 2 we have the 3.3V power supply for the ESP-01 board. We now connect the power supply output to the board according to the circuit diagram, shown as V1.
Now the next step is to connect the chime Trans/Door terminals to the interface board connections shown as "Door Chime Terminals". Since my chime is mounted high on a wall, for the test run, I temporarily run a long pair of cable from the chime terminals to the board so that I can plug in the power supply.
To test if our contraption works, the easiest would be to monitor MQTT messages in the network. To do that, you need to open an SSH session to the mosquitto broker and issue the following command:
mosquitto_sub -v -t '#'
The above command would allow us to see all MQTT messages coming into the broker.
Now plug in the power supply to wall outlet, and if everything works, in a few seconds you should at least see the following MQTT message:
Now head outside and ring your doorbell, and you should see this message:
If you see those messages, your project is a success.
I also included several useful MQTT topics in the sketch that you can use:
"stat/DoorBellInfo" : this message is sent every minute to provide uptime and other info.
"cmnd/DoorBellInfo" : ESP-01 will sends out info if it receives this topic with value of '1' (ascii=49)
"cmnd/DoorBellCPUrestart" : ESP-01 will restart if it receives this topic with value of '1' (ascii=49)
"cmnd/DoorBellCPUreset" : ESP-01 will reset if it receives this topic with value of '1' (ascii=49)
"tele/FrontDoorBell" : ESP-01 will sends msg in this topic with value of 'ON' if doorbell is pressed
Step 5: Integrating the Board and Power Supply Into the Chime
Now that we have our successful test run, we need to assemble the board and power supply inside our doorbell chime (if possible). In my existing chime, there is an empty enclosure that I was able to cut open and fit the power supply inside that space. The ESP-01 board doesn't fit inside that little space, but still fit inside the overall chime box. I just used a thick double sided tape to mount the ESP-01 interface board.
Now we can remove the metal prongs from our USB charger and replace them with thicker cable that we can connect to the house wiring. Be sure to turn off your circuit breaker that supply the electricity to the chime circuit.
If there's not enough space to fit our project into the existing door chime, you will need to put it into a separate box and mount it close to the door chime.
Step 6: Final Touch
Now that we've got the project working and able to publish MQTT message to broker, the next step is to think of idea what to do with that.
In my project, I use Node-RED to listen/subscribe to that doorbell MQTT topic and announce to several google home speakers. In addition to that, I also linked the flow to a pushbullet node to send notification to my android phone so I know if anybody rings the doorbell even if I'm not at home. Pushbullet notification not be useful to some, but It has been pretty useful couple of times for me, coupled with video camera on my front porch, I can see who came to drop deliveries (they usually rings doorbell). I can't rely much on the motion detection feature of the camera due to various interference, notably moving shadows of trees.
The image on this step, shows the Node-RED flow to accomplish this. You can also paste the flow from my github page into your Node-RED: https://github.com/andyjawa/DoorBell_to_MQTT_using...
Google home announcement is just one example for this project, but I think it's the most useful and practical. You can always interface to other MQTT listener, or even using IFTTT to drive other devices upon doorbell being pushed.