controlling up to 120 digital output pins

I need to control up to 120 digital output pins. Only two output pins will be active at the same time so there should not be problems about the total available current.

I know I could use more shift registers connected in a daisy chain fashion. However I am looking for the most simple solution with respect to wiring and programming.

If there could be in the market a MUX/DEMUX module with 64 ouput channels it would be great. With two of these modules I could manage 128 output pins using only 16 pins. However I can't find a such module on the web.

Hence I am thinking about two different choiches:

  • using an Arduino Mega 2560 and 8 MUX/DEMUX with 16 output channels modules like
(the page is in Italian, but the English datasheet is attached)

In this way with 40 digital pins I can address up to 128 output pins.

  • using two Arduino Uno with the MUX shield attached

The MUX Shield adds 48 digital pins using 5 digital pins of the existing Arduino. So, with 2 Arduino with a MUX shield, I could manage up to 96 output pins in total.

Do you have any suggestion? Do you know another simple way?

thanks in advance

It depends on what you want to do with these pins.

The simplest, and possibly cheapest, is to use shift registers.

However, if you want to light up LEDs then using the MAX6954 will allow the control of 128 LEDs with one 40 pin chip. However these are not cheap.

Port expanders like the MCP23S17 has 16 output pins on the SPI bus and you can have 8 of them addressed easily on the same bus giving you a total of 128 input or outputs.

check - Centipede Shield V2 - Macetech Electronics Store -

Thank you so much!

The first 60 pins will control 60 transistors.

Actually the second 60 pins will control 60 LEDs.

According to your knowledge, there are suitable MUX/DEMUX in the market?

Centipede Shield V2 - Macetech Electronics Store -

seems to be the perfect solution! They say it is possibile using two Centipede shields at the same time, the second one on the top of the first 128 pins!

I think I will buy these shields!

thank you guys

Yes, it is possible to use two Centipede Shields at the same time, there is a jumper to select upper or lower address range. However, physically it will be difficult to stack them. You need to be able to access the pins on the lower shield. That will require either long header pins on the top shield, or stacking additional passthrough headers to raise the top shield enough to provide clearance.

Alternately, some customers have just put the Centipede shield near the Arduino and run the four wires (5V, GND, A4, A5) needed to the second shield. Most of the Arduino pins are not used so you don't really have to stack them.

with an extra set of jumpers you could stack them leaving an extra gap in-between

and if you miss out 1 stack of jumpers and use some wire..... I guess you could stack them more than 2 high ? (hop so)

just ordered 1 to try out :slight_smile:

Since this board uses the MCP23017 I2C expander chip, and each chip can have one of 8 addresses, you can only have two Centipede Shields connected to the same I2C bus (four chips per PCB). With multiple software I2C buses or I2C multiplexers you could have a ridiculous amount of I/O, though not with stacked shields.

Thank you so much guys.
I am definitevely oriented to buy 2 Centipete shields. In the worst case I will use two Arduinos with a Centipete shield for each of them.

Can you live with the outputs being multipled at 800 Hz? If so, then look into 2 MAX7219/7221 chips controlling 64 outputs each.
I would think for the LEDs for sure that would be okay.
If you want to control higher current on each output directly, then a bank of TPIC6B595, TPIC6C595, or TPIC6D595 shift registers might be the more straightforward way to go.
I am waiting on a board now that has 12 TPIC6B595 to control up to 12 digits made from LED strip lights powered from 12V. Would be easy to expand to 16 to control 128 outputs.