I have a switch that works at 220-230V AC and I'd like to link it to my Raspberry Pi and I want to know what I have to do from an electrical point of view.
So my switch, when switched on, places 220V AC on a wire, which somehow I'd like to transform it to 3.3V DC so I can react from software when the switch is on.
I should mention that the switch may stay switched on or off an indeterminate period of time (which of course I will handle in software) and I wouldn't like to damage my raspberry.
How do I do this? Is a transformer the solution here?
Make sure the power supply has isolation from mains
? \$\endgroup\$