This is the PCB design of the project I have been working on recently (my first pcb design). PCB layout

The idea is to control ac appliances (fans, bulbs etc) without relays. I am using triacs which are better than relays for such applications. I am using opto-isolators for complete isolation from ac lines. I tried running the arduino using USB cable connected to my laptop (with charger unplugged) as well as wall adapter (12V).

At first, circuit seemed to work fine. I was able to dump the code into the controller and control bulbs (On/Off as well as dim them) using UART. I sent the commands via UART. However it seems that whenever there is a spark on the ac lines (when I plug in/out a fan), the micro-controller doesn't look happy. Sometimes it resets (which is the better part of the picture) and other times it hangs and I am unable to send commands via UART. I am not sure whether burnt code gets affected as well but sometimes I had to re-upload the code. If I switch on/off a fan in other room, there is no effect.

Possible issues:

1) Absence of ground plane on the PCB.

2) Some sort of EMI due to sparks.

I also tried plugging in a water heater (800 watts resistive load) the same way as fan but nothing happened. So, I think it's the inductive load which is giving problems.

Any constructive solution for this issue will be very much appreciable.


  • 2
    \$\begingroup\$ Yes, it's the inductive load. You need a snubber &/or MOV (or bi-directional TVS diode) to suppress the inductive spike. Normally placed in parallel with the load. An improved PCB layout can help minimize the effects. See electronics.stackexchange.com/q/101815/25328 for a similar question although that board uses a relay. \$\endgroup\$ – Tut Apr 14 '15 at 17:21
  • \$\begingroup\$ Since you are using triacs, the inductive spike problem is likely to be much worse when manually plugging/unplugging the fan since triacs turn off at near zero current. A potential problem you may run into is the triacs not turning off when connected to inductive loads. Suggest you look in datasheets and app notes for triac circuits designed for AC loads. \$\endgroup\$ – Tut Apr 14 '15 at 17:48
  • \$\begingroup\$ This may or may not help but you could try adding a watch dog timer to your arduino software. \$\endgroup\$ – Axis Apr 14 '15 at 18:13
  • \$\begingroup\$ @Tut - Thanks for all your suggestions. I read the link you posted. I am trying to implement them in my next PCB. Will post the board layout before going to production so that you guys can provide some feedback and point out errors/corrections. \$\endgroup\$ – Whiskeyjack Apr 19 '15 at 1:43

You didn't show a schematic, but I don't see any obvious bypass caps or local on-board power supply reservoir caps. That and lack of good grounding is quite likely causing the problems.

As others have said, you should also leave proper isolation distance between the AC and DC sections, and at least try to make somewhat of a ground plane.

You have a large board with few components and large pin pitch, so routing most traces on the top layer should be fairly easy. You will occasionally have to go to the bottom layer becase in general a circuit can't be routed in a single plane. However, you can keep the traces on the bottom layer short. Consider them as "jumpers" just long enough to connect two tracks on the top layer that you otherwise can't connect in a plane. The measure of a ground plane is not how many islands it has in it, but the longest dimension of any island. Keep the jumpers short and unclumped.

However, you absolutely must put a bypass cap on every power feed to every IC. These should be small ceramic caps physically close to the IC with the overall loops as small as possible. 1 µF 0805 is about right. Not only will those be cheaper and perform better than the equivalent thru hole caps, but will be easier to solder too.

Since the DC power is coming from elsewhere and its impedance therefore suspect, put a decent size electrolytic cap right across where the power enters the board. A few 100 µF should do it.

  • \$\begingroup\$ Thanks Olin. I was reading your posts on other similar questions and I got to learn a lot. Seems like leaving the ground plane was the biggest mistake. I will redesign my PCB with ground planes on both surfaces and also try to place the components in a neater way as pointed by others. Again, I really appreciate your help. \$\endgroup\$ – Whiskeyjack Apr 14 '15 at 18:48
  • 1
    \$\begingroup\$ @user3455594 Don't leave out those bypass capacitors, especially on the Arduino. \$\endgroup\$ – Tut Apr 14 '15 at 20:11
  • \$\begingroup\$ @Olin - What measures do you suggest to protect triacs from voltage spikes whenever the device is turned On or Off? After some reading, I found that snubbers are used most commonly to suppress incoming spikes. However the chief use of snubber was related to prevent false triggering of triac and not triac protection. MOV is another option. What's your opinion regarding this. Refer this link for reference to my use case. \$\endgroup\$ – Whiskeyjack Apr 18 '15 at 19:04

You should respect your voltage isolation. The way you have placed (and routed) resistors R16, R13 R10, R2, R31, and R4 compromises the isolation barrier created by your opto-isolators. Below I have marked your existing layout with your isolation path, which is fairly poor:

enter image description here

Have a single isolation zone that is as wide as possible (the width of your opto-isolators). Keep line circuits on the line side, and isolated circuits on the isolated side. See image below for suggestions.

enter image description here

  • \$\begingroup\$ That will be useful, and may help, but do you actually believe this to be the entire source of the problem, and that this solution will completely resolve it? \$\endgroup\$ – Adam Davis Apr 15 '15 at 13:11
  • 1
    \$\begingroup\$ @AdamDavis No, I can't guarantee that this is the only cause of problems. In fact, both Olin and Andy's advice should definitely be heeded. However, this is an important safety consideration, and I can also see a less-than-perfect assembly exasperating the issue. \$\endgroup\$ – W5VO Apr 15 '15 at 14:34
  • \$\begingroup\$ @W5VO - I have made another layout. Can you please see it once and provide your valuable suggestions? Thanks in advance. \$\endgroup\$ – Whiskeyjack Apr 20 '15 at 23:51

Ground plane, ground plane, ground plane and very few excuses. Take a look how you could have done a lot of this circuit board: -

enter image description here

I spent about 5 minutes marking (with bright red) blue tracks that could be red with hardly any brain work at all.

I'd scrap it and start again.

  • 4
    \$\begingroup\$ @kolosy We all start somewhere and we've all done bad layouts when first starting. This is the best free advice the OP will get and if you think I'm being unreasonably harsh then please, I insist, flag this answer to moderators. \$\endgroup\$ – Andy aka Apr 14 '15 at 17:19
  • 1
    \$\begingroup\$ Thanks Andy. I have already put a ground plane in my second design. Do you think this is the only issue? PS - I didn't find your reply harsh in any way. I appreciate your help. \$\endgroup\$ – Whiskeyjack Apr 14 '15 at 17:23
  • 4
    \$\begingroup\$ @kolosy Honestly, I don't think the answer is insulting (and this may be because I agree with the Andy's verdict). \$\endgroup\$ – W5VO Apr 14 '15 at 17:44
  • 1
    \$\begingroup\$ @kolosy: Andy is telling it like it is, and is something the OP needs to hear in clear terms. And yes, I agree with his verdict too. \$\endgroup\$ – Olin Lathrop Apr 14 '15 at 18:21
  • 3
    \$\begingroup\$ @Andyaka it may be telling like it is, but I don't see the point of bringing in "no excuses" and "hardly any brain work." What's obvious and brainless to you, isn't to people just starting out. \$\endgroup\$ – kolosy Apr 14 '15 at 18:34

In my experience, set and reset lines, flip-flops, and other circuits, are very susceptible to "electrical noise." The best practical way to avoid unpredictable circuit behavior, is to decouple the power lines at each chip, with appropriate capacitors. In addition, gating/enabling input lines with a clock signal, will reduce the opportunity for "transients" to affect the circuits.

  • \$\begingroup\$ I didn't understand the last line. Could you please elaborate? Thanks for the answer. \$\endgroup\$ – Whiskeyjack Aug 7 '15 at 4:01

when i was working on DTMF based Load control project, i found the same issue with AC load. Without AC load my 8051 Micro-controller circuit works fine. When i power up the AC load, entire circuit behaves in variety manner when i switched ON/OFF the AC load through relay circuit. Later i found that the ground pour on the 8051 board is not good. Finally i replace the old 8051 micro-controller board with new 8051 micro-controller board with good ground pour. Now its works fine. Therefore, i thought that your PCB should have good ground pour.

  • \$\begingroup\$ That was exactly the issue. Well I had just started the work at that time and I knew nothing about good pcb layout, ground pour, isolation etc. This bug has long been fixed but thanks for answering. I hope it serves as a good reference for people struggling with similar issue. (+1). \$\endgroup\$ – Whiskeyjack Apr 26 '16 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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