Arduino with Relays

Hi Everyone, I am helping Azim with his question and moving it here for general discussion:

---------------------( COPY )---------------------
Hello
I am using Arduino Uno to control 3 DC appliances. When the Arduino switching the relays from ON to OFF state the Arduino is getting restarting.

I changed my power supply connections as your advice in: [Showing optical isolation]

Here is the schematic of the circuit.

]

Would you help me to overcome this issue?
-----------------( END COPY )----------------------

Please see this page for suggestions on how to solve this problem:

https://arduinoinfo.mywikis.net/wiki/Arduino-Project-Planning-Electrical

Think about this:

AC vs DC: Why do I care?
When you are switching power, you care if it is AC or DC. You care because there are different effects on the switching elements you use, which could be metal-contact relays, Power Transistors, Silicon-Controlled-Rectifiers or TRIACS.

Turning things ON:
When you make the connection to turn something on, current starts to flow. If the load is a nice pure resistance like a heater element then the current just starts up and stays the same. But if the Load is a motor or an incandescent lamp, there is a sudden inrush of current right at the beginning. Your switching device has to be able to handle that.

Turning things OFF:
This is more of a problem. When you break the connection to turn something off, bad things can happen, especially if the load is 'inductive' like a motor, a magnet, a relay coil etc. Such loads produce a sudden high voltage in the reverse direction, that can spark and damage relay contacts or internally damage transistors, SCRs, TRIACS. There are two approaches to handling this:

Make sure the switching device is rated to handle this type of load. Notice that relays often have two ratings: A resistive load in Amps, and a Motor load in Horsepower which considers these situations.
Use some method of suppressing the high voltage transient. Like these:

  • Connect a reverse diode across magnets and relay coils.
  • Connect a MOV (Metal Oxide Varistor) surge suppressor across the load.
  • Connect some resistor-capacitor combination across the switching contact

Try and use a free wheel diode across the red ana yellow cables near the relays. Cathode to positive, yellow, anode to the negative, red.

Hi,
I think we need to see a picture of the project, to see how it is layed out.

Even if it is a 12V system, the controller and its wires should be kept well away from the relay switched 12V wires.

The valve solenoids will be highly inductive so the relay contacts will be arcing for a start, which means large Back-EMF which means high EMR.

Does the problem disappear with the pump and valves disconnected?

I agree with @terryking228, you will need some supression on the loads you are switching.

Tom... :slight_smile:

Railroader:
Try and use a free wheel diode across the red ana yellow cables near the relays. Cathode to positive, yellow, anode to the negative, red.

Suppression components need to be at the source of the noise and voltage/current surges, in this case the pump and the valve solenoids.
Tom... :slight_smile:

Hi,
"Reverse" diodes for transient voltage suppression: Type 1N4004 or so are OK: Actually types 1N4002 to 1N4007 should be fine. Or equivalent "Silicon Rectifier" types.

If the valves/motor use crimped connectors I have crimped the diodes in with the wire. Or you may need to solder them. As @TomGeorge said, they need to be very close to the valve / motor.

Pay attention to the "Where Is Ground?" question.

Azim, please post here about what you do and what your results are. Let me know if you have problems with the Forum.

I would add a single .o1uf cap to each of the wires right at the relay terminal block. Push the short leads right in with the wire. Also. Terry, what is the wire size between the relays and the other devices? Try using much larger wire.

Paul

The relays working well when the pump/valves are disconnected.

The relays working well when the pump/valves are disconnected.

OKOK, then this is the famous "EMI - ElectroMagnetic Interference" Monster which many of us Arduino/Microcontroller enthisiasts know only TOO well..

See THIS PAGE for suggestions on how to attack this.

Basically:

You have an interesting project in mind, you have acquired the components you feel you need, and you've wired them together. You have written a sketch and uploaded it to Arduino. What could go wrong?

Problems: Sometimes, especially when controlling lights and other loads such as motors, pumps, solenoids etc., problems occur. Symptoms may include:

  • Lockup of the Arduino controlling the relays and switching. Everything just stops.
  • Loss of ability to communicate with a PC connected to the Arduino by USB
  • Noise and erroneous readings on sensors or attached devices when relays or loads are switched
  • LCD display stops working or displays the wrong characters

What is really happening here?

You have lots of wires running around close to each other. Electrical Reality says that you have created lots of Little Resistors in these wires. And you've created lots of Little Capacitors that couple the wires together when the voltage on a wire changes. And you've created lots of Little Transformers that couple the wires together when the current flowing in a wire changes. We will discuss ways to prevent these inadvertent components from causing problems.

Some possible solutions:

  • Isolation of Arduino from relays and their switching transistors and power supply ("usually Opto-Isolation")
  • Physical isolation of your high power wiring from arduino and it's wiring
  • Creating a "Common Ground Point" (usually the negative terminal of your power supply)
  • Grounding your Arduino system Common Ground Point to the building ground
  • Use of shielded cables for critical circuits, which are usually sensors or wires that can not avoid being close to high-power devices.

In other words, denoice the loads. You have wireless "signals" travelling into Your UNO.

terryking228:
Please see this page for suggestions on how to solve this problem:

Arduino-Project-Planning-Electrical - ArduinoInfo

Totally off-topic (apologies) but I miss the old style of your pages :wink:

I miss the old style of your pages :wink:

Sigh... things change... The old WIKISPACES system went away. At least now what I have is based on MediaWIKI which is what WikiPedia uses... so it SHOULD be around for a while.

Now: ArduinoInfo.Info still lives...

...at least until I time out...

Anyone interested in helping out / backstopping ArduinoInfo.Info please email me... I am adding some RaspberryPi and especially ESP32 How-To.