Hello very bright people,
I am setting up a doorbell/ESPHome integration. I have had a look at Frenk’s webpage DIY Smart Doorbell for just $2, no soldering required » Frenck.dev but this setup is a little different from mine.
I have a 12V AC circuit generated from the 240V mains.
The 12V AC circuit includes the transformer, the doorbell button and the doorbell connected in series. When the button is pushed, the doorbell rings.
I would like to insert a sensor into this circuit so that when the circuit is live (ie the button is pushed) a wifi signal is generated and received by my Home Assistant set up.
So far I have tested a buck converter (https://www.aliexpress.com/item/1005004858974373.html?spm=a2g0o.order_list.order_list_main.65.27ea1802jZpBM7) and this will generate a 3.3V DC output when the 12V AC power is connected to it.
I have an ESP32 microprocessor. Having read the ESPHome pages, I think that the additional programming I will need to add to the standard ESP32 set up will be:
binary_sensor:
- platform: gpio
device_class: power
pin:GPIO4
name: “Doorbell”
I will put the buck converter into the 12V AC circuit and when the button is pushed, the circuit goes live, the 3.3V DC hits the ESP32 and it tells my Home Assistant that the doorbell has rung.
My questions are (and please note I am way down the food chain in electronics and programming):
-
Is it best to put the buck converter in parallel with the doorbell or in series (I suspect the former because I don’t want to reduce the voltage to the doorbell, or the buck converter for that matter).
-
Do I need to put a resistor between the buck converter and the ESP32 (and if so in parallel or in series?) to protect the ESP32 from the power that could be generated from the buck converter. If so, is there a calculation I need to do to work out the ohms needed and do I have to find out what the maximum power output of the buck converter could be?
Any other advice would be very welcome! I think I will be ok with the automation once the message hits my Home Assistant.
Thank you very much.
Hello papasierra,
I had a few thoughts I wanted to pass along…
-
It would be best to parallel the 12VDC input to the Buck converter from the stepdown transformer. By doing this the ESP32 could expect a 3.3V signal (high input) from the converter as a ‘normal’ state when the button is not being pressed. When the button is pressed, I would expect the voltage to momentarily drop. The problem with this arrangement is that the voltage drop may not be clear enough to the ESP32 to be seen as a true low input: see number 3, below
-
At the very minimum, I would install a series resistor between the Buck converter and the GPIO pin of the ESP32 to limit the current. To figure out the size of resistor, use Ohm’s law (V=I x R) and plug in the known values, 3.3V = 40mA x R, then solve for R The voltage being used is 3.3V and the maximum current rating of ESP32 GPIO pins is 40mA. 3.3V/0.04A = 82.5 Ohms. This is a non-standard value for resistors, so I would round up to 100 Ohms for ease of sourcing parts.
-
For this project to work reliably, the ESP32 needs to be completely certain when the button is pressed by seeing a low input (ideally 0V but less than 0.8V). I’m not certain this will be achieved since the pressing of the button will be different every time - some periods longer than others. This may require more circuitry to deal with these problems and may lead to frustration.
The Frenck setup you referenced ‘splits’ a traditional doorbell circuit into two segments by placing the button on a circuit that interfaces with the ESP board via GPIO for one segment, and a relay to mimic the button on the normal ‘bell’ circuit. This setup eliminates the ‘interfacing’ issue pointed out in number 3 above. My recommendation would be to follow the Frenck project and save yourself a lot of trouble.
Hi Dial tone,
Thank you for your very helpful advice. I will see how far I can get with this.
Cheers
Update: In the end I decided to use a CT clamp to measure the change in current through the bell cable. The ESP32 is powered from a normal 240V plug.
This eliminated any risk of burnout to the ESP32, and it made the project more simple.
I have used the board below powered from doorbell transformer with a bride rectifier.
The board has optocoupler that I have used to read 12VAC voltage when doorbell button is pressed. Also used NO contacts of the relay to be able to disable the doorbell when I don’t need it.
The result is I kept old doorbell but made it smart using below board.
https://a.aliexpress.com/_mtlbmgM