Electrical – Shield arduino for electrical interference

arduinointerferencerelay

I have an Arduino UNO controlling two high voltage relays via a switch. It also reads out a third relay, which is controlled outside of the Arduino. My setup looks like this:
Circuit setup

With the following representing circuit:
enter image description here

When I turn on the soldering station, the Arduino reads an interrupt on pin 2, where the switch is connected. This also happens when the 12V source is replaced by a car battery. The soldering station is also not grounded. Due to these facts I concluded it must be some kind of electrical interference, probably EMI. I have been looking all over the web to find a way to isolate the Arduino from the interference but I can't find a proper way.

Does anyone know how to shield the Arduino for the interference?

Thanks on forehand.

Best Answer

You can do several things to reduce the effects of interference on the pin2 input. There is no one answer of how to prevent EMI causing problems, each system is different and each system needs a different solution. But here's some general tips for you to try:

  1. Reduce interference at the source. This is the best, but it's not always possible. You could check that the switch on the solder station isn't too worn, but you're probably not going to gain anything here. I've written it anyway, because it's a good general rule.
  2. Reduce R1. Smaller pull-down resistors mean more current available and less susceptibility to EMI. If you were using 100k, I would definitely suggest a smaller value, but you might still see some gain from going below 10K.
  3. Filter/debounce. The usual approach to debouncing switches, with a capacitor, can help reject brief transient EMI. It's also generally a good idea.
  4. Sheilding. Put everything inside a metal enclosure, and connect the enclosure to ground.
  5. Wiring. Avoid long lengths of wire, and especially avoid long lengths of wire outside the enclosure. Where long wires are unavoidable, group them together to reduce loop area. If S1 needs to be outside the box, connect it using twisted pair (or even better, shielded twisted pair). Connect the shield to the enclosure.