GarrettVD
Posts: 9
Joined: Wed Feb 27, 2013 7:41 pm

More than 17 relays via GPIO

Wed Feb 27, 2013 9:11 pm

Hi all,

I'm planning to create an automated homebrewing system, and as you can imagine, this requires quite a few relays. If I require > 17 GPIOs for my relays, do I need two RPi's, or is there a way to get more out of a single Pi?

Planning on using 4 x 5v 8-channel relay boards.

Cheers,

-G.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 11993
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: More than 17 relays via GPIO

Wed Feb 27, 2013 9:30 pm

First, the PI has more than 17GPIO's, but not 32.

There are many solutions, but a simple one is to use I2C I/O expanders.

Pauldf
Posts: 4
Joined: Tue May 29, 2012 9:14 am

Re: More than 17 relays via GPIO

Wed Feb 27, 2013 9:43 pm

You can use a 74HC595 chip which is a serial (clock and data) to parallel shift register and they can be daisy chained for as many as you like. It runs on 5v but as an input 3.3v will drive it OK.

It uses a minimum of 3 Pi pins Clock, Data and Latch and has 8 digital outputs. The chips can be daisy chained, taking up no more pins, so for 32 relays you would need 4 x 74HC595.

Have a look at http://www.raspberrypi.org/phpBB3/viewt ... 44&t=14569 which shows you how to use it.

GarrettVD
Posts: 9
Joined: Wed Feb 27, 2013 7:41 pm

Re: More than 17 relays via GPIO

Wed Feb 27, 2013 11:24 pm

Fantastic! Thanks!

pgman
Posts: 22
Joined: Sun Jan 06, 2013 8:34 pm

Re: More than 17 relays via GPIO

Fri Mar 01, 2013 2:12 pm

I'd go for I2C chips as well, something like the PCF8574 or the MCP23017. I've had issues with 74HC 595 and relays, causing random state changes whenever something touched the circuitry. Using I2C chips you will only get a state change when exactly the correct data stream is sent. You can buy them fairly cheaply all over the place.

You will also need to provide a dedicated power supply for the relays. 5v relays consume about 50mA each when running, so 17 will use 850mA plus the power for the Pi, so well over 1A.

Return to “Interfacing (DSI, CSI, I2C, etc.)”