What is the best way for controlling array of 8-16 relays?

Hello

There are several ways of controlling relays from atrduino:
-Using transistor, diode and resistor (and having a common ground)
-Using Optoisolator (I have found 4 channels IC, may be there are 8 channels)
-Using relay driver, like ULN2803A
-Using SSR and connecting it directly to arduino's pin without. This looks like the simplest solution, but SSRs are not cheap and usually SPST. The also require heatsinks
-Using relay module

If I understand correctly, I need external power supply since all 8 relays could be activate at the same time.
If this is the case I will probably use some 12V LED driver. I'm not sure do I really need a complete isolation in this case?
Further, I'm planning to control relays using I2C port expander, so I probably will need to take into account input line power requirement.

So, my question is how do I choose the right option?

What type of relay. How much power to control the relay?

Mark

I2C port expander to a pair of ULN2803As to your relays should be enough. The relays don't require regulated power and their current needs are in their datasheet. Get a supply that has at least 50% more current then you need.

What are you switching and which relays are you planning on using?

You can easily control 16 relays ( or as many as you like ) directly with 2 TPIC6B595 serial latches, with 3 wires to the Arduino chip. it only needs 2 components - plus a 100nF capacitor on each chips +5v pin of course ( the chips have inductive protection diodes built in ) :-

Thank you all for your replays.

I'm planning to build 8-sockets power strip, AC 220V. Two of them should be capable of 10A, the rest can be 5A.
My plan is to run i2c over regular usb wire. This way I will have an option to add the second power strip to USB hub.

I'm planning to use the following relay (or similar)
http://www.ebay.com/itm/5p-JQC-3F-T73-DC-12V-5PIN-125-250VAC-28VDC-Power-Relay-NEW-PB1-/170713872646?pt=LH_DefaultDomain_0&hash=item27bf56f906
with coil power 0.36W (http://www.langir.com/htm/pcb-relay.htm)

TPIC6B595 looks very interesting. Pros: no need in port expander and lower voltage drop than with ULN. Cons: slower, but not sure how slow compared to relay's response time. Anything else?
Do I understand correctly that instead of using hub for connecting the second strip I will need to have a cascading port on the first one?

The circuit I showed will handle those relays easily, the chip is a lot faster than the relays.

I use the Shiftout function to drive the outputs ( I have strips of LEDs, but it could be relays)

The serial data through the first chip ( which is a shift register ) pin 18, feeds the serial in to the next pin3 input, and so on.

You can have as many chips as you like.

Thank you for your help.

I have a several questions about using TPIC6B595

  1. If relays are powered from external power supply, should the grounds be connected?
  2. Where to put capacitor and why it is needed?
  3. May I use arbitrary pins for data/latch/clock?
  4. What will be the state of output pins on power on/restart?

Thanks again,
Yakov

  1. If relays are powered from external power supply, should the grounds be connected?

definately, thats the common reference for both the logic and the driver parts of the chip.

  1. Where to put capacitor and why it is needed?

You will always need a 100nF capacitor near to any chip, between the 5v and ground for decoupling, and you will also need a 1000 MFd electrolytic close to the relays 12v supply, to smooth any surges as the relays open and close .

  1. May I use arbitrary pins for data/latch/clock?

If you are using shiftout to switch the relays then you can choose the pins. ( shiftout is easily fast enough for switching relays )

  1. What will be the state of output pins on power on/restart?

You can set up the state of the all the pins during start- up. ( or there is a simple way to store the states in eeprom at power-down, to reload at power up again )

  1. What will be the state of output pins on power on/restart?

This is an issue you need to deal with. See this on the http://ArduinoInfo.Info WIKI:

http://arduino-info.wikispaces.com/ArduinoPower#4-8

I usually want to start with everything off, so in my example I would shift out B00000000 twice in the setup of the sketch, but you could choose which relays you want to come on at power up, say number 3 relay, you could shift out B00100000 then B00000000.

BlueBill:
I2C port expander to a pair of ULN2803As to your relays should be enough. The relays don't require regulated power and their current needs are in their datasheet. Get a supply that has at least 50% more current then you need.

What are you switching and which relays are you planning on using?

What he said. Use a PCF8574N 8-bit IO expander. Its the easiest to work with.

thats 3 chips when its all in the 2 TPICs... although the specs say the PCF can drive an LED , and the total output is 100mA, so it might be OK for 8 x 5v relays drawing less than 12mA ?

The TPIC can sink 150mA per latch, and handle up to 50v relays, and uses just 3 pins of the micro.