Is it ok to place 220V AC traces on my Arduino PCB?

Is it safe in theory? Yes. Is it safe for you? 100% not!

Other answers have focused on technical details of what might be required for safety. I'm going to take a step up from there.

As other answers have made totally clear, you don't have any experience whatsoever with higher voltages and currents. You don't even have the electronics experience to recognise that you don't know this, or to recognise where those risks are. There's a basic principle at stake here. If you can't recognise what a dangerous situation looks like, you shouldn't do it.

Just to be clear, the risk is that you kill yourself, burn the house down, and kill your entire family. This is not hypothetical - sadly it happens regularly as a result of incompetent amateurs playing with mains electricity. Do you genuinely want to murder your family?. If the answer is "yes", there are more guaranteed ways to do it. And if the answer is "no", as I hope it should be, then stop work on this right now.

Of course you can upskill yourself. If you read the appropriate books to learn how to do this safely, then that's fine. SE is not a resource which can teach you this. Other answers can actually make this worse, because they may give you the impression that if you do what they say, you'll be OK. You won't be.


The important thing is not so much track width (which must be rated for current, not voltage) but track spacing. See Clearance and Creepage.

For example, if you rotate the relay 180 degrees, you can keep the coil driving pins closer to the Arduino and not have to route them so close to the mains. You might also consider putting low voltage and high voltage on the opposite sides of the PCB.

(do you have enough power from the Arduino for that relay coil? Do you need a flyback diode?)


You will destroy your Arduino if you try to drive your relay coils directly with a digital pin. (Note that some "Digital" relay modules are made to be driven from a logic-level signal. These have built-in transistors and flyback diodes, and are therefore ok to drive directly with a Arduino digital output. They take 5V power as well as a logic-level control signal. {There are also 3.3V versions.} Here is a link to a typical "digital" relay. If you're using a "naked" relay, those are NOT ok to drive directly from a digital pin.)

First, a relay coil almost certainly draws more than the 20 mA that an Arduino pin can source.

Second, inductive loads like relay coils exhibit a property known as "back-EMF", where when you disconnect them from power, they output a large surge of current backwards from they way they were powered. The back-EMF will almost certainly burn out the digital pin, and could destroy the entire board.

You should drive your relay with a transistor (a MOSFET with logic-level gate voltage is an excellent choice) and you should protect the transistor with a "flyback diode" (A diode wired in parallel with your relay coil, reversed from the normal flow of current.) Search on "flyback diode" for info on picking the right sized diode. (You want a power diode, not a signal diode. Signal diodes can't handle the current needed.)

As others have said, you should take care to isolate your mains traces from your logic-level traces. You want enough space on the board for proper isolation. You should try to design your board so the mains traces are on one side and the logic level traces are on the other, with a wide blank space between with nothing on it.

You also need to make sure the traces are wide enough to carry the current you need, with a little buffer.

Tags:

Pcb Design