# How do I safely connect a light switch button to the secondary side on a board?

I designed a special light controller board. It has a primary side that is connected to AC 230V. There are a certified AC/DC converter module and a relais, bridging the air gap between the primary and secondary sides.

On the secondary side is a microcontroller and various sensors running at DC 5V. The microcontroller controls the relais wich switches the light on the primary side. See the following abstract layout of the board:

In the next version, I would like to connect the button of a light switch to add some manual control. The button press should be received somehow by the microcontroller.

Which component/method do I use to safely connect the button to the secondary side? Note that it is a light switch. The wires are not connected to the AC power, but they run along the AC wires. By law, there has to be an insulation between them and the low voltage side. E.g. in case of a short, there is suddenly 230V on this wire.

• Please edit your question to explain how you want the switch to work. Do you want (1) relay OR switch (2) relay AND switch or (3) button to change the state of the relay. – Transistor Nov 3 '19 at 21:04
• I added more detail. The shown relays is switching the light at the primary side. The button is also on the primary side, so I have to protect the secondary side in case of a short on the primary side. The microcontroller on the secondary side can process the button press in any possible way. – Flovdis Nov 3 '19 at 21:15
• What is the switch connected to that forces it to be connected to your board on the primary side? – The Photon Nov 3 '19 at 21:21
• It is a light switch. The wires are not connected to the AC power, but they run along the AC wires. By law, there has to be an insulation between them and the low voltage side. E.g. in case of a short, there is suddenly 230V on this wire. – Flovdis Nov 3 '19 at 21:27
• I guess one option should be coupling a pulse or waveform generated on the isolated side to the switch and back via two Class Y capacitors, but I'm not familiar enough with the safety requirements to propose that as an answer… – nekomatic Nov 4 '19 at 13:06

For that you would need an isolated DC/DC converter and galvanically isolated transceiver - maybe an optocoupler.

Perhaps, more easier is to use just an optocoupler with few resistors or capacitors and use 230VAC directly for the switch supply.

simulate this circuit – Schematic created using CircuitLab

Similar question : Link

• Thank you! Just a sidenote: There are complete but expensive solutions for this like the HCPL-3700 optocoupler series. Using of of these, you do not need any additional components. – Flovdis Nov 4 '19 at 20:22

Just use a small transformer 125/5 V.

The primary side connects to the light switch, using wires that can run in the same conduits as other house wiring.

The secondary side connects to your microprocessor board.

• This is more of a comment than than answer. You may wish to expand on how and why. – Puffafish Nov 4 '19 at 8:26
• I just updated my answer to change from alleged comment-style to proper answering mode. The schematic diagram is pretty obvious, so I will spend my time looking for other questions to answer :-) – Roland Nov 4 '19 at 12:03