I designed the following PCB, where after testing a faced a severe (EMC related?) problem.

This board houses an STM32F103 developing board.

On the right of the PCB, there are 6 thermistors connected to measure various temperatures, which during all testing where connected directly to the PCB, without any long cabling. On the bottom of the PCB there are 7 relays, SANYOU SRD-S-112D, which are driven from the ULN2003A above them. The diode of the ULN2003A is properly connected, and there is no problem with the back-EMF of the relays. No other connections where done during testing.

enter image description here

enter image description here

enter image description here

While I was testing the board with nothing connected to the relays, everything performs as expected.

Then I connected a mains (220V) relay to the on-board one. The connection thus is ULN2003A=>on-board relay =>mains relay. And here the problems begun. Every time the 220V relay changes state I get excessive noise spikes on the PCB. I2C data are corrupt, data of the shift register controlling the ULN2003A are also corrupt etc. The problem is more severe when the relay is being deenergized.

The PSU, the PCB and all used instruments are properly grounded. The PSU is isolated, with the DC ground connected to earth. The on-board relays are tested, and my DMM reports OL between the contact and the coil for all. Apart from ground nothing else connects electrically the mains relay and the PCB under test.

I hooked up my oscilloscope and I got the following trace. Channel 2 is the +12V supply of the PCB. These spikes are observed 6ms after the ULN2003A output changes, so I believe this is the time the on-board relay needs to change state, and the coil of the 220V relay to start/stop operating.

enter image description here enter image description here

These spikes can be observed to any point on the PCB, on any trace and voltage level.

What exactly is causing this? How can I combat it? How can I determine whether these spikes get to my circuit through the PSU, or through the air, and in each case which is the solution?

As I have manufactured a small batch of these boards, I am interested in solutions both to make them work and not throw them away, and solutions to implement to the next revision.

More tests can be performed, please ask in comments.


As per recommendation in the answer, I installed a 1.5KE400CA TVS on the on-board relay's contact. I can say that it helped a bit, but definitely the problem persists.

Here is the output of the 5V regulator before the TVS: enter image description here

And here it is after: enter image description here


As you see on the schematic, there is a serial output, for daisy chaining more shift registers, and relays. I connected such a board on this output. It is made on a strip-board, so I do not have any schematics at hand, but it is a simple 74HC595 connected to a ULN2003A. Just the same circuit as in the main board. When doing the same test (mains relay connected, to the contact of the expansion board relay), the spikes are much more severe, and the system becomes completely unresponsive, with data on all buses (I2C, and SPI) totally corrupt.

I tried adding TVS diodes on everything (relay coil, relay contact, mains relay coil, mains relay contact), but did absolutely nothing.

  • \$\begingroup\$ The schematic would be useful too, we have no ideas what components go where. Also are you sure you have enough decoupling and sufficient freewheeling diodes? \$\endgroup\$
    – PlasmaHH
    Feb 17, 2016 at 23:40
  • 2
    \$\begingroup\$ Is your 12V line from a main PSU on the same circuit as the mains that you're switching? The noise could be coming in that way. Also you will want to consider snubbers on your relay contacts otherwise they will arc and radiate pretty badly due to the coil inductance of the 240V relays. \$\endgroup\$ Feb 18, 2016 at 1:33
  • 1
    \$\begingroup\$ The +12V line is on the PCB, however I get these spikes on signals and other voltage rails. The reason to drive a relay with a relay is because sometimes you need switch monstrous power and the on-board relay may not be enough, because it is a way to simulate an inductive load and a perfect way to reproduce the problem. These "arms" are there providing solder jumpers, enabling connecting all commons without external cabling. May be removed in future revision. \$\endgroup\$ Feb 18, 2016 at 7:52
  • 1
    \$\begingroup\$ I guess the COM connection on the 2003 is a mistake and you fixed it with a fly wire? Those are cheap but not very good relays- I would suggest using better designed relays with higher coil-contact isolation. \$\endgroup\$ Feb 18, 2016 at 18:41
  • 1
    \$\begingroup\$ Oh yes... I forgot to mention that. It is now connected to +12V, as it ought to be. \$\endgroup\$ Feb 18, 2016 at 18:51

1 Answer 1


While you have freewheeling diodes on the relay coils, you don't have any kind of spike attenuation on the relay contacts. The contacts need transient suppression for the same reason that the coil driving transistors do.

The inductance of whatever load you are switching can cause a large (several kilovolts) voltage transient with a very fast rise time when the relay contact opens. The transients will then couple capacitively and inductively to the rest of the circuit (and over time destroy the relays). These spikes are sporadic in nature, as their magnitude varies with the amount of current that happens to flow at the instant the contacts open. You will sometimes see multiple smaller spikes when a relay closes, caused by the contacts bouncing a few times before finally settling.

To suppress these spikes, there are several options that can be either used alone or combined together for more difficult cases:

  • A RC snubber network won't eliminate the transient, but even with a rather large resistance it will significantly reduce the voltage rise time, greatly reducing the radiated and capacitively coupled EMF. It has the drawback of passing a slight amount of AC current even when the contact is open.


  • A bidirectional transient voltage suppressor diode is designed to start conducting significant current once the voltage over it reaches a certain treshold. They activate extremely fast (typically in the picosecond range), but they get costly when high transient energies are to be dissipated, and ratings above 500V are rare. Example: P6KE440CA

  • Metal oxide varistors are available for higher power and voltage ratings than TVS diodes, but they are inferior in response time (nanosecond range). They also have the drawback of having a lifetime limited to a few thousand activations, and they like to fail shorted, requiring external protection. Example datasheet

  • Gas discharge tubes contain a gas which ionizes when the voltage reaches a certain level, allowing the electrodes within the device to arc to each other. They are only available for large currents and voltages, and degrade over time.

  • Synchronous switching. Since you are switching AC, the current crosses zero 100 or 120 times each second. If you manage to time the relay actuation just right, you can (theoretically) open the relay with no current flowing trough it. You would need a mains voltage zero crossing detector and significantly more complex programming to pull it off, and it would only be possible with predictable and consistent relay closing and opening delays. The likely phase shift between voltage and current should also be taken into consideration.

  • \$\begingroup\$ I thought of MOVs, but I believed they are not fast enough to help. I didn't have any at hand to test it, I'll buy today and test again. \$\endgroup\$ Feb 18, 2016 at 7:55
  • \$\begingroup\$ Additionally I placed a 16V zener diode on the +12V rail that I had at hand, and didn't help at all. Aren't they fast enough, or the problem is something else? \$\endgroup\$ Feb 18, 2016 at 8:04
  • \$\begingroup\$ Zeners are slower than TVS diodes but do work for spike suppression. However, adding stuff on the control side of the board is treating the symptoms, not curing the problem. I would try TVS diodes across the contacts, not MOVs. Be aware that unidirectional TVS diodes are also available, but they would blow up on AC mains. You can also try the rc snubber network. A X2 (mains rated) 100 nF capacitor with a 100 ohm resistor in series should help, with the drawback of passing 2.5 mA when the switch is off. What loads are you driving? \$\endgroup\$
    – jms
    Feb 18, 2016 at 9:24
  • \$\begingroup\$ Unfortunatelly the loads are not known. May be small motors, power relays controlling large motors, or many KW machinery, or just commands to a conventional automation system, with thermostats, vanes, switches etc. A high Z input, lets say a 220V input on a control system (such as a PLC), will work with the snubber circuit? \$\endgroup\$ Feb 18, 2016 at 11:31
  • 1
    \$\begingroup\$ One thing that makes me skeptical, is I haven't seen such protections, on other systems. Most designs I have seen have just simple relays. Why in my situation I have this problem, while others do not? \$\endgroup\$ Feb 18, 2016 at 11:32

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.