Arduino Forum

Using Arduino => Motors, Mechanics, Power and CNC => Topic started by: askduino on Nov 22, 2013, 01:01 am

Title: Arduino Resetting Itself with Relay
Post by: askduino on Nov 22, 2013, 01:01 am
Hello,

I am using an arduino mega 2560 with ethernet shield, to control an 8 channel relay http://www.amazon.com/SainSmart-8-CH-8-Channel-Relay-Module/dp/B0057OC5WK. Everything works perfect, except when I turn on OR off a 25w AC fan connected to the relay, the arduino resets itself. This doesn't happen everytime, but about 80% of the time, I think this has something to do with the fan(motor) being an inductive load, but I'm not entirely sure. Once the fan has been turned on, it has no issue running, I also have no issue controlling other lighting devices of higher wattages connected to the relay.

A 12v 30A power supply is powering the arduino, along with 4 N-Channel mosfets connected to 4 LED strips. The coils of the relay is powered by a 5v 30A external power supply, and configured to use opto-isolation, whereby the jumper is removed between jd-vcc and vcc, and jd-vcc and ground are connected to external power supply. The relay driver vcc and input pins are connected to the arduino +5v and output pins respectively. The output pins of the arduino are also controlling the gate of the mosfets. To stabilize the current/voltage, I have also placed one 2200uf capacitor on the 5v and 12v rails of the power supply.

From what I see the relay board itself already have flyback diodes to protect from voltage spikes caused by inductive loads? I've spent hours trying to search for a solution, but can't seem to find it. Is there a way to fix this or do I need to get a solid state relay specifically for the fan? Thanks in advance.
Title: Re: Arduino Resetting Itself with Relay
Post by: Chagrin on Nov 22, 2013, 03:20 am
Just to verify, from the Arduino to the relay board you're only connecting VCC and the relay IO pins (no GND)?

FYI, the diodes on the relay board are there to protect from the EMF spike caused by de-energizing the relay coil. They do nothing with respect to EMF spikes from, in your case, the fan. Hopefully someone else will comment on that.
Title: Re: Arduino Resetting Itself with Relay
Post by: askduino on Nov 22, 2013, 03:37 am

Just to verify, from the Arduino to the relay board you're only connecting VCC and the relay IO pins (no GND)?


Hi Chagrin, that is absolutely correct.


FYI, the diodes on the relay board are there to protect from the EMF spike caused by de-energizing the relay coil. They do nothing with respect to EMF spikes from, in your case, the fan. Hopefully someone else will comment on that.


Oh ok, appreciate the enlightenment, hopefully more help follows.
Title: Re: Arduino Resetting Itself with Relay
Post by: nilton61 on Nov 22, 2013, 07:13 am
Putting a small capacitor and/or a varistor(both appropriate rated)  across the relay  contact (not the coil) might help.
Title: Re: Arduino Resetting Itself with Relay
Post by: dc42 on Nov 22, 2013, 12:48 pm

Putting a small capacitor and/or a varistor(both appropriate rated)  across the relay  contact (not the coil) might help.


The capacitor needs to be rated for AC use to a voltage at least as high as your mains voltage. Also it should have a resistor in series with it. This arrangement is called a snubber. It can be connected either across the relay contacts or across the fan. It's hard to suggest values without knowing more about the fan, but for 230V mains, 0.1uF in series with 100 ohms might be a good place to start. For 110V mains I would double the capacitor value and halve the resistor.
Title: Re: Arduino Resetting Itself with Relay
Post by: askduino on Nov 22, 2013, 04:36 pm
Thank you for the replies, I don't currently have a high voltage capacitor on hand at the moment. I will try it once I get my hands on one. For the resistor, I guess I will need to find one that supports more than 25w as well.
Title: Re: Arduino Resetting Itself with Relay
Post by: dc42 on Nov 22, 2013, 05:10 pm

For the resistor, I guess I will need to find one that supports more than 25w as well.


No, however the resistor must be capable of tolerating the peak mains voltage for very short periods. A 0.5W or 1W metal film resistor will do.
Title: Re: Arduino Resetting Itself with Relay
Post by: askduino on Nov 24, 2013, 02:51 pm
All right, I will post back the results once I get hold of the parts and test it. Appreciate the help.
Title: Re: Arduino Resetting Itself with Relay
Post by: askduino on Dec 09, 2013, 10:50 am
Thanks dc42, just managed to hook up the parts with the values you provided to create the RC snubber and it works perfectly, absolutely no more resets when turning on or off the fan. It is very stable now.

(http://i41.tinypic.com/30m7p1g.jpg)

Hopefully this will help someone else with the issue with inductive load when using it with a relay.
Title: Re: Arduino Resetting Itself with Relay
Post by: dc42 on Dec 09, 2013, 11:42 pm
Thanks fro reporting back - I'm glad you got it working!
Title: Re: Arduino Resetting Itself with Relay
Post by: jnmbk on Mar 13, 2017, 01:10 pm
Hi,

I think I'm having the same problem here. I'm trying to control two 220V motors with the very same 5V relays in the picture. And Arduino sometimes reset when two motors are stopped at the same time.

I want to try this RC snubber but I got confused when I saw the image askduino posted. Do I need to connect this parallel to the coil (220v part), or serial?
Title: Re: Arduino Resetting Itself with Relay
Post by: 756E6C on Mar 13, 2017, 01:23 pm
The snubber should go across the relay terminals, wouldn't hurt to have a 300 volt varistor across the motor leads.
Title: Re: Arduino Resetting Itself with Relay
Post by: Thomen on Mar 30, 2017, 05:34 am
Hi I have a similar relay operating a 12v pump my arduino resets when it shuts off.. I was hoping to learn how to work out which parts I need to use to create a snubber.. my relay has the 12v power source + the positive terminal of the pump I'm running in it.. so would I connect the snubber across those 2 lines?
Title: Re: Arduino Resetting Itself with Relay
Post by: Wawa on Mar 30, 2017, 07:19 am
Hi I have a similar relay operating a 12v pump my arduino resets when it shuts off.. I was hoping to learn how to work out which parts I need to use to create a snubber.. my relay has the 12v power source + the positive terminal of the pump I'm running in it.. so would I connect the snubber across those 2 lines?
For inductive DC loads, use a diode across the pump.
Cathode (ring) to +12volt.
The diode has to match the current rating of the pump.
Leo..
Title: Re: Arduino Resetting Itself with Relay
Post by: BryanX on May 15, 2017, 03:59 pm
Hello,
I am facing the same issue with switching off aquarium water pump with relay. Thinking of buying the rc snubber from this aliexpress vendor. Is it suitable and how do I connect it to the relay?
(https://ae01.alicdn.com/kf/HTB15tSoMFXXXXXDXXXXq6xXFXXXM/206139006/HTB15tSoMFXXXXXDXXXXq6xXFXXXM.jpg?size=36938&height=439&width=500&hash=86ee5dc561f47f784d6bbe7b4d50193a)

https://www.aliexpress.com/item/Free-Shipping-Solenoid-inductive-load-RC-circuit-snubber-circuit-relay-contact-protection-Electronic-Component/1000001965161.html (https://www.aliexpress.com/item/Free-Shipping-Solenoid-inductive-load-RC-circuit-snubber-circuit-relay-contact-protection-Electronic-Component/1000001965161.html)

Please help.

Thanks
Title: Re: Arduino Resetting Itself with Relay
Post by: mattitude on Oct 03, 2018, 02:18 am
Hello,
I am facing the same issue with switching off aquarium water pump with relay. Thinking of buying the rc snubber from this aliexpress vendor. Is it suitable and how do I connect it to the relay?

Please help.

Thanks
I have purchased one of these but haven't had luck with it solving my problem.   Did you have any luck with this?
Title: Re: Arduino Resetting Itself with Relay
Post by: Wawa on Oct 03, 2018, 02:31 am
Snubber circuits are for AC loads.
Make sure the parts are rated for YOUR mains voltage and load.
A snubber circuit with MOV for 110volt will blow apart when connected to 230volt mains.

Snubber circuits won't work for e.g. 12volt DC pumps.
In that case a diode across the pump could be needed.
Leo..
Title: Re: Arduino Resetting Itself with Relay
Post by: Feede_dandrea on Oct 09, 2018, 12:56 pm
Hi all, I'm having the same issue with a Fan. I'm trying to control a fan speed with an MQTT protocol and it works perfectly fine when its on.

The problem is that when the fan is off, it turns back on after some time. So, should I put the capacitor and resistor in every relay I'm using? I have tried everything except that. Thanks in advance
Title: Re: Arduino Resetting Itself with Relay
Post by: heinburgh on Dec 19, 2018, 04:02 pm
The capacitor needs to be rated for AC use to a voltage at least as high as your mains voltage. Also it should have a resistor in series with it. This arrangement is called a snubber. It can be connected either across the relay contacts or across the fan. It's hard to suggest values without knowing more about the fan, but for 230V mains, 0.1uF in series with 100 ohms might be a good place to start. For 110V mains I would double the capacitor value and halve the resistor.
Hello forum,

I have a mega that runs a relay - on NC it powers a 20A contactor and on NO the same. I inserted an F1013 capacitor with 100ohm resistor in series across both the NC and common contacts, and again the same across the NO and common contacts.

The relay energises fine, which means it cuts power on the NC contact but as soon as the coil releases, it resets the arduino.

I power the system using a 6V sealed lead acid battery with a small 220V to 6V charger, and the relay is powered straight from the battery through a dedicated 5V power supply (5A rated.)

From reading this thread I was sure I had it all 100%, but I'm still missing something.

Any ideas?
Title: Re: Arduino Resetting Itself with Relay
Post by: D4R13L on Dec 29, 2018, 11:05 pm
Hello everyone!
Im having same problem with my ESP32 and a two relay module.
I can controll lights and all with no problem, so i tried to control my motorcycle.
When I turn the main switch on (Relay ON) it works just fine, but when I manually start the engine, it idles for about a minute and then the Relay and the ESP32 restarts on his own, so the motorcycle dies and I have to restart everything, like if it´s stucked. 

Any ideas?


NOTES:
Esp32 is powered by the motorcycle Battery( 12V-10A Battery, wich is transformed to 5V-1A) or a (5V-1A cellphone external battery).
The relay is powered by the ESP32 (It means VCC, IO pins and GND are conected to ESP32)
The relat outputs are conected good. (GND-->Common // V-->NO).


I hope anyone can help me, i've tried the capacitor and nothing, today im tryign with the diode for DC, but im not sure if it's going to work...


THANKS!!
Title: Re: Arduino Resetting Itself with Relay
Post by: Laggylarry on Feb 17, 2019, 05:32 pm
Hello I am also looking for some help on this. My setup is a little different.  I'm using two relays to alter the direction of a dc motor.   I aswell get the Arduino resetting when turning off relay.  See photo for how the relays are withered up.   I am just looking for help on where to put the Diode on my set up.   Any and all help is welcome. 
Title: Re: Arduino Resetting Itself with Relay
Post by: outsider on Feb 17, 2019, 08:43 pm
I would use a full wave bridge rectifier sized to the motor's voltage and stall current, which is?
(http://forum.arduino.cc/index.php?action=dlattach;topic=200393.0;attach=295317)(http://forum.arduino.cc/index.php?action=dlattach;topic=200393.0;attach=295319)
Title: Re: Arduino Resetting Itself with Relay
Post by: Laggylarry on Feb 18, 2019, 04:38 am
Looks like the motor is 24v 5a.    Thannks for the help so far!!!

Title: Re: Arduino Resetting Itself with Relay
Post by: Laggylarry on Feb 18, 2019, 05:07 pm
Outsider!!!   Your amazing.  I had a flat rectifier rated for 4amps.   Hooked it up and problem solved.  Thanks so much!!!!!

FYI. This is what I am building

https://youtu.be/sEU3bitgCUc
Title: Re: Arduino Resetting Itself with Relay
Post by: ecovolt on Jan 06, 2020, 08:49 am
Hello,
I am facing the same issue with switching off aquarium water pump with relay. Thinking of buying the rc snubber from this aliexpress vendor. Is it suitable and how do I connect it to the relay?
(https://ae01.alicdn.com/kf/HTB15tSoMFXXXXXDXXXXq6xXFXXXM/206139006/HTB15tSoMFXXXXXDXXXXq6xXFXXXM.jpg?size=36938&height=439&width=500&hash=86ee5dc561f47f784d6bbe7b4d50193a)

https://www.aliexpress.com/item/Free-Shipping-Solenoid-inductive-load-RC-circuit-snubber-circuit-relay-contact-protection-Electronic-Component/1000001965161.html (https://www.aliexpress.com/item/Free-Shipping-Solenoid-inductive-load-RC-circuit-snubber-circuit-relay-contact-protection-Electronic-Component/1000001965161.html)

Please help.

Thanks
You have to connect it in parallel across the relay contacts .