Have you wanted to assemble a digital camera control panel, but were afraid of damaging expensive equipment? Why not use a photorelay which transmits control signals between the circuits without electrical contact between them?
This Nano Switch is based on Toshiba’s TLP172A photorelay. The signal from the microcontroller lights an infrared LED in the device. This light then hits a photosensitive transistor, which then closes the circuit. This connection type is called galvanic isolation.
Connect the blue wire to ground on the microcontroller and the red wire to a digital or analog signal pin. Connect the white wires to your load. The module uses two field-effect transistors which allows you to connect the opto-switch to the break of the switched circuit without worrying about polarity.