Subscribe to Arduino Academy and start learning today for FREE!

Arduino / Relay Interference


You have a relay connected to your Arduino, and after a while your Arduino stops running. That’s not supposed to happen, these things loop forever, right?

It’s a common issue when running inductive loads from a Arduino controlled relay. Many folks think it’s a voltage problem and try throwing capacitors on the relay supply, or using a opto isolated relay (separate power and ground). These solutions may work, but more often than not, they don’t.


So what is causing the problem? It’s EMI!
The back EMF from an inductive load causes the relay contacts to act like a spark gap transmitter, scrambling the processor. The Atmel chips are very susceptible to RF.

Not to worry, it’s not permanent, it clears when you cycle power.

How did we discover this and how do you keep it from happening?

We have a project where a Nano and a common relay board are installed in a small case. When all the parts are assembled on the bench, it works fine. When crammed together in the box, it works for a while, then freezes. But only with a inductive load attached to the relay. With no load, or a resistive load, it runs forever (well, 3 days or more, forever was too long a test period). We have tested this six ways to Sunday with a variety of Arduino and Arduino clones.

Become the Maker you were born to be. Try Arduino Academy for FREE!


Installing snubbing diodes on relay coils and motors (the common solution) can be difficult (they don’t work on ac devices) or void a warranty on many household appliances.

I series connected a resistor and a capacitor together, and connected those across the Arduino relay contacts (as close to the relay contacts as you can get). This quenches the back EMF, and prevents the Arduino from locking up. There you go, a $0.30 solution to a nagging problem.

Make sure your capacitor is rated for the voltage you expect to see. I used a .1 uF 50v Tantalum, and a 100 Ohm 1/4w resistor on a 26v circuit. My load was another relay. In another application, the load was a 120v motor, so the cap was 150v.

Notify of
Inline Feedbacks
View all comments
Lionel G
6 years ago

Excellent !

6 years ago


Chris Taylor
6 years ago

As a secondary safety net you should consider using the watchdog timer to reset the chip when it "hangs". On a project my dad and I did recently we faced a similar problem controlling AC pumps with an Arduino, the watch dog timer seems to have done the trick. Of course I agree the EMF issue needs to be addressed as well, but the watch dog adds that extra level of resilience.

Science Veritas
6 years ago

Use the diode on DC devices in low power circuits. Adding the RC snubber as well as the diode is recommended on higher power drives. On AC drives just the snubber and on occasion, two zener diodes anode to anode can help. Just use Zener diodes of twice the peak voltage.


Would love your thoughts, please comment.x