In this featured ESPHome project, I will be presenting another great creation from the ESPHome and Home Assistant community: A Home Assistant compatible video doorbell that doesn't rely on any cloud services or foreign servers. The backbone of this project is an ESP32-CAM.
The ESP32-CAM is a special type of ESP32 board which, as the name suggests, has a camera attachment. Just like most other ESP boards, the ESP32-CAM costs next to nothing. This allows makers to build low-cost security cameras and of course also video doorbells which integrate with Home Assistant. Thankfully, ESPHome supports these boards without any modifications needed.
Table of Contents
- What you need to build your own ESP32-CAM doorbell
- How the ESP32-CAM doorbell works
- How this project could be improved
What you need to build your own ESP32-CAM doorbell
This project uses a very specific ESP32 board called the LILYGO® TTGO T-Camera ESP32. It’s important you use this board, or a comparable alternative, for a project like this one for a few reasons:
- The camera has a fish-eye lens, giving you a wider field-of-view.
- There is a motion (PIR) sensor on the board itself.
- Though it’s not necessarily needed, the board has a small screen. And screens are always cool.
Come to think of it, the screen can be more than just a novelty. The obvious thing to do with it would be to display your name. But you could also let potential visitors or the postman know that you aren’t in and save them a few seconds.
- Microcontroller: Dual-core ESP32.
- Display: 128×64 OLED Screen (SSD1306).
- Camera: OV2640 with 2 Megapixel.
As the TTGO T-Camera ESP32 board has almost all the needed components for a video doorbell built in, working with it is effortless. The only thing missing is a push button, but that can easily be added. The push button is nothing more than a GPIO binary sensor which switches state when pressed. As you can use the internal pull-up resistor for the push button, there is no need to solder a physical resistor to any wires. The author of this project went with an illuminated button, so it can be seen in the dark.
You will also need a 3.3V or Micro-USB power supply for the ESP32-CAM board. Depending on the button you go with, you will also need a power supply for the LED inside it. The author of this project went with a 12V button. An alternative would be to use the 12V power supply and hook it up to a DC to DC step-down converter to power the ESP32 board.
Apart from that, you will need the usual equipment needed for electronics projects like this one. A 3D-printed enclosure houses both the ESP32-CAM and button of the video doorbell. You will also need to solder some wires to get everything working.
How the ESP32-CAM doorbell works
The author of the project has kindly shared their YAML code used for ESPHome. Once again, this code is a great display for why working with ESPHome is such a joy. There are only 118 lines of YAML needed to create the firmware for a completely DIY video doorbell. And because this is ESPHome, you can rewrite the YAML to suit your needs.
Many of the video doorbells functions are handled by the ESP32-CAM itself. When the button is pressed, the display will change from showing the person’s name to displaying the words “DING DONG”. It will also trigger a Home Assistant scrip using a homeassistant.service action.
The author has also shared their Home Assistant script, which is started when someone rings the doorbell. It will send a notification to a phone, flash lights, announce that someone is at the door on Nest speakers, and also save a snapshot.
The camera is easily configured, but depending on your board the pins might not be the same as in the provided YAML.
How this project could be improved
This project isn’t perfect. If your Wi-Fi were to drop and someone were to push the button, you wouldn’t know that there is someone at the door. Because it uses Home Assistant for all notifications, there is a single point of failure, and that is the ESP32-CAM’s Wi-Fi connection.
You could potentially avoid that single point of failure by somehow tying the existing doorbell in to the new one. You could for example use a relay to trigger the existing bell. That way, the ESP32-CAM could still notify you when someone is at the door without any Wi-Fi.