Use single Arduino pin to drive two opto-isolators in relay module

I have an Arduino project that uses quite a few pins and a SainSmart 8 channel relay module. The relay module is used to turn off a water pump when the water level in a bucket reaches a certain point.

The lead wires of the pump are connected to one of the relays in such a way that energizing the relay coil breaks the circuit, causing the pump to stop.

I would like to add redundancy to this setup, by wiring the pump leads through two of the relays on the module in series, so that the activation of either one or both of the relays would turn the pump off.

Now comes the tricky part: I have only one pin available on the Arduino (the project uses several other sensors and a few LEDs).

Could I use the one Arduino pin and then jumper it to two of the relay pins on the relay module?

According to SainSmart the opto-isolators that trigger the relay coils draw between 15 and 20 mA of power. As I understand, an Arduino pin can supply a max of 40mA; so in theory there wouldn't be a problem in using one Arduino pin to drive two opto-isolators.

I've put a multimeter in line with the Arduino and read the current--the draw is a consistant 160mA regardless of whether the relay is being triggered or not.

Could I use the one Arduino pin and then jumper it to two of the relay pins on the relay module?

Yes.

As I understand, an Arduino pin can supply a max of 40mA

No an Arduino pin should not be connected to a circuit that will draw more than 40mA, that is not the same thing.

Yes, but the opto-isolators might have a gain of 100% which means current_out = current_in. It's surprising how much power an optoisolator requires. They're not like magic transistors with isolation as well as a lot of gain.

Measure the current into one of those inputs with no Arduino connected - just use a multimeter on current mode to jumper across 5V. If it's above 15mA then the Arduino will not reliably drive two relays from one pin.

If it's above 15mA then the Arduino will not reliably drive two relays from one pin.

I would disagree.

In what way Mike? Two inputs drawing more than 15mA each from one Arduino pin puts it into the range where the output voltage is starting to sag. That may be a problem for the optoisolators and hence the relays, which need more current to drive them.

look up the data sheet for the opto.

the opto, as far as the arduino is concerned, is just an LED.

you can see the curves in the data sheet as regards saturation of the ouput side of the opto. chances are the relay coil is pulling a fraction of the rating of the opto. and you can reduce the the power. Check the coil data sheet. I think your primary draw is to establish the field.to sustain the field. the current is less. meaningg that you can drop the current to the opto and as long as it pulls in the relay, it will have more than enough to sustain it.

IIRC, 10mA de-rated the opto to 90%

try running 5ma to a relay. if it works you shold have success at 10mA for operation.
one resistor to each opto would be needed.

Most of those type of relay boards have a 1k resistor, a 1.2volt opto LED, and a 1.8volt indicator LED in series.
That is 2mA drive current on a 5volt Arduino.
So you can control ten relays with one Arduino pin.
Check the parts on the board. If you see a LED when the relay is on, and you see a "102" resistor next to it....

The stated 40mA could be coil current. But then again, I've see lots of mistakes in those adds.
Leo..

OptoRelayChannelData-575.jpg

MorganS:
In what way Mike? Two inputs drawing more than 15mA each from one Arduino pin puts it into the range where the output voltage is starting to sag. That may be a problem for the optoisolators and hence the relays, which need more current to drive them.

Yes but you are sinking current not sourcing it. Voltage sag does not come into it.

Besides driving the opto-couplers from one pin, if you have fail-safe in mind, this is not the best idea in my opinion:
The lead wires of the pump are connected to one of the relays in such a way that energizing the relay coil breaks the circuit, causing the pump to stop.

I think you should reverse this logic. So if the relays are not energized, the circuit is broken.

That way you also take into account failure of the arduino, breaking of wires, arduino power source failure, etc.

Just my 5 cents :wink:

Hi,
If the power supply to the arduino is removed, will the pump stop?

From what I see you have your logic the wrong way.

The arduino should keep the pump ON until it is full.
Removing signal from the relay board then turns the pump off.
That way if you have a power failure to the arduino the pump will turn off to prevent over filling.

Tom.... :slight_smile:

Thanks everyone for the in-depth replies. A person can certainly learn a lot from you all :slight_smile: !

Gateway and TomGeorge: It would indeed be better to have the pump stop when the relays are not energized.

Thanks again!