Electronic – How to safely interface 220VAC in a PCB


I am making a PCB circuit that detects the state of a mains voltage switch. Now since I am dealing with mains voltage a lot can go wrong and a lot can go wrong badly so I would like to ask for some advice on how to properly deal (and might even use standard practices) with mains voltage on my PCB.

My circuit takes advantage of an unused "throw" pin of the switch, which I can use to detect the voltage. I plan on using an AC input optoisolator (could not find an AC input model for the schematics) to fully isolate my electronics from the mains voltage. There will be several of these detector circuits in a single PCB, the number will range from maybe 5-10 depending on how much I can fit in.

So what I would like advice for are:

  • What would be the thinnest trace I can go for the mains voltage, and also the the distance between traces? (1oz copper)
  • What would be the best/safest connectors both male and female for this application.
  • Is it okay to share the neutral line for all the detectors to reduce the wire connecting to the board?

enter image description here

Best Answer

Low consumer quality boards are done like this.

enter image description here

Since dust and moisture accumulation causes greatly reduced breakdown voltages down from 1kV/mm, it is far better to have an air gap milled in the board between primary and secondary of the Opto.

enter image description here

However , your external schematic is nonsense with Line Neutral and switch going to LED.