home |  electronics |  toolbox |  science club |  tuxtalk |  photos |  e-cards |  online-shop


By Guido Socher


The mystery of electromagnetic interference



We have long known that you can not position a relay close to an avr microcontroller and switch high currents with it. What is little known is how easy it is to fix that problem.

_________________ _________________ _________________


How do I recognize a case of electromagnetic interference?

Electromagnetic interference, that is: the influence of strong magnetic or electric fields on avr microcontrollers results in random failures. The symptoms are similar to a memory leak or stack overrun in the software. Your program will function perfectly for some time and then suddenly the whole system is dead. You power cycle it and it starts to work again. The typical symptom of a memory leak except that there is no memory leak and the problem goes away if you stop the electromagnetic field.  

What to do about EMI?

Electromagnetic fields loose their strength with the square of the physical distance. The long known solution was therefore to physically separate high power circuits and avr microcontroller as much as possible.

I had used for may years a small circuit with microcontroller and relay to switch on and off a 25W light bulb. It worked perfectly. One day I decided to switch on and off 1000W electric heater and that is when the problem started. It would work for a couple of days and then the system would freeze completely.

emi shield made from steel
1) relay, 2) a piece of 0.5mm steel glued with epoxy on top of the microcontroller

Since I did not want to change the circuit I just took a sheet of 0.4mm (1/64 inch) steel and cut out a small piece, large enough to cover the microcontroller. I used a bit of epoxy-glue to stick it onto the the microcontroller.

Big surprise: the problem disappeared. Why does it work? Iron is obviously a good shielding material for both electric and magnetic fields but there are a lot of wires coming out of the microcontroller and they should be acting like antennas for all kinds of disturbances. Surprisingly this was not the case here. To prevent electromagnetic fields from going directly through the chip reduced it just enough to prevent any problems.  

That's cool, will it work for me?

EMI is a very complicated area. It is generally impossible to know for sure if it will work unless it is tested. It seems like such a little metal plate helps but it is just a matter of increasing the electrical field and the problem will come back.

There are some general guidelines like physical separation and shielding that will all help but it is difficult to say just how much is needed.

A save way to switch high power appliances is to build the relay into the appliance and then run a several feet (1 foot=30cm) long cable to the well shielded control electronics.

To have the control electronics and the relay as close as shown in the above picture will normally be a problem if the relay is carrying high currents. ... but as I have shown here sometimes there is still a way to fix it.  


© Guido Socher, tuxgraphics.org

2012-12-12, generated by tuxgrparser version 2.57