171 Individual Outs Needed. What is the easiest way to do this w/ a Arduino MEGA

I need 171 [u]individual[/u] outputs for a upcomming project... i was thinking "74hc595" 's no less because it will not work and yes i minimized the amount of outs as much as possible...

You ruled out a solution because "it didn't work." How can anyone suggest alternatives without knowing what "didn't work" with what you have already tried? What are you trying to do?

no i just ment the miniumum is 171 outputs...

How often are changes made to the outputs?

How quickly must an update take place?

Do you need change each of the outputs randomly, or do you know all 171 values before each output of data?

What kind of loads on each of these outputs?

i'm trying to make a 9*9*9 bi-color led cube....

i'v made several of these before but lagest was a 5cube...

Not sure how you got 171, but seems to me you could do it with just 27.
Picture this:
You have a 9x9 grid, each side has 9 control pins. So that’s 18.
Then you have 9 of those stacked up, so you need 9 more to control which one is one.
27 total.
An LED in each grid will turn on when the X edge driver is high and the Y edge driver is low.
9 x 9 is a little funny, shift registers such as TPIC6B595 would be great, but they are only 8 bits. Guess you could use 2 per edge.
If you had 27 individual transistors, you could control those with arduino output pins, I just need to think a little about how you control the power to each grid in the Z plane.
You’d have a loop running to enable each grid for some # of mS, changing the data for each grid power to repowering it.

EDIT: Added picture for 1 plane. Just realized you wanted bi-color - no problem just need 18 Z planes instead. 2 planes just happen to be co-located. So 36 control pins.
Only question to work out is how to drive the PNP transistors, they will need higher voltage on their base. Hmm, maybe use NPN as open collector driver, if NPN is off then pullup will turn the PNP on, if NPN is on will pull base low to turn PNP off. Been a while since I used transistor like this…


9 columns X 9 rows X 2 colors X 9 levels = 171 outputs

Your arduino I/O pin count would be 12 outputs pins. Three to control 11 series connected 16 bit shift registers with constant current output pins, and 9 to drive 9 cube level driver transistors.

I would suggest using shift registers like this one: http://www.allegromicro.com/en/Products/Part_Numbers/6276/ , however there are other manufactures that offer equivalent chips. 16 bits per package and the integrated constant current output stages help keeps the total cube component count manageable.


How many I/O pins are on a Mega? At least 36 right? I’d say skip the external shift registers and just do it from the IO pins.
Need a current/voltage buffer for the IO pins.
Ooh, I think I got it.
The ULN2803 is 8 drivers in a 18 pin package. I’m going with 36 drivers still (9 Rows, 9 columns, 18 planes (9 of each color).
All rows & all columns wired in parallel with 1 plane controller.
Each output is an NPN open collector transistor.
What we do is wire up each plane like I described above, with Anodes pulled high by pullup resistors. If the cathode is pulled low by the Row transistor, it will turn on, unless,
the anode is pulled low by either the Z-Plane transistor OR by the Cathode transistor.
Thus the Z-plane transistors control the multiplexing of the 18 rows (9 of each color) while the Row & Column transistors control which individual LEDs turn on.


Below is a multi output project you could do with the mega.