element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Autodesk EAGLE
  • Products
  • More
Autodesk EAGLE
EAGLE User Support (English) AC mains on a PCB ?
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Autodesk EAGLE to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 107 replies
  • Answers 10 answers
  • Subscribers 184 subscribers
  • Views 16784 views
  • Users 0 members are here
Related

AC mains on a PCB ?

anishkgt
anishkgt over 9 years ago

A total newbie to eagle design and PCB fab. So plase bear with on my silly questions, trying to learn.

 

I have pcb that is schematically completed with the layout. Before i start the fabrication process i need some expert advise if the components placed and the wires routed are ok for the ac mains and the others. The load here will be a transformer. The ac mains are 240VAC and all works well as designed in the schematic on a bread broad except for the load for which MOC3023 is yet to arrive from where i've ordered.

 

 

 

Thanks in advance.

 

image

 

image

  • Sign in to reply
  • Cancel

Top Replies

  • rachaelp
    rachaelp over 9 years ago in reply to anishkgt +2
    Hi George, It looks like you're really learning a lot with this design and you've had lots of good advice from people on this thread already and the difference between the initial version you posted and…
  • michaelkellett
    michaelkellett over 9 years ago in reply to rachaelp +1 suggested
    For mains input spike suppression I think you are much better off with this kind of device: http://uk.farnell.com/epcos/b72214s0231k101/varistor-60-0j-230vac/dp/1004389 Farnell 1004389 This one is rated…
  • autodeskguest
    autodeskguest over 9 years ago in reply to anishkgt +1 suggested
    On 11/09/16 12:02, George Thomas wrote: Why two thrustirs to control the load and am trouble witching on yhe Triac. Triacs can suffer commutation problems with certain types of load - highly inductive…
Parents
  • autodeskguest
    0 autodeskguest over 9 years ago

    Ooops - looks like I accidentally hit the wrong reply button before...

     

    On 03/09/16 14:57, George Thomas wrote:

    A total newbie to eagle design and PCB fab. So plase bear with on my

    silly questions, trying to learn.

     

    I have pcb that is schematically completed with the layout. Before i

    start the fabrication process i need some expert advise if the

    components placed and the wires routed are ok for the ac mains and the

    others. The load here will be a transformer. The ac mains are 240VAC and

    all works well as designed in the schematic on a bread broad except for

    the load for which MOC3023 is yet to arrive from where i've ordered.

     

     

    You have a lot of traces running unnecessarily close to each other and

    to pads. That's fine to low voltage stuff but undesirable when high

    voltages are present.

     

    Your placement of parts results in quite a few traces being quite long.

    That's undesirable in all domains. I particularly note that the trace

    from C7 to R20/21 goes all around the houses, when a simple rotation of

    C7 could reduce it to nothing.

     

    I don't know how much current that BTA08 is expected to drive, but the

    text describing the board as a "spot welder microcontroller" hints that

    you might be looking at several amps. If so, your traces look rather

    thin to me, especially given how long they are.

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • anishkgt
    0 anishkgt over 9 years ago in reply to autodeskguest

    Thanks a lot to take the effort to correct me.

     

    I've removed C7 and R21 which are actually used to protect the optocoupler but i don't see they being necessary here and i have rearranged the the remaining too.

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • autodeskguest
    0 autodeskguest over 9 years ago in reply to anishkgt

    On 04/09/16 19:23, George Thomas wrote:

     

    Now about placing the components, will keep the AC components as close as possible with the widest copper. The space between the pins is short so that would limit the copper size there would that be a problem ? I mean the route to the TRIAC would be. I've rearranged the AC components closer. how are the track size for the other components looking ?

     

    The shorter those tracks are, the less it matters if they're not as wide

    as you'd like. Basically, the copper track acts as a (low value)

    resistor, where R = k.l/w (give or take). Short and fat is the lowest

    resistance and hence gets least hot.

     

    It looks like you've changed to a different triac in a wider (TO3-P)

    package, which will help with wide tracks! If it were my design, I would

    move the small transformer to the right a fraction and put the triac

    between it and the connectors. That would, I think, allow the shortest

    track from the "AC" connector to the middle pin of the triac. Well,

    other than placing the triac between the connectors and swapping the

    connectors so that AC is towards the top.

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • anishkgt
    0 anishkgt over 9 years ago in reply to autodeskguest

    Thanks for your help Robert.

     

    Yes I did change them, the earlier pin spacing was a close. I've changed the locations of the Transformer and reduced the track size of the other components (would that be ideal here as there is not current flowing through them). I've also removed the set of resistors and replaced it with just one and connected to ground such that all the LEDs are grounded via this resistor. No two LEDs would light up simultaneously, tested on the breadboard and that worked well. Hoping this would be a better layout.

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • autodeskguest
    0 autodeskguest over 9 years ago in reply to anishkgt

    On 05/09/16 11:56, George Thomas wrote:

    Thanks for your help Robert.

     

    Yes I did change them, the earlier pin spacing was a close. I've changed the locations of the Transformer and reduced the track size of the other components (would that be ideal here as there is not current flowing through them). I've also removed the set of resistors and replaced it with just one and connected to ground such that all the LEDs are grounded via this resistor. No two LEDs would light up simultaneously, tested on the breadboard and that worked well. Hoping this would be a better layout.

     

    Looks good from the mains side. I can see quite a few opportunities for

    improving the low voltage routing and I would probably put all

    components at a multiple of 90 degrees rotation (i.e. not like R23 and

    IC4) but those are not critical matters. You might want to position IC5

    and R20 for maximal clearance between tracks, particularly the T1 gate

    track and the one from R19.

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • anishkgt
    0 anishkgt over 9 years ago in reply to autodeskguest

    Well, after a while, i've managed to move IC5 away from R20, i've also changed the angle for the R23 and IC5 making them more routable during Auto tracking

    .image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • autodeskguest
    0 autodeskguest over 9 years ago in reply to anishkgt

    On 05/09/16 23:57, George Thomas wrote:

    Well, after a while, i've managed to move IC5 away from R20, i've also changed the angle for the R23 and IC5 making them more routable during Auto tracking

    .

     

    No, I think you misunderstood. There's no problem with IC5 being close

    to R20, there's a problem with the tracks connected to IC5 being close

    together. You absolutely don't want them passing between the pins!

     

    Rotate IC5 by 180 degrees and move it left by 0.2" or so. Then rotate

    R20 by 180 degrees and move it due south of R22.

     

    IC5 is an optoisolator - its whole purpose is to isolate - so make sure

    you maintain an isolation gap across it.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • michaelkellett
    0 michaelkellett over 9 years ago in reply to autodeskguest

    It might help you with getting the separation between mains and low voltage side stuff if you make sure that there is a gap of at least 4.5 mm between mains and low voltage tracks (this is about the separation on the opto isolator package).

     

    Here's a useful guide to this kind of thing:

     

     

    cache.freescale.com/files/analog/doc/app_note/AN3962.pdf

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • anishkgt
    0 anishkgt over 9 years ago in reply to michaelkellett

    Thanks mate that was very helpful.

    there is a gap of at least 4.5 mm between mains and low voltage tracks (this is about the separation on the opto isolator package).

    ah that explains the use of the opto-couplers. I do know that but that made more sense to why they should be separated.:)

     

    so what all the knowledge gain from this post I am guess this the layout should be ok.

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rachaelp
    0 rachaelp over 9 years ago in reply to anishkgt

    Hi George,

     

    It looks like you're really learning a lot with this design and you've had lots of good advice from people on this thread already and the difference between the initial version you posted and this latest version is quite substantial. I do wonder if the placement of the connectors, transformer etc could be rearranged such that the AC traces flow much straighter into the transformer, it's hard to see when you don't have the actual design files to experiment on but I think there is scope for further improvement there. I do also wonder if some of your clearances between conductors, for example around the connectors, are a little small. It might also be worth looking at some reference designs for mains power supply circuits to see how they deal with things like EMI filtering, circuit protection and most importantly safety.

     

    The latter is something I can't stress enough. Do your own research and ensure that your circuit, how it's fitted into your final design, and the system as a whole work together to ensure neither you, nor anybody else, can hurt themselves. Sorry if that sounds a little nannying but as you are new to circuit design and you're jumping straight into a mains powered product it probably should be said. All the advice people can give you here is great but you need to do your own research and ensure that what you finally make is safe and this is entirely your own responsibility.

     

    Best Regards,

     

    Rachael

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • MattyLad
    0 MattyLad over 9 years ago in reply to anishkgt

    Looking better on the mains side, although I would still make the tracks to IC 5 thicker - just for durability.

     

    Please review your ground connections, you have some that go through very thin slivers.

    Also under the big IC you have floating copper (not connected to anything).

    A poor return will make your board bad for EMC also.

     

    Matt.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • autodeskguest
    0 autodeskguest over 9 years ago in reply to MattyLad

    Am 06.09.2016 um 17:08 schrieb MattyLad:

    Looking better on the mains side, although I would still make the tracks to IC 5 thicker - just for durability.

     

    Please review your ground connections, you have some that go through very thin slivers.

    Also under the big IC you have floating copper (not connected to anything).

    A poor return will make your board bad for EMC also.

     

    Matt.

     

    --

    To view any images and attachments in this post, visit:

    https://www.element14.com/community/message/205233

     

     

    Actually I didn't want to cut in here, but I don't like your AC section

    at all.

    Distances on terminals are usually just above the minimums.

    With your track from transformer pin5 to the AC terminal you lessen the

    distance to the second AC terminal pin.

    Although the rule says the shorter the better for large currents it

    doesn't say to forget the minimum distances image

    I would:

    1. exchange the transformer pins 1/5

    2. move R22 right above R20

    3. move the triac about half way between the terminals and R22

    4. move your tracks straight away from the terminals to get a save

    distance before turn towards the triac pins.

    5. The trigger line should go a little straight away from the triac

    before turning towards the optocoupler.

     

    --

    Mit freundlichen Grüßen / With best regards

     

    Joern Paschedag

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • autodeskguest
    0 autodeskguest over 9 years ago in reply to MattyLad

    Am 06.09.2016 um 17:08 schrieb MattyLad:

    Looking better on the mains side, although I would still make the tracks to IC 5 thicker - just for durability.

     

    Please review your ground connections, you have some that go through very thin slivers.

    Also under the big IC you have floating copper (not connected to anything).

    A poor return will make your board bad for EMC also.

     

    Matt.

     

    --

    To view any images and attachments in this post, visit:

    https://www.element14.com/community/message/205233

     

     

    Actually I didn't want to cut in here, but I don't like your AC section

    at all.

    Distances on terminals are usually just above the minimums.

    With your track from transformer pin5 to the AC terminal you lessen the

    distance to the second AC terminal pin.

    Although the rule says the shorter the better for large currents it

    doesn't say to forget the minimum distances image

    I would:

    1. exchange the transformer pins 1/5

    2. move R22 right above R20

    3. move the triac about half way between the terminals and R22

    4. move your tracks straight away from the terminals to get a save

    distance before turn towards the triac pins.

    5. The trigger line should go a little straight away from the triac

    before turning towards the optocoupler.

     

    --

    Mit freundlichen Grüßen / With best regards

     

    Joern Paschedag

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • anishkgt
    0 anishkgt over 9 years ago in reply to autodeskguest

    you mean pinswap, right ? well that would again make the other trace longer, wouldn't it.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rachaelp
    0 rachaelp over 9 years ago in reply to anishkgt

    George Thomas wrote:

     

    you mean pinswap, right ? well that would again make the other trace longer, wouldn't it.

    I believe that's what was meant. It will lengthen the shorter trace slightly but shorten the other a lot more and stop it having to run around and under the transformer to get to the desired pin. You also need to make more space to get clearance between the two traces, you really don't have enough around the connectors. What is the pin pitch of your mains connectors, is it sufficient or do they need changing? Looking at the input on a typical 240V PSU I have here, the pitch on the input connector is 3.96mm. If you look at the clearance between the pads with connectors of this pitch you'll see that it's several mm. You should use this as a guide as to the minimum clearance between mains conductors and also their clearance to anything else. The advice Joern gave for moving parts and rerouting traces above is all valid and is what I would also suggest.

     

    Best regards,


    Rachael

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • anishkgt
    0 anishkgt over 9 years ago in reply to rachaelp

    Well i hope this layout is what you guys suggested. When you said pitch is it the distance between the two terminals of the connector ? well on the physical connector it is 4.6mm

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rachaelp
    0 rachaelp over 9 years ago in reply to anishkgt

    Hi George,

     

    You've made some improvements in clearance and routing to the transformer but in the process you've changed a lot of other things in a very different way to what was suggested and now it appears the nice clearly defined isolation barrier you had between the AC side and DC side is gone. Your opto-coupler now has all sorts running underneath it again and doesn't sit across a clear isolation barrier. I suggest you take a step back to the previous layout and have another go. Draw some guides on tDocu or something to show the AC side and the DC side and lines to show the minimum isolation gap to help you place your AC side components and DC side components. Then don't route anything from the AC side or the DC side across the isolation barrier.

     

    Another thing to note, you shouldn't run traces underneath the transformer as you'll likely end up coupling 50Hz mains noise onto them and taking this into the rest of your circuitry.

     

    Best Regards,

     

    Rachael

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • anishkgt
    0 anishkgt over 9 years ago in reply to rachaelp

    Hmmmm knew there was something wrong when autorouting was completing at 100% for all the efforts image. So is there any option to avoid traces under or near IC's and opto-couplers and where else should i avoid traces, caps ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rachaelp
    0 rachaelp over 9 years ago in reply to anishkgt

    George Thomas wrote:

     

    Hmmmm knew there was something wrong when autorouting was completing at 100% for all the efforts . So is there any option to avoid traces under or near IC's and opto-couplers and where else should i avoid traces, caps ?

    Yes, you can use the restrict layers to specify where traces are not allowed to go. Take a look at this article for a quick guide on how to do this: http://dangerousprototypes.com/blog/2012/08/08/how-to-eagle-keepout-and-restrict-layers/

     

    In general however, a lot of auto-router issues stem from deficiencies in the initial placement. With any routing job, manual or auto, but especially with auto routing, the placement will make or break the layout. Your latest placement has a number of issues, a few of which I highlighted in my previous post. You need to take a step back and think about how the circuit "flows" and try and place things to keep the flow simple.

     

    If I were you I would consider doing at least some of the more critical routing manually and leave the auto router for the less critical stuff. Also, don't just hit the autoroute button and let it do it's thing in one go, tell it to route specific smaller groups of more important signals first, inspect them and manually tweak if needed and then move on to the next. Breaking it down in this way and keeping an eye on how it is doing will give you a better chance of success.

     

    Jorge Garcia wrote a good blog post on the auto router a while back which is worth a read: https://www.element14.com/community/community/cadsoft_eagle/blog/2015/06/17/are-you-better-than-the-autorouter

     

    Best Regards,

     

    Rachael

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rachaelp
    0 rachaelp over 9 years ago in reply to rachaelp

    Morten Leikvoll wrote:

     

    Also, make sure its fire- and explosion-proof in case something should short circuit, or you get struck by lightning at the AC. I saw someone mentioning fuse, and I assume you have one at the AC inlet, prior to entering the pcb.

    Yes absolutely! The fuse in the mains plug probably isn't enough to protect the circuit though as it may be over rated and won't necessarily blow quickly enough. I'd consider adding a PTC and MOV's and/or TVS diodes as surge protection if this were my design. I'd also add some EMI filtering and have the earth connected in too.

     

    Best Regards,

     

    Rachael

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • autodeskguest
    0 autodeskguest over 9 years ago in reply to rachaelp

    On 07.09.2016 10:53, rachaelp wrote:

    Morten Leikvoll wrote:

     

    Also, make sure its fire- and explosion-proof in case something should short circuit, or you get struck by lightning at the AC. I saw someone mentioning fuse, and I assume you have one at the AC inlet, prior to entering the pcb.

    Yes absolutely! The fuse in the mains plug probably isn't enough to protect the circuit though as it may be over rated and won't necessarily blow quickly enough. I'd consider adding a PTC and MOV's and/or TVS diodes as surge protection if this were my design. I'd also add some EMI filtering and have the earth connected in too.

     

    Best Regards,

     

    Rachael

     

    Fuse in the mains plug? image That is UK-specific I guess. Either use IEC

    power inlet with embedded fuse (like farnell 1516059), or make sure the

    first thing the power line meets, is a fuse. (And ground meets the metal

    box).

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • autodeskguest
    0 autodeskguest over 9 years ago in reply to anishkgt

    Am 07.09.2016 um 08:28 schrieb George Thomas:

    you mean pinswap, right ? well that would again make the other trace longer, wouldn't it.

     

    --

    To view any images and attachments in this post, visit:

    https://www.element14.com/community/message/205268

     

     

    Yes, but nobody requested you to turn the AC equipment by 90 degrees image

    If you place the eagle file here to where I gave my suggestion 06.09. I

    will change it  to what I meant.

    Imo your layout from 07.09. has decreased. Why do you think are the pins

    of the triac are so far spaced?

    Also on this new layout the optocoupler is awful.Why do you change so

    many things at all.

    Do only change the things people suggesting. I don't know how others

    feel but imo was the layout from 06.09. much better.

     

     

    --

    Mit freundlichen Grüßen / With best regards

     

    Joern Paschedag

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • rachaelp
    0 rachaelp over 9 years ago in reply to autodeskguest

    Joern Paschedag wrote:

     

    I don't know how others feel but imo was the layout from 06.09. much better.

    Yes I agree with you, as I said in one of my posts, the earlier layout in general was far better, while the routing to the transformer is improved a little, this one takes a big step backwards with regards the AC/DC isolation barrier. I'm also not happy with clearances between and to the mains voltage traces still and I think the mains connectors probably need to be changed to be a wider pitch to facilitate this.

     

    Best Regards,

     

    Rachael

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube