User avatar
privatejava
Posts: 7
Joined: Mon Jul 28, 2014 7:32 pm
Location: Kathmandu
Contact: Website Yahoo Messenger

Best way for making 24 channel power relay program

Sat Feb 04, 2017 5:30 pm

Hi,
I am a beginner RPI user though i had bought it(Raspberry pi Model B v2) before couple of years ago. I have to create an application where an array of LED lights(AC powered) to be blinked with some timer . I used Java with PI4j lib and it works for now with 4 LEDs program using a 4-channel power relay connect to raspberry pi. But to connect 24 channel power relay i guess i will need 24 GPIO pins and my model doesn't support for this. Do anybody know some way to make it shrink version by using encoder or some other way because using 24 GPIO pins for this kind of application is not a good move.


Thanks in advance.

Regards
Narayan

User avatar
Gert van Loo
Posts: 2487
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Best way for making 24 channel power relay program

Sat Feb 04, 2017 7:46 pm

I would suggest you look at an I2C I/O expander like the MCP23017 or MCP23016.
One of them gives you 16 I/Os at the cost of using two GPIO pins.
With two you get 32 I/Os ( and still the costs of only 2 GPIO pins).
As far as I know there are small DIY kits from various PI vendors. (Ada fruit?)
They come with extended instruction to lead you through the build and bring-up process.

Post edit.
Ok, I could not withstand the urge to blow my own trumpet...
Here is a free Github database for a PCB and SW which gives you up to 128 I/O pins: https://github.com/fenlogic/multio
No that is not suited for you as I assume you don't want to order PCBs but maybe in future
somebody else wants to drive XXX lights.
But you can have a look at the example Python SW how to control the MCP devices.

Return to “Beginners”