I was wondering if I could get some critique on my first PCB layout.

I've tried to isolate the 240V side from the 3.3V side as best as I can.

Only thing really concerning me is if I there is enough distance between my tracks on the 240V side and if the track widths are enough?

I am trying to keep the PCB as compact as possible. At the moment it measures about 46mmx39mm.

Top PCB layer

Bottom Tracks

The PCB is to wirelessly control lights with a regular light switch as the input, 240V connected to the IRM-02-3.3 with the 3.3V then powering the ESP8266-01.

Got an optocoupler and Triac in there to switch the light load.



Thoughts and feedback greatly appreciated :)


Updated PCB

  • 3
    \$\begingroup\$ (1) What's the grey box under the MOC? (2) Usually we'd put the component designators (R1, etc.) on the PCB rather than the component values. (3) R2 is compromising the creepage distance unnecessarily. Move it to the right. (4) The ground pour around the opto pins also reduces the creepage distance. Is it required? \$\endgroup\$
    – Transistor
    Sep 23, 2018 at 20:12
  • \$\begingroup\$ @Transistor 1) The grey box is a cutout of the PCB board for isolation. 2) I'll add the designators instead. 3) Is 3.5mm enough distance? 4) No, not required I can remove it if necessary. Have updated the PCB in the original post at the bottom. \$\endgroup\$
    – Tenatious
    Sep 23, 2018 at 20:17
  • 1
    \$\begingroup\$ a 2mm cutout extending past AC ~DC nodes is done to protect against 3kV transients using 1.5kV /mm for air \$\endgroup\$ Sep 23, 2018 at 20:25
  • \$\begingroup\$ How is the ESP-01 module physically positioned over the board? Does it hang off to the left (off the board) or the right (over the optocoupler)? \$\endgroup\$
    – user39382
    Sep 23, 2018 at 20:43
  • \$\begingroup\$ @duskwuff Over the optocoupler \$\endgroup\$
    – Tenatious
    Sep 23, 2018 at 20:50

4 Answers 4


Allowing the ESP8266 module to overhang the optoisolator violates the isolation boundary. Consider rotating the module so that it overhangs the (currently unused) space on the left of the board.

Using surface-mount resistors for pullups will save you a considerable amount of board space. (The thru-hole resistor on the HV side is fine.)

You only need to use thick traces for nets that will be carrying a lot of current. You can safely use thinner traces for the optocoupler and the voltage regulator, as neither of these should be carrying a lot of current.

Rotating the BT136 180° may allow you to move the optocoupler up and the resistor down, saving some trace length.

Adding a fuse on the line input might be a good idea.

  • \$\begingroup\$ I am a bit puzzled as to why this was not an all SMD design to begin with. You can still slot cut SMD parts for an isolation barrier. All things considered I think this was one of the OP's first board layouts. +1 \$\endgroup\$
    – user105652
    Sep 24, 2018 at 2:12
  • \$\begingroup\$ @Sparky256 It is my first board layout attempt. I was considering doing SMD but wondered if it was biting off more than I can chew for my first go! Maybe V2 I can make SMD. \$\endgroup\$
    – Tenatious
    Sep 24, 2018 at 8:28

Your questions seem to be: Is the slit enough isolation? Are the tracks separated enough? Are the tracks substantial enough?

First, there is not an apparent safety ground on the board. If you're using line voltages, neutral cannot be counted on to be ground. You seem to have a push button on this board, but no Earth ground at all. I'm all for experimentation, but this made me create a stackexchange account just to respond to-please fix this.

Your line and load connector selection is looking like it's going to be the limiting factor in how much separation you can get. Also consider your thru-hole leads- I can't tell whether components are mounted on the red or blue side. Consider also the addition of solder when checking your separations. Check your board material and thickness for voltage rating also.

Regarding trace widths, you have to calculate that based on load current drawn and copper thickness (weight) on the PCB.

I would recommend you research how much separation is actually needed, use a PCB software package that has conductor to conductor separation design rules, and set them to that value, so you can determine if you have any violations. Add safety ground, and please be careful.

  • \$\begingroup\$ I’ve actually removed the push button already as it isn’t needed on the final PCB. The whole thing will be in an enclosure and so not touchable once installed. I could use a different live and load connector. These were just the first ones I came across. The board material is FR-4 and 1.6mm. Do you have any recommended PCB design software as I was using a free software that doesn’t offer that functionality. \$\endgroup\$
    – Tenatious
    Sep 25, 2018 at 19:23
  • \$\begingroup\$ that sounds like it should be a thick enough board - electronics.stackexchange.com/questions/211025/… \$\endgroup\$
    – user199452
    Sep 25, 2018 at 20:14
  • \$\begingroup\$ Ok - just didn't want you to have a hot enclosure or button. It looks like you have 1.5-2mm btw connector pads, which might not handle that voltage. That sounds like it should be a thick enough board - link'see also'. One tool that's free and seems to have trace-trace DRC rules is PCB123 from one of the PCB mfrs, but iirc they might try to lock you in to their board house. There's also Eagle, which seems to now offer monthly licenses. (Apologies if I'm not supposed to mention products - I'm new here). \$\endgroup\$
    – user199452
    Sep 25, 2018 at 20:38

Normally a board house can do slot cuts as narrow as 31 mils or 2mm. Your slot cut need not be wider than that, but it should extend to the purple line which I assume is your 50 mil perimeter clearance.

This way you isolate R2 from R1 in terms of creapage. 240 VAC is not that high, but even with 600 VAC (Canada) a slot cut kills any chance of creapage or creapage plus arcing.

Taken to extremes you could insert thin sheets of mica into the slots in case the triac or SCR blows in a violent way. Mica will stop plasma-hot debris for a second or so, time for an upstream fuse to blow.

You could stop the slot cut just past the R2 annular ring. Slot cuts can go past the edge of a board but it looks tacky unless a robust isolation barrier is needed.

Note that all slot cuts have rounded corners equal to the radius of the bit doing the cut. Since you need to give precise dimensions to the board house do not confuse them with square corners as they cannot make them. For slot cut dimensions give them the length and width minus the radius of the bit they use. For 2mm bits decrease documented dimensions by 1mm, etc.

  • \$\begingroup\$ The purple line is the PCB edge. I can extend the slot cut in between R1 and R2 \$\endgroup\$
    – Tenatious
    Sep 23, 2018 at 20:42
  • \$\begingroup\$ You could stop the slot cut just past the R2 annular ring. Slot cuts can go past the edge of a board but it looks tacky unless a robust isolation barrier is needed. \$\endgroup\$
    – user105652
    Sep 23, 2018 at 20:47
  • \$\begingroup\$ Yeah I've done that now. Left just a little gap at the edge of the board but extended it past the R2 pad. :) Thanks \$\endgroup\$
    – Tenatious
    Sep 23, 2018 at 20:48
  • \$\begingroup\$ If that purple line is your board edge and you're using Altium, you need to set it. Select the board edge lines and then go to (I think) Edit->Board Shape->Define from Selected Objects \$\endgroup\$
    – Daniel
    Sep 23, 2018 at 21:09
  • \$\begingroup\$ @Daniel It was done in EasyEDA. \$\endgroup\$
    – Tenatious
    Sep 23, 2018 at 21:14

If that purple line is your board edge and you're using Altium, you need to set it. Select the board edge lines and then go to (I think) Edit->Board Shape->Define from Selected Objects

(Apparently this is EasyEDA, not Altium. Wow they sure were going for 'that Altium look'!!)

I don't know what your part looks like with that ESP8266 footprint, but the holes are TINY.

Typically on a DIP part, pin 1 is square and the others are circular or stretched circular

R3 and switch pad (U2?) are too close together IMO. If you solder waved this there is a decent chance of bridging and it can be just annoying to have leads that close that aren't connected.

Typically ICs are designated "U". Switches/buttons are "SW" "S" "PB".

Note: I make no claim or comment on the safety of this design.

  • \$\begingroup\$ You're right, I hadn't even noticed how small the holes had ended up. That was me messing around removing the outline of the ESP-01 as it was a bit too much on the silkscreen. Yeah you're probably right about R3 and the switch. Will alter that slightly. \$\endgroup\$
    – Tenatious
    Sep 23, 2018 at 21:22

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.