Mains AC on PCB?

Hello! Dangerous (deadly) combo here, I am a complete noob at hardware engineering, this is one of my first PCBs, and it happens to have household AC on some nets. I’m really hoping to clarify some things, see attached picture for reference. I have laid it out best I can to separate the low voltage digital traces on one side, and the thicker ones are AC.

  1. How far do AC line and neutral traces need to be separated from digital traces?
  2. How far do AC line traces need to be separated from AC neutral traces?
  3. How thick should the copper be for AC traces?
  4. What should the width be for AC traces?
  5. For all above questions - Is there a document I can reference (I am in the US)?
  6. Like I said- total noob, if there are any other glaring issues with this board I’m not aware of, I would certainly appreciate to hear it! For example, I often see polygonal planes of copper in people’s designs, and I get that can be easier to manufacture, but I don’t know if I should be doing that-- and the “route tracks” tool seems to steer me away from it.

My gosh be careful!!! I am a semi-retired power supply design engineer and I used to design AC/DC power supplies for many years. While power supplies (are you designing a power supply or something else?) routinely put AC (non Safety Extra Low Voltage) onto the same board as SELV circuits, I do not recommend doing it without careful guidance.

UL and IEC standards are not free although I guess they may be available through some libraries. Here are a couple of references:

1 Like

I have a bit of interest in this topic as well, as two of the boards in my current project have some exposure to AC mains voltage.

On the power supply board (which will use SMPS modules), I at least made sure the AC traces are on the front and the DC on the back, the better to limit exposure to mains voltage. I also arranged the AC traces so at no point do either side’s traces overlap (and the relevant pads will be insulated once assembled).

Do you think that approach will work?

The other board I still need to establish the boundary of the ‘exposed’ portion of the circuit, so I can take extra care in the layout of that part of the board.

1 Like

Here in Germany (230VAC) the simplified (!) rules were mostly:

AC to AC: Your own responsibilty to ensure functional-insulation and avoid fire !
AC to Earth: “single Insulation” required
AC to user: “double Insulation” required

So what is single or double ?

Traditionally single meant 4mm on a PCB and double therefore 8mm.
But this refers to “normal” environmental conditions ! You have to refer to an official specification to be sure and for commercial products a VDE (similar to your UL) approbation is mandatory.
Consulting the VDE will also lead to testing requirements. An Insulation between AC and user will have to be tested with 3750V minimum - but this also depends on environmental conditions…

There is also “cheating” by milling between Tracks, then another set of rules for Air-Distances instead of creeping distances applies.
Generally any countermeasure can be a single insulation if the VDE accepts it.
And you should also be aware that a PCB-Layer thickness is not necessarily an officially accepted insulation !

The result is: if you are designing things other people will use you have to study the local laws and regulations and pay (a lot) for an approbation !
In any way try to get insight into the regulating documents (sometimes Books are available - from old times)

You should also take care that ALL AC components are specified and approved for line voltage. I have seen MLCCs acting as an oven, sucking and burning the liquified epoxy out of the PCB for days !

Thank you and all for your informative responses!

Not good news in terms of expensive testing and regulation materials you have to pay to read!!

This is not a power supply, it is a certain kind of smart light switch. I’m kind of at a loss, if I want to bring this to market, or any inventor with a device using AC current, how would I do that without being a company with a lot of cash to get these regulations and certifications?

There are many free resources that can help you even without paying for the standards.

The basic distances and techniques used to keep sufficient clearance between HV and LV signals are available publicly.

Here’s a neat calculator:

If you enter the inputs correctly, this will give you the minimum requirements according to the standards listed on the page. Feel free to go way above them where you can.

Milled slots on the PCB are commonly used to increase isolation by increasing the creepage distance (distance along a surface between conductors). Another calculator:

I will second what @chris9 said: after you consider the PCB layout itself (spacing between copper traces, milled slots, etc) you also need to consider every component that will touch the high voltage, and make sure it is properly rated with enough factor of safety.

Of course all of this must be done at your own risk, and with plenty of research. But it’s definitely possible to do the research as an individual, for free, and wind up with something that is “safe” for prototyping. Selling to people is another matter – for that you need “officially safe”, which costs money. If you don’t have the up-front resources to pay for regulatory testing and certification in the markets you wish to sell in, make sure to budget for that in any fundraising/preorders/crowdfunding you do.

One more thing: if you make a design, make sure to also do the research about how to safely build, test, and debug your design. There are also plenty of freely-accessible resources describing safety protocols to use when testing, probing, etc on line-voltage circuits. Put your own safety as highest priority, and then after that the safety of any test equipment you might hook up to the circuit (you can definitely blow up your oscilloscope, etc if you aren’t careful)


To give you a general answer: Many appliances use purchased “components” to offload the safety critical portion of the design. The simple example is the external laptop power supply or the USB output cell phone charger. The external power supply or charger is an inexpensive commodity which assumes 95% (number is conceptual) of the safety burden. If you were to incorporate an internal board level AC/DC power supply instead, that is also helpful but not as much.

This sounds like it would be helpful. But please believe that the safety issue is far from straightforward and it has been years since I was deeply involved. My memory is imperfect and the standards have changed. Also related is the type of product; so for example an office copier will be subjected to different analysis from that for a child’s toy. But I recommend that you look into the details of “reinforced” and “double” insulation. Generally you need to have one or the other between SELV and non-SELV circuitry.

Yes you are getting into the difference between “creepage” and “clearance.” Milling a slot can be very helpful but there are requirements for the minimum width of the slot. 1 mm comes to mind but I do not want to promise this.

Yes this was my starting assumption; that Joe_Johnson wanted a product to sell. But even if the product is just for you, be very careful to consider what can possibly go wrong. (Yes these are famous last words so to speak.)

You are asking about safety of electronic products.
The standard I have used was (in that pdf there is only the begining of it):

But as I know here in Europe it was withdrawn (probably 1.01.2021) by another one I had no time to read it yet.

The separation (AC to digital) needed mainly depends on how the user is separated from that digital. Simplifying in safety it is assumed that in case one insulation fails user have to be still safe. Because of this in many places the so called double separation is needed. Each one of them have to fulfill some rules (for example separation distance at PCB depends on maximum expected voltage, assumed pollution degree during device live and even height above sea level). In standards you find the tabels
specifying clearance and creepage (search for that) you have to have at your PCB.
To improve separation you can add openings at critical places of your PCB.

You in US have small AC voltage (I assume 110V) so that problem is less than we have with AC 230V.

That depends on how current will flow through it, and not the voltage. Here we have easier as the same power we get with smaller current :slight_smile:

EMC is the other important consideration.
Read all articles I have linked some time ago:

There are also other linked later in that thread.


Keep all low voltage traces away form the power.
Here is a commercial product where they could not get good spacing from the power line so added a cutout to increase the isolation. This is almost the same circuit. power line, relay, isolated power, little computer.

If the user cannot access any circuitry or metal, this sort of product is often completely “live” and inside a plastic case. Then you don’t need safety clearances on the PCB.
Switches are notoriously difficult as they have to withstand lightning surges on the mains supply, else they fail all the time.

This is not a novices territory.
The wall wart or cable power supply exists because as @BobZ said above, international certification is such a pain. Before CE marking I used to have problems fitting all the national marks on the product.

As someone who designed “wall warts” I never liked calling them that. Who wants to be a designer of warts? :frowning:

Beyond that, the case needs to be strong enough and not normally openable with an ordinary screwdriver for example.

Exactly, so many rules to be aware of.
Right choice of plastic too.
Flammability and toxic smoke have become big issues in many applications now

Sorry, but You are perfectly right :wink:

My employer spends a LOT OF MONEY for approvels and VDE/UL advice. I have colleagues who do nothing else than analyzing standards and designing test and release procedures.

The good old days of homemade commercial electronics are over. :cry:

One more comment: whenever I build something with 230VAC, at home or at work, I imagine I have to power the result and touch every conductive surface with my tongue ! If Im afraid of this, I haven t done a good job :stuck_out_tongue:

I didnt know this term. I can understand you disaprove - but it is somewhat catchy :grin:

I also think of it as :cry: but we have to agree that the world becomes safer now.
AC 220V kicked me when I was 4 years and 4 months old. I loved to switch the Christmas lights by inserting and removing the plug from the socket and the plug and socket construction was not enough safe. It burned a scar on my index finger (no trace now).

Strange, I did something similar trying to test a model railroad part directly on the wall-plug.
Seems such things spawn a career in electrical engineering :rofl:

I have written previously the extra sentence like “The current kicked me and that’s how I stayed.” but removed before sending as it seemed me to be too far-reaching conclusion. I rather suppose that the direction of inference should be the opposite - people who will work with electrical just have inclinations to do some experiments with it as soon as they are able to do it and not all experiments happen to be successful.
When I was 9 I wound a transformer with 7 primary and 1 secondary turns and expected to get 31V at output when I powered primary from AC 220 socket, but I got 0V :slight_smile:

Connecting AC mains power to a DC circuit board is a very serious matter because doing so in a wrong way can electrocute a person or start a fire. In the U.S.A., making electrical connections to AC mains power is covered by a set of standards called the National Electric Code to insure no electrocution or fire results
from operating an AC mains powered device.

However, because I am not an electrician, I am not schooled in all aspects of the National Electric Code.

I am designing a DC-powered relay to switch on/off a heater that runs 10A at AC mains voltage (120VAC). My opinion is that AC mains voltage should not appear on a PCB for the situation that the device stops working and a 9 year old boy starts to try to fix it. Let us also assume the 9-year-old has not been schooled in safely working with AC mains voltage.

In other words, I recommend that all conductors carrying AC mains voltage, or that can possibly carry AC mains voltage only be connected to other conductors inside a metal box with a screwed-on lid that (meaning the metal box) is wired to AC ground.

This way, flexing a wire at AC mains voltage will either (a) connect AC power to AC ground if it is a “hot” wire, or (b) cause the metal box to be connected to AC mains ground if the wire is the “return” one, or © cause the AC “hot” wire to short with the AC “return” wire.

Not sure how any of the AC wires inside the metal box might possibly flex. I suppose one must make sure strain relief is applied to all of them where they enter the box if the machine being powered is portable.

Case (a) would cause a short circuit, making the AC circuit breaker open. Case (b) would cause a dangerous situation with the metal box chassis grounded to AC ground. Case © would also cause a short circuit in the AC line that would trip the AC circuit breaker.

Cases (a) and © would immediately remove AC power from the heater. I think that only case (b) might possibly electrocute a person when that person is touching the metal box. But I don’t know when that might possibly happen.

So my DC control circuit will only run 12VDC control wires into the metal box to switch on/off the relay inside the metal box with the AC wire connections. The circuit converting 120VAC to 12VDC will also be inside the metal box.

Insulation inside the metal box will prevent the AC from reaching these two DC power wires. (Therefore,the insulation on the DC wires must not just be sufficient to withstand12VDC, it must also withstand 120VAC.)

Please criticize me if I have overlooked something important, or if my reasoning is flawed.

Very good example, thanks for that. Only one question. Are you saying there is no PCB in the metal box? You say the AC/DC converter and the relay are in there, so what kind of modules would they be if not PCB mounted?

It sounds very similar to my idea and drawing above… it also does not seem a separate box would help much, my PCB would be in its own box and furthermore in a work box in the wall, no user would mess with it without first accessing the everyday exposed AC lines that go to a light switch before even reaching my box.

[quote=“Joe_Johnson, post:19, topic:27775”]
You say the AC/DC converter and the relay are in there, so what kind of modules would they be if not PCB mounted? [/quote]

Am thinking of using a rectangular light switch box, so I think only a PCB would fit in there along with the AC wires. OTOH, if I used a larger octagonal (or is it hexagonal ?) junction box I might fit a wall-wart in there depending on size.

The former will fit in my appliance. I don’t think the octagonal box will. Not sure if that might be a fire hazard.

My circuit design is nascent.

Everyday exposed AC lines…Very BAD Idea! That is exactly why I wrote my comments on AC mains connections.