I'm reasonably new to this so please forgive me if I'm asking stupid questions.
I've just started researching a project that would require me to be able to control up to 100 relays. My googling has brought me to shirt registers. Also I found several varieties of relay board on Ebay that look to be opto isolated, active low and designed to be used with shift registers.
I believe the relays will be triggered one at a time but I may need to trigger several together as the project evolves. I believe this means the 74HC595 won't be right for me due to the current limitations. I understand that the TPIC6C595 would be better suited to my needs.
The questions I have are.
Is the above correct?
Is there a better solution?
Can I connect the pins of the shift registers to the pins on the relay board?
GForce2010:
I believe this means the 74HC595 won't be right for me due to the current limitations. I understand that the TPIC6C595 would be better suited to my needs.
The TPIC6C595 is good if you want to drive the relays directly.
However, this particular board has opto-isolators that drive a transistor to drive the relay. You can connect the 74HC595 outputs directly to the relay input board. The current consumed by the opto-isolators is well within the '595 current range. The relay board has it's own power supply pin, for best noise immunity it would be good to drive it from its own power supply.
With a beefy enough supply to handle the coil current of all the relays, you could run a whole series of the boards, each with it's own daisy-chained '595.
Quite an ambitious project. I wouldn't use shift registers myself because in order to change any specific output, all 100 outputs would need updating. It's not really a "set it and forget it" solution. Also, I'm quite sure it requires somewhere from 15mA to 20mA to control each relay on these boards. Edit - the TPIC6C595 seems OK, also there's other possibilities.
If you have 12 shift registers you would have 108 bits of output. To set those 108 bits you could setup an array of 12 bytes of data with the pattern you want. You then shift out the whole 108 bits as a separate task.
If you want to change any single relay, set/unset it in your array and shift out the 108 bits again. This would give you independent control over all of those relays.
The shifting out is just a means to get your control signals to the appropriate relays.
KenF:
If you have 12 shift registers you would have 108 bits of output. To set those 108 bits you could setup an array of 12 bytes of data with the pattern you want. You then shift out the whole 108 bits as a separate task.
If you want to change any single relay, set/unset it in your array and shift out the 108 bits again. This would give you independent control over all of those relays.
The shifting out is just a means to get your control signals to the appropriate relays.
would it be easier to program for 6 and have two channels of output ? seems like changing one bit in the 108 would take a lot of code.
if you could do have that, would the code be much smaller ?
With the 74HC595, I just can't see where there are provisions to hold the output data while shifting in new data. Using the output enable would just turn all outputs off, leaving enabled while shifting would have undesirable effects on the outputs. Edit: Disregard this ... see reply#16
dlloyd:
With the 74HC595, I just can't see where there are provisions to hold the output data while shifting in new data. Using the output enable would just turn all outputs off, leaving enabled while shifting would have undesirable effects on the outputs.
you load the registers remain in their current state while the new states are loaded, then once they are all loaded, you toggle the old state for the new state. if they were ON, they would remian on, no flicker
dlloyd:
With the 74HC595, I just can't see where there are provisions to hold the output data while shifting in new data. Using the output enable would just turn all outputs off, leaving enabled while shifting would have undesirable effects on the outputs.
It is pin 12, that has various names on various data sheets. This is the clock pin on the output D Type latches. The outputs are held until you toggle this pin, so you can shift new data in without changing the output pins.
It is pin 12, that has various names on various data sheets. This is the clock pin on the output D Type latches. The outputs are held until you toggle this pin, so you can shift new data in without changing the output pins.
Missed that (thanks Mike).
"The board itself needs to be connected to the SCL and SDA lines coming out of the Arduino,"
why ? if it already has the ATMEGA328 chip ?
EDIT: I have a few of the OM6281 boards on hand that were used for a different project. One day (if only I could find the time) I'd like to test them with the Arduino Due.
dave-in-nj:
would it be easier to program for 6 and have two channels of output ? seems like changing one bit in the 108 would take a lot of code.
if you could do have that, would the code be much smaller ?
I'm not sure I follow. It's just numbers. Wether you're shifting out 2 bytes or 20 bytes it makes no odds. It's just a number in a for loop.
The time taken to shift out 6 bytes would be less than shifting out 12 bytes, so if time is a factor then using 2 chains of 6 registers could make sense. Any application this time sensitive though, wouldn't be using electro-mechanical relays in the first place.