This article is going to show you how to convert your (existing) wired doorbell (also works for battery-powered chimes) into a smart, WiFi-enabled, doorbell. The essential components needed sets you back about $2, yes, that is correct, just two bucks. No soldering is required and you don’t have to be an electronics expert.
![Photo of the resulting DIY Smart Doorbell on my test bench](https://frenck.dev/content/images/wordpress/2019/08/diy-smart-doorbell-test-bench-1024x512.png)
Integrating your doorbell into your smart home is a very logical step to take. Making your doorbell smart, allows you to do cool things with it, for example:
- Turn the chime/bell off after a specific time, when the kids or you went to bed. Also, turn it on again in the morning.
- Send out push notifications to your phone/tv/watch/smart speaker, on the doorbell button push.
- Take a snapshot from a front door camera, on the doorbell button push.
- Stream your front door camera to your TV, on the doorbell button push.
- Ring the doorbell continuously in case of an emergency (e.g., smoke detectors triggered).
I have provided some of these automations for Home Assistant, as an example, at the end of this article.
The method I provide is, of course, not the only solution. However, I guarantee it is the cheapest out there and a great way to get into DIY. The feeling of having it made yourself is satisfactory beyond any other solution.
Are you curious yet?
How does a doorbell work; Before and after.
Before we start doing anything, let’s take a quick look at how a wired doorbell works. For this article, I am going to assume a wired and AC powered doorbell. However, battery-powered chimes are not that different, and I’ll provide instructions for that as well.
![Shows a regular doorbell circuit/wiring schema](https://frenck.dev/content/images/wordpress/2019/08/regular-doorbell-wiring-schema-1024x512.png)
A pretty standard doorbell set up has a power supply, hooked up directly to the chime. Prevent the doorbell chime going continuously, the circuit is interrupted by the doorbell button, which acts as a switch. The circuit is only active/complete when the doorbell button is pushed. Hence, your chime turns on when someone pushes the doorbell button.
![Shows an circuit/wiring schema for the DIY Smart doorbell](https://frenck.dev/content/images/wordpress/2019/08/diy-doorbell-wiring-schema-1024x512.png)
The image above should give you an idea of the result of this article. Basically, you are going to split your doorbell circuit into two separate circuits. One circuit detects the doorbell button push; the other circuit controls the chime. This split allows for controlling those separately, e.g., detecting a doorbell push from Home Assistant, without activating the chime.
The device we are using is going to act as a sensor for the doorbell button push, and acts as a switch for the chime. Effectively, we are moving the activation of the chime from the doorbell button, to the new device. Our new device needs power, and since the one used consumes 5 volts. Any old USB phone charger you have, does the job just fine.
Smart doorbell stuff you’ll need
To achieve this, you need some “stuff”. The $2 price tag is based on the actual device we are going to create, however, if you don’t have some of the needed tools, that would raise the total price. Nevertheless, the additional stuff is really cheap and are things that, in my humble opinion, every DIY home automator should have in their toolbox (for future projects).
Based on the country you are in, additional shipping costs may apply. I live in the Netherlands, and I’ve paid 1,80EUR in total, including shipping. Checking out the different sites for the right price helps. I’ve noticed the prices for these little boards vary, but getting it for around $2 is doable.
The main components
This project consists of just 2 parts. An ESP8266-based chip called the ESP-01S and a small board with a relay on it.
The nice thing about these two is that they fit together, are pre-soldered and often sold together. There is also another version of the ESP chip, without the S, the ESP-01. That chip is viable for use as well, however, the ESP-01S is an improved version and has double the amount of memory. Since the price difference is just a couple of cents, I would highly recommend getting the S version.
The board needs to be powered and requires 5 Volts. Lucky, most phone chargers provide those and I’m sure most of you have an old one around you could use.
That brings me to the shopping list of the main components needed:
- An ESP-01S
- The relay module board for the ESP-01(S)
- An old phone charger, delivering 5 Volts
Other tools and hardware
Besides the main components, you’ll need some other things for building it as well. Without a doubt, you need some screwdrivers and a wire stripper. A pair of tweezers can also help put wires to place, and for modifying to the board later on.
The ESP01-S chip needs to be programmed. To do that, you’ll need an FTDI adapter. If you have ever flashed ESP chips before (e.g., SonOff switches), you probably already have one. If not, you should get one! It is an essential tool to have when you are into home automation.
Additionally, some wire is needed. I always have a bunch of Dupont cables in stock. They are really helpful in many many projects I’ve done. It allows you to wire up prototypes really quickly as well.
Depending on where you are going to place the smart doorbell, you might be need a case as well. The resulting board is pretty small. Maybe it can already fit one of your electrical boxes. Another option is getting a small project box online, like this one:
Needed software
Obviously, you need some software to pull this off. All software used is open source and free for you to use.
Home Assistant is my home automation hub of choice, and for this guide, I assume you are using it as well. However, this project can be used on other hubs as well (like Domoticz or OpenHAB). I’ve added a section at the end of the article for more information about this.
Modifying to the ESP-01S chip
To make this setup work, you would have to make a small modification to the ESP-01S chip. Reason for this modification is that you have to free up an additional pin for connecting your doorbell button. These input/output pins, are called GPIO pins.
The ESP-01S has two GPIO pins available. Using the relay board, one of the GPIO pins is wired to the relay, the other is wired to a reset mechanism. Without this modification, a doorbell button push would result in a reset/restart of the chip, which of course, isn’t what we want.
Don’t worry, this modification is easy. We need to bend the GPIO2 pin from the ESP-01S. This allows you to access the pin for connecting the doorbell button, while disconnecting it from the relay board.
The lost reset functionality is later be restored via a software switch in ESPHome. Furthermore, the reset button on the side of the relay board isn’t affected by this and keeps working as a reset button as well.
Flashing the firmware on the chip
This project uses ESPHome to create firmware for the ESP-01S chip. I’m not going to make a full tutorial on how to set up ESPHome since that is really well covered on their website. So, before continuing, make sure you’ve set up ESPHome.
- Getting Started with ESPHome (for Hass.io users)
- Getting Started with ESPHome (when not on Hass.io)
Creating, building and downloading the firmware
Create a file called doorbell.yaml
; for Hass.io users, create the file in the /config/esphome
folder, so you end up with the file: /config/esphome/doorbell.yaml
.
Next, add the following contents to the file:
The above file shows a ESPHome project definition; the ESPHome project code, or also referred to as ESPHome YAML. The code describes the firmware allowing ESPHome to generate it. I’ve have tried to add as much additional text as possible to the above, to help you understand how it works.
On line 9 & 10, make sure to set your WiFi details or else you might end up with failures. Save the file and open up the ESPHome web interface; The doorbell project should appear!
Now, you should be able to validate, build and download the firmware from ESPHome. Let me show you a screen recording on how that works:
![Animation on how to validate, compile and download ESPHome firmware](https://frenck.dev/content/images/wordpress/2019/08/ephome-doorbell-validate-compile-download.gif)
Uploading the firmware to the ESP-01S chip
![Image shows my ESP-01S being flashes for the smart doorbell](https://frenck.dev/content/images/wordpress/2019/08/flashing-esp-01s-1024x512.png)
Now you have the firmware (the downloaded doorbell.bin
), you can start putting it onto the ESP-01S chip for use. This flashing procedure is the hardest part, and if you are new to this, please have some patience, it might need a couple of tries for you get it right.
Start with wiring up the ESP-01S chip to the FTDI adapter, using some Dupont wires. Don’t freak out now, we only need to do this once. Once you’ve flashed the chip, future flashing/upgrades can be done Over-the-Air (OTA) via WiFi. Wire the FTDI & ESP-01S according to the following wire schematic:
![Illustrates how to wire an FTDI adapter to an ESP-01S chip.](https://frenck.dev/content/images/wordpress/2019/08/FTDI-ESP-01S-wiring-schema-1024x512.png)
Ready to flash? Good!
Plugin the FTDI adapter to your PC, and start-up the ESPHome Flasher tool. Yes, I know, it is possible to flash directly from ESPHome itself, however, if you are like me: I don’t have the machine running Home Assistant near my desk. Furthermore, it can be quite a challenge for people running Hass.io on a virtual machine. The ESPHome Flasher is easy to use and just works from your desktop.
Select the available serial port, and load the downloaded doorbell.bin
file, by clicking the “Browse” button. Start the flash procedure by clicking the “Flash ESP” button. The console shows you the progress and tells you when it finishes.
![Animation on how to flash firmware using the ESPHome Flasher](https://frenck.dev/content/images/wordpress/2019/08/esphome-flasher.gif)
If this process fails, please make sure to check your wiring. A common mistake is mixing up the TX/RX wires between the FTDI & the ESP-01S. They should be cross-connected (TX -> RX, RX -> TX).
Installing and wiring your smart doorbell
Time to install your newly created smart doorbell. The following schema helps you to connect the wires correctly.
![This image shows how to wire up your smart DIY doorbell.](https://frenck.dev/content/images/wordpress/2019/08/diy-doorbell-wiring-schema-transformer-1024x512.png)
Please note, how the ground wire from the phone charger is shared with the push button. To hook up the push button to the bent GPIO-2 pin, I recommend using a Dupont wire, since you can slide it right onto the pin in that pretty tight space.
![Photo of GPIO-2 wired with a Dupont wire](https://frenck.dev/content/images/wordpress/2019/08/gpio2-dupont-wire-1024x668.jpg)
If your chime is a battery-powered one, the schema does not differ that much. Just act like the transformer is not in the above image. The two connections from the battery-powered chime, connect directly connect to the board (to the COM
and NO
labeled ports).
Done? Awesome! Pushing the doorbell button should now ring the chime already! So basically, you’ve now ended up with what you had already…
Now you can continue to configure your smart doorbell in Home Assistant, let the fun begin!
Integrating with Home Assistant
Welcome to the easier part of this guide. Integrating your new, self-created, smart doorbell with Home Assistant. Home Assistant will discovery it automatically. The only thing you need to do is to activate it and unlock a bunch of new entities for you to play with.
This screen recording shows how that works:
![Animation on how to integrate the DIY smart doorbell with Home Assistant](https://frenck.dev/content/images/wordpress/2019/08/2019-08-03-15.42.55.gif)
Home Assistant smart doorbell automations
At this point, you have a WiFi-enabled doorbell. Is it smart already? Not really…
Adding some automations to Home Assistant would make it really smart! There are many automations one could create with this. However, let me give you a couple of basic and useful examples.
Sending notifications to your phone
This little automation sends a notification to our phone when someone is at the door. We have Apple iPhones and watches, so those notifications would end up on our wrist as well, even if the chime is disabled!
Disable the chime during the late hours
I have two kids. Nothing is more annoying than the sound of the doorbell chime about 15 minutes after you’ve put them into bed π. This little automation will disable the chime during the late hours and enable it again in the morning.
Streaming the front door camera when someone is at the door
This little automation is useful if you have a camera pointing at your front door. If you push the doorbell button, it will send out the camera stream of your front door camera to your living room TV πΊ.
More smart doorbell automation ideas
- Disable the chime when you arm the alarm when home, indicating you went to bed.
- Use pressure sensors in your bed to turn off the chime when sleeping.
- Create a camera snapshot when someone is at the door, and send it out to your phone.
- Use the chime as an alarm bell as well, e.g., in case smoke or water leak is detected.
- Use facial recognition on your front door camera, to disable the doorbell for the ones you don’t want to open the door for. E.g., an unknown person or your mother in law π
- Prevent over abuse of doorbell pushes, by disabling it for a couple of minutes after it was pushed.
- Hook the doorbell chime active switch into your voice assistant, allowing you to say “Hey Google, turn off the doorbell”
Optional changes and modifications
There are probably a hundred variations on this approach I took, but that was not the point of this guide. However, some are worth mentioning.
Using the chimes’ power supply using a step-down
In my case, my doorbell chime is powered by 8 Volts (DC) from the transformer. While to voltage is too high for the board, I could have used a little regulator to “step-down” from the 8 Volts to the 5 Volts required by the board.
These “step-down” are available for around a dollar on AliExpress. However, since I have enough older chargers I could use, and do have a power outlet available in my utility closet (where the doorbell wires are at); I saved myself the extra buck π.
Using multiple doorbell buttons (e.g., front- & backdoor)
In some homes, there are multiple doorbells. E.g., one for the front door, the other for the back door. Mostly they are connected to the same chime. There are three ways to use this guide in those cases:
- Connect the doorbell push buttons in parallel to a single chip. This is fast and cheap, however, you cannot distinguish which button was pushed.
- Connect two of those boards in parallel to the chime. You would need two boards and one chime, however, you can still distinguish the doorbell pushed.
- Replace the ESP-01S and relay board with one of the bigger brothers. Those provide more GPIO pins. However, it would be more expensive compared to using just two of this project.
Using MQTT (e.g., for use with OpenHAB)
Are you not using Home Assistant? Really? Or maybe you prefer to use MQTT with OpenHAB, Node-RED or Domoticz. Well, you can use this project as well! ESPHome provides an MQTT interface.
For more information about using MQTT with ESPHome, refer to the ESPHome MQTT Client Component documentation.
This article is not about a smart doorbell…
I hope you enjoy your DIY smart doorbell! However, now the time has come for me to come clean. This article was never about the doorbell! This article is about showing you how easy, fun, and cheap DIY smart home solutions are. ESPHome & Home Assistant are just amazing tools to allow everyone to jump in and create amazing things.
The ESP-01S is an amazingly cheap and tiny ESP8266-based board, that is rarely considered or discussed nowadays. Mostly you’ll find articles and references to her big brothers; the ESP8266 and ESP32. However, if you need just one or two GPIO pins, it is a viable option.
Consider this: Replace “doorbell” with “bedside LED light” in this article… π€―. Anything with a switch and/or button can be replaced by this board (stay within the power limits of course).
But did you know, you can buy other module boards for the ESP-01S as well?
Did you build the doorbell? Nice! I love to see how you did!
Send me a picture of the result via Twitter!
../Frenck