I am trying to control 42 relays with a Raspberry Pi 3 B+. Due hardware limitations, there I cannot do that with the current amount of GPIO pins. I've found some GPIO Expansion Boards online, but I was wondering if they're a good option or if there is any other way to achieve this.
closed as unclear what you're asking by Milliways, Dmitry Grigoryev, joan, Ingo, Darth Vader♦ Aug 27 '18 at 10:36
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
I/O expander chips are usually based on shift registers or an external microcontroller. In both cases, the time it takes to communicate with the board increases the time required to write the data. This may not matter much to a relay.
- You can control a lot of relays.
- You may have to learn to access these chips with the I2C or SPI interfaces.
- You will have to figure out a way of isolating the voltage needed to control the relay from the Rapberry Pi. Relays produce quick voltage spikes which are not good for electronics.
- You will require a power solution to power the relays because I don't think that you can expect a Raspberry Pi to directly power that many relays.
From the above, I'm assuming that you will be creating or buying a board that runs relays. Either this board will have 42 relays on it, or you will have separate boards with perhaps 8 relays on them which are triggered via I2C and have assignable addresses so you can talk to all 6 boards vi I2C.
I just found a stackable relay HAT that has 8 relays and you can stack for a maximum of 64 relays! These two products might do what you want. It's a Kickstarter that is supposed to deliver in September. There is an article about it.
PiFace also has a stackable relay board.