Electrical – How to isolate the following relay circuit from mains

relay

How to isolate the following circuit from mains or safely send a 5V signal from RPi to turn the relay on? I currently have a 5V signal going into the IN pin of the relay board and RPi ground to the GND pin of the relay board and it works. Is it safe even if I remove the 1.2V battery. I’m not very experienced with 220V AC.

enter image description hereenter image description here

Best Answer

The relay's coil and the switch already provide proper mains isolation. However you power the relay via a non isolated supply. It is a "capacitive dropper" circuit which is not isolated. Connect it to your RPi and your RPi will then become mains live.

If you want to keep the powering of the relay the same (i.e. non isolated) you will need to either use another relay (there are relay modules for RPi) or an optical isolation module. Then that module will provide the isolation. The circuit that you show does not provide any mains isolation. The reason that the relay is there is to switch a large current, not to provide any isolation.

I’m not very experienced with 220V AC. Then educate yourself on the subject before messing with circuits at mains voltage. Even seasoned professionals treat mains voltage with respect and so should you.