Driving a 8 channel Solid state relay board with a 74HC595 shift register?

Hello All,

I am currently playing around with an 8 channel solid state relay board, and i'm trying to make it work with fewer wires. For that, i've come across SIPO shift registers, more specifically the 74HC595.

From what I can gather, this register can translate a byte into 8 separate 5v signals, 10mA individual and 70mA combined max.

The SSR board is your typical bog standard cheap thing from ebay. Fairly basic, below 2.5v it switches to off, above 3.3v it switches on, has a 2mA trigger current.

So one would say there has to be a way to make this work, but apparently its not quite that simple. Ive used the sample circuit found here, along with some of the code. I've replaced the LEDs with the relay channels, and the resistors are 220ohm. The whole thing is powered from a 1A 5v power supply. Ive also put a capacitor on the latch pin and one on the power going to the register to try and get it a clean feed.

But for some reason I just keep getting incoherent sputtering from the registers channels. When I have the byte turn on channels one by one, it works up until 4 or 5 and then it just quits. Ive measured voltages everywhere and it all seems fine. Direct connect controlling it from the arduino works, so the board is not faulty. I feel like I'm messing something up here, but I have no clue what.

Does anyone know of a working example of how I should be doing this?

Sounds like a lack of power.

The link for your board does say 2.5mA trigger current, but it also mentions 90mA working current. I suspect that your shift register can't drive all eight at a time, as you observe.

Sokonomi:
Ive also put a capacitor on the latch pin...

Longs standing error, that they refuse to correct.
There should be NO capacitor on the latch pin, only one from VCC to ground.
The diagram seems to be correct, the Fritzing pictures are NOT.

Sokonomi:
...and the resistors are 220ohm.

The resistors are for the LEDs.
If you drive relay board inputs, then there should be NO resistors. Just a direct connection.
Leo..

How much current do the relays need all together? There must be a +power to the relay board feeding the coils of the relays. Maybe that current exceeds that 1A available.

Railroader:
+power to the relay board feeding the coils of the relays.

Most of the Solid State Relays that I know of don't have a coil. ;-p

Erik_Baas:
Most of the Solid State Relays that I know of don't have a coil. ;-p

You're prefectly right! Likely time to go to bed here....

You need a TPIC6595 to sink the relay coil current, and a big enough supply for however many coils there are.

Or go Solid State Relay
TPIC6C595 still works well.

Now we are 2. SSR... Solid State Relay.....

Sokonomi:
So one would say there has to be a way to make this work, but apparently its not quite that simple. Ive used the sample circuit found here, along with some of the code. I've replaced the LEDs with the relay channels, and the resistors are 220ohm. The whole thing is powered from a 1A 5v power supply. Ive also put a capacitor on the latch pin and one on the power going to the register to try and get it a clean feed.

Did you try the circuit and code provided in the example to prove your circuit and how to control it before making your changes?
Thanks.. Tom.. :slight_smile:

wildbill:
Sounds like a lack of power.

The link for your board does say 2.5mA trigger current, but it also mentions 90mA working current. I suspect that your shift register can't drive all eight at a time, as you observe.

The driving current I suspect comes from the power-in that is also on the relay board, not from the signal input itself. Its quite small SMD stuff, but it looks like the signal input drives a small transistor which in turn dumps power onto the relay.
The omron relays themselves state a working current of 12.5mA and a trigger current of 2mA, so that seems to make sense.

Wawa:
Longs standing error, that they refuse to correct.
There should be NO capacitor on the latch pin, only one from VCC to ground.
The diagram seems to be correct, the Fritzing pictures are NOT.
The resistors are for the LEDs.
If you drive relay board inputs, then there should be NO resistors. Just a direct connection.
Leo..

No resistors on the outputs? I have a schematic here that calls for em when connecting the relayboard directly to the arduino, but I guess they are not needed when using a shift register? I've tried with or without, it seems to make little difference. Same for the capacitors.

CrossRoads:
You need a TPIC6595 to sink the relay coil current, and a big enough supply for however many coils there are.Or go Solid State Relay
TPIC6C595 still works well.

As stated, my board is SSR, so no large coil currents to deal with.

TomGeorge:
Did you try the circuit and code provided in the example to prove your circuit and how to control it before making your changes?
Thanks.. Tom.. :slight_smile:

I did, and it worked.. kinda. I tried using someone's code to shift out the data a little slower than the default way, to make sure it arrives, and that seemed to make it work, sometimes. The code would turn on the channels one by one as a test, but more often than not it would quit halfway and flake out.

So I was hoping to find somebody who has done this before, so I have a "this should be working" sample to go off of. :sweat_smile:

Sure, here’s a simple test code to turn 1/2 the relays, and then the other half.
OE/ is connected to Gnd, SRCLR is connected to +5.
D10 connected to output register clock
D11 to Serial data in
D13 to Shift Register Clock

#include <SPI.h>

byte D10 = 10;
// D11, MOSI, and D13, SCK, used by SPI

void setup() {
SPI.begin();

pinMode (D10, OUTPUT);
digitalWrite (D10,  HIGH);
}
void loop() {
  
digitalWrite (D10, LOW);
SPI.transfer(0xAA);
digitalWrite (D10, HIGH);
delay(1000);

digitalWrite (D10, LOW);
SPI.transfer(0x55);
digitalWrite (D10, HIGH);
delay(1000);
}

CrossRoads:
Sure, here’s a simple test code to turn 1/2 the relays, and then the other half.
OE/ is connected to Gnd, SRCLR is connected to +5.
D10 connected to output register clock
D11 to Serial data in
D13 to Shift Register Clock

8xOpto with screw terminals - YouTube

#include <SPI.h>

byte D10 = 10;
// D11, MOSI, and D13, SCK, used by SPI

void setup() {
SPI.begin();

pinMode (D10, OUTPUT);
digitalWrite (D10,  HIGH);
}
void loop() {
 
digitalWrite (D10, LOW);
SPI.transfer(0xAA);
digitalWrite (D10, HIGH);
delay(1000);

digitalWrite (D10, LOW);
SPI.transfer(0x55);
digitalWrite (D10, HIGH);
delay(1000);
}

I have done exactly as you did, and all it does for me is the LEDs come on in rapid succession and stay on. As if it is constantly fed 11111111. Is your code compatible with arduino mega?

UPDATE;
I found another tutorial and decided to try it out; LINK
And to my surprise it actually works, so now I have something to work off of. :wink:
Problem solved. Thanks everyone!