Edit: I have added the updated PCB design at the bottom over this post (for anyone curious about the progress)

And a big thanks to everyone who commented, it really helped me out a lot!

Original version: This is my first time posting something, and I have a question about a PCB that I am currently designing for a personal project. I have already some experience in PCB designing, but I have never made a PCB that has AC traces on it.

I am pretty sure I have done this correctly, but I want a second opinion so that I know I am doing it right and if I did something wrong I can learn from it!

The project I am currently working on is a relay board that can turn on a ventilator with an IR remote controller. I use a ProMicro microcontroller to receive and handle the inputs given by the IR-receiver. I use three relays to control the three speeds my ventilator has. J1 is the connector to connect 230VAC to the AC/DC power supply, that feeds the ProMicro and other components, and J2 to J4 to connect the wiring of the ventilator.

For the PCB I tried to put all the DC-signal traces on the top layer and the AC power traces on the bottom and tried to put as much trace spacing between the AC and DC traces and vias. The trace width of the AC traces is 2 mm, and I kept the AC traces as straight as I could.

So my question is, is there something I maybe forgot? And what are things I need to look out for?

Thank you,


Schematic made in Altium

Top layer, with (most) of the DC-signals routed

Bottom layer, where the polygon GND plane is poured

enter image description here

Edit: 3D model

enter image description here

enter image description here

Updated version: I removed the “Arduino optocoupler disease” from the PCB and switched it with the ULN2003 Darlington IC. Moved some components so that all the components connecting to the AC are on the south side of the board, and tried to keep as much spacing between DC and AC traces. Added mounting holes. And changed the resistors to the right size.

Updated schematic enter image description here enter image description here enter image description here enter image description here enter image description here

  • 2
    \$\begingroup\$ If you put thru hole components on both sides of the board, on top of each other, once you solder one side, how will you solder the other side? \$\endgroup\$
    – bobflux
    Commented May 27 at 12:36
  • 1
    \$\begingroup\$ I think the suggestion is this: don't put things on the bottom if you don't have to. Those resistors really look large, did you have a particular reason not to use small ones? \$\endgroup\$
    – jonathanjo
    Commented May 27 at 14:22
  • 4
    \$\begingroup\$ In addition to the feedback in the answers, I feel the signal lines to the relays pass a little close to the solder joints of the high voltage PSU filter. For separation between LV and HV, more space is better. \$\endgroup\$
    – marcelm
    Commented May 27 at 17:27
  • 2
    \$\begingroup\$ The new version is a lot better. You can remove the crossing tracks on the mains side of the switching power supply (it's AC, there's no need for "correct polarity") and remove the cut which is useless. And the relay control traces would be much better under the lightning bolt sign, far away from mains voltage. \$\endgroup\$
    – bobflux
    Commented May 28 at 9:59
  • 2
    \$\begingroup\$ You might give further thought to the placement of the LEDs. I see the the IR sensor is pointing horizontally leftwards, but the LEDs are scattered and pointing vertical off the board. Usually it looks a lot better (in the finished project) if the LEDs are grouped nicely and in the best position for viewing and understanding. Often, tracking the LEDs is irritating because their position matters in this way. (Same is often true of connectors, switches etc). \$\endgroup\$
    – jonathanjo
    Commented May 28 at 10:21

6 Answers 6


In addition to what has already been said:

  • One neat trick (...from the 1980s) is to place through-hole resistors vertically so that they don't take up as much board space. You shouldn't have components on 2 sides here. Resistor networks might also be used to save some board space.
  • There is no good reason why you are using such massive resistors. If you insist on through-hole mount then at least pick something smaller like 1/6W packages.
  • This is yet another case of the contagious "Arduino optocoupler disease" spreading over the Internet. There is no reason to use optocouplers in this design to begin with. To make things worse, you've also grounded both sides of it to the same primary ground & same supply, so that it is definitely made 100% useless. It adds cost and an additional source of errors, that's literally all it does. Get rid of the optocouplers - you can drive the relays directly from the BJTs.
  • Or get rid of the BJTs and diodes too and use a Darlington array IC instead - they come with built-in freewheel diodes. That's some 15 components you can replace with a single NPN Darlington array IC and a 100nF decoupling cap. Less cost, less board space, fewer problems.
  • For the AC traces you can optionally add scoring in the PCB in between them, for example underneath the relays around the contacts. Usually doesn't add any cost but makes for much better creepage.
  • 8
    \$\begingroup\$ +1 for "Arduino optocoupler disease" \$\endgroup\$ Commented May 28 at 5:44

I haven't looked into every details of it, but my two cents review comments are:

  1. The lack of mounting holes for screws of some sorts. If you have enough space, do it. It's easier to have holes that you don't use than to drill afterwards.
  2. It may be good to use the silkscreen to indicate clearly, with a lightning bolt symbol and some hashing, where the high voltage is. It costs nothing and may remember you where you have to pay extra attention when debugging the board.
  3. Don't use too thin traces where you don't have any size or capacitive effect contrains on your signal. It's easier to rework, produce, etc wider traces.
  4. We don't see the BOM, but make sure C2 is the right kind of safety capacitor and not a regular 100nF.
  5. You have a "5V" and a "Vcc" net, but I don't understand where the "Vcc" comes from. Is it an output of U1?
  6. No capacitors on "Vcc". Does it need to be decoupled? You could add an additional footprint for a ceramic cap, even if you don't need it at the end. Same for 5V, in addition to the big electrolytic C1 cap.

These are the things that comes into my mind when look at your board. Other may find some stuff I have missed. Good luck with your projects and remember to be extremely cautious when working with main voltage.

  • \$\begingroup\$ Adding mounting holes and a bolt symbol is indeed a very good idea. And C2 is indeed a safety film capacitor. 5V comes from the AC/DC power supply and VCC comes from the microcontroller. It doesn't really need to be decoupled, but adding footprints for the capacitors won't hurt. Thanks for the tips! \$\endgroup\$
    – Djumbonia
    Commented May 27 at 13:27
  • \$\begingroup\$ "use the soldermask to indicate clearly, with a lightning bolt symbol " ... I believe Blup meant use the silkscreen. \$\endgroup\$
    – jonathanjo
    Commented May 27 at 14:33
  • \$\begingroup\$ Absolutely. I have corrected my answer. Thanks \$\endgroup\$
    – Blup1980
    Commented May 28 at 18:21

One flaw in the schematic: You need a current limiting resistor on the output side of each of the optoisolators. As it is, you're trying to apply 5 V directly to the base of each of the BC517 Darlington transistors.

  • \$\begingroup\$ Oh yeah you're right, I totally oversaw that. Thanks for commenting! \$\endgroup\$
    – Djumbonia
    Commented May 27 at 13:29
  • 7
    \$\begingroup\$ The optocouplers fill no function anyway, so the correct solution is to get rid of them in the first place. \$\endgroup\$
    – Lundin
    Commented May 27 at 14:28

My thoughts to this pcb are:

  1. Your cutouts may not be square on the finished pcb, I would advise a rounded corner with 2mm radius to be safe. Otherwise you may end up with cutouts shaped like dog bones.

  2. Your traces are very thin, even if they don't carry much current, I would make them big if space is there. 1mm is a safe width for nearly everything, go smaller only if you must.

  3. Move J5 towards R4, it makes the routing easier.

  4. Also look into the clearence between the board outline and the cooper traces, they seem a little thin in the middle of the board.



TSOP IR sensor needs 100nF decoupling cap.

Optocouplers are unnecessary since you do not use the isolation they provide. You can drive the base of Q2-3-4 directly from the microcontroller via an appropriate resistor (2.2kOhm for example).

To prevent arcs in the relay contact from crashing the micro in case of nasty inductive load you can add 10nF ceramic cap across B-E of Q2-3-4.

Component choice:

It may be cheaper to use an AC-DC power supply that does not require an extra filter.

A smaller common mode filter (rated for lower current) would probably be sufficient for a 5W supply.

All resistors are too large, you can use standard 1/4W.


If you put a connector below a relay, and they're both thru-hole, you won't be able to solder one of them because the other will be on top of the pads. So you won't be able to solder J1-2-3-4.

I'd shuffle parts around to put everything on the same side. If you remove the optos and put the relay driver transistors next to the micro you'll have enough space to put all the high voltage stuff including connectors on the "south" side of the board.


I can't comment directly, so it's here. I'm not a fan of the 'netlist' style of schematic, where isolated clumps of circuitry on the same page are interconnected only by net name. (Such as the LED and GPIO signals on this schematic.) They should have lines drawn connecting them directly. A really good schematic is a work of art as much as capturing the design, and can show flow, voltage gradients, other subtleties. Using the netlist form obscures the relationships of things. Presumably they have one, else why are they on the same page? If using the netlist form, why even have anything else? Ditch all the rest of those lines! (Rhetorical question.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.