Go Down

Topic: Controlling 220V devices with relay’s resets microcontroller. (Read 572 times) previous topic - next topic


I want to control some parts of my laser cutter with an atmega1284p. Besides the laser cutter I also wanted to control 3 220V devices. An exhaust fan, a water pump and a compressor with relay's. Everything worked fine until I connected the 3 220V devices. If I switch off one of the devices the microcontroller reset's itself 40% of the times. This is only when I connect the 220V devices. Also, I'm catching an unintended interrupt on a pin if a 220V device is switched on (interrupt pin is connected to a switch and pulled down with the internal pull down.)

Without them the microcontroller the relay's work as expected. So, since the 220V devices are not electrically connected to the microcontroller board, I expect there's some massive noise generated on the 220V line when switching on and off. So, what can I do to fix this? I've already "fixed" the noise on the interrupt by ignoring interrupts when switching the relay. But the resetting of the microcontroller can't be fixed in software… Do the "Single Phase EMI Filters" work for this kind of problem? And how should I implement them. If I put one between the relay's and the external device, do they filter only noise to the device, or also noise coming from the device?


You need more power supply filtering, and your arduino should be enclosed in a grounded metal box.
ATtiny core for 841+1634+828 and x4/x5/x61/x7/x8 series Board Manager:
ATtiny 841/1634/828/88/861/167 breakouts, mosfets, touch sensors and prototyping board in my store http://tindie.com/stores/DrAzzy


I presume that the coils are driven by a DC voltage.  That DC voltage may be somehow connected to the Arduino's 5V supply - maybe it is the 5V supply, or maybe it's something like a 12V supply from which the Arduino's 5V is derived.  A schematic would be very helpful for a diagnosis.

If any of that is so, you'll need a suppression diode on each of the relay coils.  The diode is connected directly across the coil, with the cathode connected to the positive terminal.  When the coil is energized, the diode is reverse-biased, and doesn't conduct.  When the coil is released, the diode conducts and dissipates the coil's inductive kick.  Maybe you have those already; I can't tell from your post.

I also note that all of your 220V loads are motors.  A motor load draws much more current when starting than it does running.  High starting current can cause voltage dips that persist for longer than you might think.  Aside from that, there's a possibility that the motor manufacturer wasn't thinking about sensitive electronics on the line when he designed his motor, so those motors may not be particularly kind to the power line when they start, or when they operate.  To address those issues, consider DrAzzy's advice, above.  You might consider using two filter capacitors - a "bulk" device of several microfarads, or even tens or hundreds of microfarads, and a ceramic disk in the neighborhood of 0.1 microfarads.  The small capacitor has a low internal resistance, and filters spikes, while the bulk capacitor delivers current to the circuit when the power circuit struggles to keep up.


Hi, thanks for the reply's.
attached the schematic for the relay's I've used.

Don't think the power supply is the problem. I've tried a lab power supply on a different group, still got resets.
Also the grounded metal box is a bit of a problem since I already designed and made the pcb.
Anyhow, I think I solved the problem! I've found some ferrite cores and thought it wouldn't hurt trying them out.

And it worked! Didn't expect it would work, but wow, amazing. I "relayed" the hell out of it and haven't got a single reset or error.  So, is this a reliable solution?


Hello, i have the same problem, only with induction loads. Can you please suggest me which type ferrite to use in this case? Thank you!


Hi Satoer?

Is it the load that goes to the ferrite?

I am facing the same problem.


Hi guys, if your relay board is opto-isolated and you pull the output pin low to energize the relay, you probably don't need a GND wire from the relay board to the Arduino, you just need the VCC from the Arduino 5V pin and 1 wire for each relay input pin IN1,IN2 etc. eliminating the ground wire can eliminate a lot of noise pickup. You will need a separate power supply for the relay board though, which you should have anyway.


So, is this a reliable solution?

I would still try to find out what the problem is, fix that, then incorporate the cores later.
Always blame yourself.


Here's a picture of a typical board, this one from SainSmart, on the left the external power wires are:
Red........... + from external supply marked "JD-VCC" or "RY-VCC"
Green........ -    "          "           "      ground.
Between them you can see the jumper that's normally across JD-VCC & VCC, remove it, turn it 90 degrees and put it back on the open VCC pin so it won't get lost.
On the right are the control wires from Arduino:
Blue is VCC from Arduino 5V or IOREF pin.
Yellow is input to IN1 from Arduino output pin.
GND wire to Arduino is not needed.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131