Smart doorbell done differently

Noticed a number of projects to make your old-fashioned doorbell smart, but typically these use relais so when your component fails, your bell stops working alltogether. Therefore I took a different approach:

  • I am using a bell transformer which creates a 8V AC, when the knob is pressed, this will ring the bell
  • I take the 8V AC for the ringer - where this 8V will be there only when the bell is ringing. Then use a diode rectifier, a condensor, some resistors and a zener diode to transform this into a 3.3V pulse which is put on an ESP-01s on its Rx pin. Works flawlessly!

Below the scheme and the yaml.

esphome:
  name: doorbell-detector
  friendly_name: Doorbell

esp8266:
  board: esp01_1m   # adjust to your ESP-01S variant (e.g. esp01_1m or esp02)

# Wifi settings (use secrets.yaml, never hardcode passwords)
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

logger:
  # logger only transmits on TX, RX is not used by the logger
  # once GPIO3 below is declared as a gpio pin, it's free to use as a digital input

api:
  encryption:
    key: !secret api_encryption_key

ota:
  platform: esphome
  password: !secret ota_password

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO3      # = RX pin, not a boot-strapping pin, safe to use after the one-time flash
      mode:
        input: true      # no internal pull-up/pulldown: R3 on the schematic already handles that
      inverted: false     # HIGH when the doorbell is pressed (as in this circuit)
    name: "Doorbell Pressed"   # ESPHome slugifies this into entity_id binary_sensor.doorbell_pressed
    id: doorbell_pressed        # internal ESPHome reference (for lambdas/automations within this yaml)
    device_class: sound            # gives an on/off display instead of open/closed
    filters:
      - delayed_on: 20ms   # small debounce margin (in addition to C2 on the schematic)
      - delayed_off: 50ms
    on_press:
      - logger.log: "Doorbell pressed!"

  - platform: status
    name: "Doorbell Connected"
    entity_category: diagnostic

sensor:
  - platform: wifi_signal
    name: "Doorbell WiFi Signal"
    update_interval: 60s
    entity_category: diagnostic

  - platform: uptime
    name: "Doorbell Uptime"
    update_interval: 60s
    entity_category: diagnostic

text_sensor:
  - platform: wifi_info
    ip_address:
      name: "Doorbell IP Address"
      entity_category: diagnostic
    ssid:
      name: "Doorbell WiFi SSID"
      entity_category: diagnostic

  - platform: version
    name: "Doorbell ESPHome Version"
    entity_category: diagnostic

Post a picture of the device please.

While an esp-01s is cheap and may be considered disposable, I would feel better with using an optocoupler (pc814/ pc817, with a resistor (~330 Ohm for 8 VAC) matching your input voltage (and maybe a diode, e.g. 1n4148) here.

But, there are many ways to skin a cat (I used a zigbee based water sensor (running from batteries for over two years already) as dry contact with a reed contact tacked to the traditional bell/ gong coil - why, because the location around the bell doesn’t easily give me an option to power an esp8266/ esp8285), your approach will work as well.

In my setup I have the optocoupler replacing the reed switch of a 433mhz if a battery operated door sensor. So far 18 months on AAA. Couldnt get reed to work reliably with the coil.

Here is a picture of the device.

I also looked at the optocoupler option, but since the transformer is a safe device, that is not really necessary. And with the zener diode the voltage on the ESP will always be 3.3V, so this will not ruin the ESP..

Why not using a AC relay parallel to the ringer?

Using an AC relay paralel to the ringer sounds like shooting a mosquito with a cannon to me…

There are also little mosquito cannons :wink: