Driving relays from Arduino pins

I have been helping another forum member (@agili) with his project which at its heart involves controlling 8 relays in a timed sequence connected to a Nano. I do not have 8 relays so I have been testing code using 8 LEDs and the usual Serial monitor debugging output

For the majority of the time the relay sequence involves 2 or 3 relays being on but during some recent testing @agili encountered a problem when he turned on all 8 relays at the same time as part of his testing only to have them all turn off again immediately, which had not happened during my testing with LEDs

During our subsequent exchange of messages I fairly quickly established that the relays were connected directly to the 8 Arduino pins, so no wonder there was a problem when 8 of them were turned on !

The only details of the relays that I have are as follows

  • Supply voltage – 3.75V to 6V
  • Trigger current – 5mA
  • Current when relay is active - ~70mA (single), ~600mA (all eight)
  • Relay maximum contact voltage – 250VAC, 30VDC
  • Relay maximum current – 10A

So, the question arises as to the best way to drive the relays which in turn control a water pump and valves. I do not have the requisite expertise to provide the answer beyond perhaps using MOSFETs and an external power supply to provide the necessary current, but as to exactly which MOSFETs and how they should be wired, that is outside of my area of knowledge

Any suggestions would be gratefully received by @agili

I am posting this as @agili's native language is not English and it was easier for me to formulate the question. Having said that, his English is pretty good so he will chime in here as and when needed

1 Like

I would be inclined to look at the opto-isolated relay modules for inspiration and reverse engineer their circuit. As long as you use one with snubber diodes and separate power, that should pretty much be exactly what you need.

Yes, use the cheap and readily available modules which will reduce the load on the arduino to within expected parameters. If you want to be unique and design things (I have been doing this recently) then it is mostly reverse engineering of these although there are a number of options. It depends on the requirements as usual. I found the standard modules to be relatively robust considering some peoples attitude to them and I have been testing them in a harsh environment

These are the key specs.

The 5mA trigger current should be no problem connected directly to the Nano pins... from the Nano spec sheet...
image

The problem arises if the relay coils are being powered by the Nano 5V pin. 600mA is quite a lot of current... if the Nano is being powered via Vin, then this 600mA is being drawn through the on board voltage regulator - this is likely being overloaded.

A better solution is to power everything with an external 5V supply (the Nano & the relay coils). These can often supply around 2A which should be plenty.

1 Like

My go-to device for controlling relays in that range is the ULN2803 solenoid/relay driver. Eight outputs with suppression diodes that can handle up to 300mA @ (IIRC) 24V each.

Sparkfun and Adafruit both carry them. Surprisingly, I've never seen an arduino module that has one of these very useful chips along with headers, screw terminals, etc.

Biggest problem newbies have with relay modules is the LOW true / HIGH true issue. If not initialized correctly in setup(), all 8 will come on with first power, 580mA surge.

We could ask to see the code and a schematic diagram including a clear depiction of how power for the relays is provided…

like 10000 times happens here, but it is clearly a power issue as is being said.

If the program logic requires all 8 to energize at once, the power supply must meet the instant demand for the addition 600 mA. Well enough not to scramble the microprocessor, which might enjoy its own supply a and/or filter and isolation from the inevitable sag.

a7

Use SSR's. Only needs TTL drive to control more amps than you need.
ssr

Most of the relay boards have an opto coupler thats the only arduino load. The 70ma or so each coil needs is fed thru the opto, not the Arduino.

But the PS needs 200ma for the Arduino plus 70ma times 8 coils or 560mA. So you need a solid 1A plus whatever else is running.

Thanks for the replies

Sold State Relays or an 8 way SSR module seems to be the easiest solution to implement

@agili I have no idea of the voltage and current that the relays need to switch to control the pump and valves but you need to take that into account before deciding what to buy and the relays need to be powered from an external source

I wil be using a 40Amp contactor to control a 220v pompe , the contactor will be set to on state with less then 5Amp, and relays connected to arduino uno are 10amp and that should be more then enough to control the Contactor. Solonoid valve are 24V , 4 amp current and that should be enough using a 10amp relay.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.