I have a Ding Dong Door bell which operates directly on 220-230v AC. I would like make the notification smart. The bell will continue to run as it is today, there will be a parallel circuit that will be taking care of the automation and notification via HA. I am thinking to do something like the one I am showing below. Will this work with a relay or SSR? Can we replace the relay/SSR with a transistor as a switch?
Not sure connecting 220V to the PM01 will do what you want.
Assuming pressing the button closes the circuit, your ESP will only be powered when the bell is pressed.
A relay is also not what you want.
You probably want:
Independent power supply for the ESP (or parallel but before the bell)
an optocoupler to detect when the button is pressed, i.e. when the circuit is closed.
Thanks for replying on this. Yes, I am powering my esp with separate +5v via mobile charger for faster response as well as the d1 mini getting corrupted when we have abrupt power on/off. While waiting for suggestions, I was trying with a 5v relay in my bread board setup without the door bell. I have found the relay only triggers if it receives the input from D1 mini and not by providing +5v as its input. Lesson learnt. Do you have any recommendations on the optocoupler component?
Thanks for the link. I have used the above mentioned model for another circuit. I could find 2 challenges with this component.
This circuit works in reverse logic. That is when the AC is ON, the voltage is zero in the DC side and when the AC is OFF, the voltage is higher in the DC side. Not sure how to use this with the Binary sensor which I have used to trigger in the yaml above.
The logic is bit slow when the AC is applied and removed. Since we have a bell switch which is momentarily pressed and released, esp will be able to sense it?
I have tested the above given yaml and automation in HA without the relay part. If I connect the D7 (GPIO13) to ground, the automation is getting triggered. So we need a way to ground the GPIO13 via electronic switch that operates on 3v or 5v. We will get this 3v or 5v from the Mains via HLK-PM01.
Will it be OK, if we use NPN transistor as a switch which will be fast enough to trigger? If so do you have any recommendation with the transistor circuit?
If I am right, a transistor can be used as switch. I am trying to find out whether we can use a NPN transistor connected between the GPIO13 and Ground is a possibility. Pardon me, if that is not possible.
Thatâs why I am trying to provide the DC input to TTL transistor connected with Hi-Link HLK-PM01 that will give us the 5v DC output from 220v AC.
I will go with your suggestion. I will connect the AC side of Optocoupler with Phase and Neutral.
At the optocoupler DC side, the vcc to D1 mini 3.3v, out pin should be given to A0 of D1 mini and the ground to common ground on the D1 side? Is my understanding correct?
D1 Mini ---- Optocoupler
3.3v ---------- VCC
A0 ------------ Out
Gnd ---------- GND
I have reconnected my breadboard with different set of jumper wires this time. I have powered the 5v relay +ve and Gnd from D1 mini itself. I have connected the AC converted into DC via a wall charger +5v to IN1 of the Relay 1. Gnd is connected to D1 mini Ground. There is an automation job setup to trigger a audio notification. I can confirm this is working as expected. Thanks to Chris for sharing his views.
alias: Dev - Smart Bell Notification
description: ""
trigger:
- platform: device
type: turned_on
device_id: 3c550268c2941f395822129e29e0ebb2
entity_id: b7fa1a3b7be0c3698d9d7dcf025e178e
domain: switch
condition: []
action:
- service: media_player.play_media
data:
media_content_id: http://xx.xx.xx.xx:8123/local/sounds/airplane_chime.mp3
media_content_type: music
target:
entity_id:
- media_player.jukeboxonrpi4
- media_player.jukeboxonrpi5
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: media_player.media_stop
target:
entity_id:
- media_player.jukeboxonrpi5
- media_player.jukeboxonrpi4
data: {}
- service: tts.google_say
data:
cache: false
entity_id: media_player.jukeboxonrpi5
message: "Hi, There is someone at the Main Door. "
language: en-in
mode: single
This gets complicated by the fact the the doorbell button completes the circuit of the power source in series with the doorbell solenoid. ref.
In the USA we have a step down transformer to 24V-AC to drive the doorbell. You probably do, too because itâd be a little risky to run 220V to a place where someone is pushing a crappy button.
Hereâs an idea. Power the esp8266 independently. Use a current sense device. This is as simple as wrapping a wire, many times, around one of the wires that is part of the button/solenoid/power-source circuit. The ends of this sense device wire, with a series resistor, go to the input of the opto-isolator. It will take a bit of experimenting to get the number of wraps and value of the series resistor.
The output of the opto-isolator will be a 50 (60?)hz square wave. Software on the esp8266 could figure out âif this square wave exists the door bell button is being pushedâ to prevent multiple triggers. and âonly notify if a notification has not be sent in the last x secondsâ
I use Tasmota and C++ (Arduino IDE) on the esp8266. Tasmota has an easier interface to Home Assistant, but C++ is easier to program.
I know it could be the safest way of operating the doorbell giving the DC side of the switch for someone to press. However, in my part of geographic its 220v AC directly given to a coil that produces electromagnetic induction that pulls a plunger. You can find a video posted by a youtuber here.(I know how he is handling the cables directly with AC voltage and risk associated with that when the other wire is open circuited via the coil). In my case the operating switch is already having 220V AC even today. I have taken caution and put a high quality switch there to avoid any electrocution.
Back to this automation, With the circuit I have shared above, there is a Hi-Link AC to DC converter that will be placed before the D1 mini. The D1 mini and 5v relay module (with optocoupler) will have separate DC power that is connected to my UPS and will not be sharing the power with the Door bell. With the optocoupler already in place, any short circuit in the Hi-Link may not be impacting the D1 side of the circuits. This way the door bell will function without any interference with Automation (as it is today). I may use the automation that I am discussing here to take a snapshot via a camera placed near to my door bell switch using HA automation in future.
This is how I did it from my AC doorbell using optocoupler. AC doorbell to DC to 433mhz device My Doorbell used 18V and I didnât fancy running a esp off it so I modified a 433 door sensor. It has worked well.
A very simple and safe way to detect electrical AC current in a wire is to use a âCurrent Switchâ like the one linked below. You can then simply enable the internal pullup on the ESP8266 Digital GPIO pin, connect a wire from that pin to the dry contacts of the current switch, and then connect another wire from the ESP8266 GND pin to the other dry contact terminal on the current switch.