Go Down

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

satoer

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?

DrAzzy

You need more power supply filtering, and your arduino should be enclosed in a grounded metal box.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

tmd3

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.

satoer

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?

alkotech

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!

purwanu

Hi Satoer?

Is it the load that goes to the ferrite?

I am facing the same problem.


outsider

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.

larryd

Quote
So, is this a reliable solution?
Yes.

I would still try to find out what the problem is, fix that, then incorporate the cores later.
.
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

leonardojc

I use a RC filter in series with relay contacts.
R=100ohm
C=100nf




Theory:


Jiggy-Ninja

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.
Flyback diodes fix a different problem, not this one.
Anyhow, I think I solved the problem! I've found some ferrite cores and thought it wouldn't hurt trying them out.
It'd help if you told us what those wires were. The control signals? The load?
I use a RC filter in series with relay contacts.
R=100ohm
C=100nf


That filter is not in series with the contacts.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

allanhurst

All your loads have electric motors - which take a very large inrush ie startup current.  This can cause interference as you found. The amount depends upon when exactly in the mains cycle the relay contacts close - unpredictable.  Hence it wouldn't cause your reset problem every time.The same applies to turning off, with the extra problem of suddenly open-circuitiing an inductor - the motor. This can give a large voltage spike.

 Adding a series inductor - your ferrites - slows down both these pulses, and reduces interference.  A good solution

The various 'snubber' suggestions would reduce interference ( and sparking at the contacts) when the relay contacts opened .  May also be worth doing to extend the contact life.

regards

Allan

dlloyd

A revived thread, but very informative. I agree with allanhurst ... a good solution.

I also think there's still room for improvement. My thoughts on a perfect relay board would be:

  • Configured by default to use opto isolation.
  • Flyback protection (diode + zener) on coil to improve turn-off time as opposed to diode only solution. This reduces turn-off bounce time and contact arcing.
  • Ferrite core in series with relay COM terminal to slow the rise/fall of voltage spikes across the contacts.
  • RC snubber designed to handle inductive load at only up to 50% of the relay's VA capacity.
  • Large MOV, sized to help protect and work with the snubber, further reducing contact arcing by clamping/limiting any remaining high energy spikes.
  • Good PCB design and component quality meeting all safety approval regulations.
Hmm, somehow I seem to have over looked cost as a consideration.

myggle

I'd love to know how much they'll sell for if you build them!

cethal

Flyback diodes fix a different problem, not this one.It'd help if you told us what those wires were. The control signals? The load?That filter is not in series with the contacts.
I tried the serial RC out in parallel to the inductive load and also works.

Go Up