Hello, I need some advice from the electronics professionals among you.
Unfortunately, I have too little knowledge about it.
The following drawing should represent my circuit.
The optocoupler from Ali.
I would like to use the Sonoff (Tasmota/mqtt) and a wall switch to set up a changeover circuit. The optocoupler sets GPIO14 to low when the wall switch is pressed. Then the Sonoff toggled the signal to the relay.
Basically, my setup is already working. Unfortunately, only for a certain time. Then the circuit begins to spin. Makes his own operations. Sometimes even half an hour is fine.
Lamp on - Lamp off - Lamp on - Lamp off…
I had already tried with an electrolytic capacitor of 0.1mF between GND and OUT. But even this did not improve noticeably. Without a capacitor, the circuit sometimes remains stable for several minutes. But unfortunately not forever.
Can someone tell me what makes this circuit stable?