Using a relay module. (and a full bridge rectifier to convert ac to dc and mini voltage regulator)
I was checking a tutorial using the last option and I found a tutorial that use a relay, but judging the schematics and my limited electronics knowledge I'm not sure whether it's safe to connect the output of the wemos to the output of the doorbell (red line). Shouldn't be the case that those in the ground will be connected together (black one from the doorbel) instead. I understand the logic behind those connections as the relay is inverted, so that's why is the ground connected to the input, but I'm trying to understand if it's safe to do the connection as showed.
What I have done is put 4 diodes wired as two in series back to back with the other two .Across that I put a small resistor in series with an led .
When the bell ring the led lights . The whole is wired in series with the bell Circuit .
The diodes allow conduction in both directions but drop enough voltage to power the led .
I put the whole in a tube with an LDR connected to my Arduino. - so I had an isolated digital input from the bell .
It's not mine, actually as I stated in my post, that was something I found online. The yellow line correspond to the mechanism to open the door. The red line is the bell, and the black line is the ground of the doorbell.
I don't have any code as my doubt was if the schematics were correct in that case scenario. I don't worry that much about code as I'm more proficient in that. But the electronics of that case it what I'm not sure about.
In the relay circuit above the red line from the bell appears to be powering everything? Unlikely that the bell is 5v, and possible that the bell is running on AC... so not sure how this would ever work?
If I understand what is being attempted...
RELAY 1 - triggered by LOW signal on the doorbell line. Won't work as there is no common ground between the relay module and the door bell.
RELAY 2- triggered by the Arduino (LOW on D8), and provides either +V or GND to the yellow line connected to the terminal block. But, if the V+ is coming from the door bell it will only be HIGH while the button is pressed.
Also implies that the Arduino and door bell have the same 5v DC signal voltage. I would not use that circuit.
The one with the optocoupler looks more suitable, or as per the original video use an AC current sensor.
The board is powered through micro usb. My problem is exactly with that red line and the +V. In theory (not my case) the bell is powered by DC not AC. But even if I convert to DC using a full bridge rectifier I'm not sure about that solution. The main reasoning mentioned in the source (video) for using that +v connection instead of ground is that is an inverted relay.
The first relay is activated through D8 and is used to open the door. So that part of the circuit is actually correct.
The second relay is the one used for detecting the pressed doorbell (violet and yellow connection)
Anyway, thanks for the answer and sorry if I didn't explain myself well enough. I was really curious about that solution because something didn't seem right to me.