04 / Blog

ZigBee Doorbell Sensor with the ESP32-C6

My doorbell is old, analogue, and absolutely reliable. Someone presses it, a buzzer shrieks, done. The problem: I can’t hear the bell when I’m wearing headphones in my home office or sitting in the garden. Instead of swapping the whole bell for a smart version, I just wanted a notification on my phone.

The idea

Doorbells usually run on 8 to 12 V, 9 V in my case. When someone presses the button, current flows. So I don’t need to touch the wiring at all, I only need to detect whether voltage is present. To do that I clip a tiny voltage sensor in parallel with the bell and read it with a microcontroller.

Hardware

The parts list is short:

  • ESP32-C6, which already has ZigBee on board natively, so no extra module needed
  • Voltage sensor board for about €0.50, essentially a voltage divider that scales the bell’s 9 V down to an ADC-friendly 3.3 V

No relay, no circuit tinkering. The ESP32 runs off an old phone charger.

The actual trick: the firmware

I didn’t want to write my own ZigBee cluster for doorbells, so I repurpose the ZigbeeOccupancySensor from the Espressif library. Home Assistant sees it as a binary sensor (occupied / clear), and that’s exactly what I need.

The ADC reads the pin, and a threshold decides whether the bell is ringing.

The complete sketch, including pin configuration and a factory reset via the BOOT button, is available as a Gist.

When flashing, there are only two things to remember in the Arduino IDE: set Zigbee mode to ED (End Device) and choose a suitable partition scheme. Otherwise the ZigBee stack won’t even start.

Home Assistant

After pairing, the sensor shows up in HA automatically. The automation is about as simple as it gets: the sensor switches to on, notification to the phone.

Conclusion

Under an hour of work, under €10 in materials. ZigBee runs more reliably than a Wi-Fi solution would: no Wi-Fi password in the code, and after a power outage the ESP32 reconnects on its own.