I am starting to build a led cube of 8x8x8.
I have read some articles about creating more outputs for my arduino and i think using shift registers is the best solution for me.
This is going great and i have now 2 shift registers combined so i can turn on 16 leds independently.
At this point I bumped into one problem.
Every led uses a wire of its own, this wire can't touch another in order for the led to work independently.
How do I set up the cube? Do I have to pull a wire to every single led in the cube?
This would mean that there will be a lot of wires heaping up in the frame..
In some examples you can see that all the leds are attached to each other and i don't see any wires.
If I attach my leds to each other I don't see how I can use them independently.
Is there something i'm missing about the shift registers?
You are missing "multiplexing".
In many cubes, the LEDs are arranged in columns and then layers.
In each of ther 64 columns, all the cathodes are connected together.
In each of the 8 layers, all the anodes are connected together.
Then you have a PNP or P-channel MOSFET to supply 64 x 20mA to any one layer of anodes at a time, and 8 shift registers to sink the current from the (up to) 64 LEDs that you want on.
Cycle thru all 8 layers rapidly leaving each layer for 2.5mS so the entire display is refreshed 50 times a second and looks flicker-free (1/50 = 20mS, /8 = 2.5mS) . Persistence of vision will trick the eye into not seeing the rapid changes. Use SPI.transfer to send the 8 bytes out to the shift registers.
Use a part like TPIC6B595 so that all 8 LEDs can be together and the resulting 160mA does not overwhelm the part (74HC595 is only good for 70mA total for the whole device).
During the ~2.495ms of non-datashifting time (takes 4-5uS to shift out 8 bytes), you can be doing other stuff.
But how you wire it up (be it 2D or 3D), is ofc up to you. One thing to keep in mind is that if you use row/column scanning in your 8x8x8 cube, it could be rather dim. Because each row (or column) would be on for 1/64th of a frame time, as there are 64 rows (of 8 LED's) total.
The potential for dimness is why I suggested turning on whole layers at a time, so they are on 1/8th of the time.
The drawback is needing a bigger power supply, 1.28A. Not that big I suppose, easily provided by a wallwart. http://www.dipmicro.com/store/DCA-0520
8 logic level, low Rds, P-channel MOSFETs to source current
8 TPIC6B595 shift registers to sink current
64 resistors sized to allow up to 20mA (typical max) for the LEDs you select.
CrossRoads' suggestion is an excellent one. If you want to go one stage further and have individually dimmable LEDs, or just reduce the number of shift registers from 8 to 4 (and reduce the current-limiting resistors from 64 to 4), you could also look at TLC5940.
It is important that the leds can be used seperately, not a whole layer at once.
The cube will have to switch the leds very fast and has to switch leds simultaneously too.
The TLC5940 would be more confinient as PaulRB sayed but CrossRoads sayed it needs more data.
My question is can it handle the fast switching?
For example, the whole cube must be switched on and off from bottom corner to the opposite top corner within 1,5 seconds.
(It has to look like a wave so a lot of leds will be switched on simultaneously, otherwise it would be impossible withing 1,5 seconds).
Do you need 4096 levels of brightness control? Probably not. Stick with the 8 TPIC6B595s to start, send out 9 bytes of data 50 times a second (9th byte to control the PNP/P-channel MOSFETS for switching the anode current). With a little bit of smarts in your building, you can always replace the 8 shift registers with 4 TLC5940's at a later time as your coding skills improve.
I don't think anyone wires up cubes with 8 layers worth of drive circuits. That would be a wiring mess as you indicated originally, and mechanically a challenge to assemble.
You can still turn each LED on/off individually - send out 1 high and 63 lows for a layer, only 1 LED will turn on. Persistence of vision will provide the illusion to the eye.
This is a pretty good site to see what you are getting into.
As you can see the 74HC574 is not rated to provide 20mA for 8 outputs, so brightness will be limited.
Using PNP or P-channel MOSFETs to source current to each layer and TPIC6B595 to sink current from each colum will allow full 20mA per LED if desired.
You can use PWM on the shift registers OE/ pin as well to provide 0-255 levels of brightness control also.
What we're saying is, whether you choose to use tipc6b595 or tlc5940, the Arduino will be capable of switching every one of those 512 leds on and off 50 times per second with ease. In fact that will probably take only a few percent of the available processing speed.
It doesn't sound like you need to individually dim the leds, so I think you should go with the 8 x tipc6b595 for simplicity of design even though it will mean more chips and resistors.
As CrossRoads suggests, you will need to control which of the 8 layers is being multiplexed at any instant. An ordinary 74hct595 can be used for that and daisy chained to the other shift registers. This last shift register will need to drive 8 x pnp transistors or p channel fets. These need to be capable of handling 1.2A, which is more than the standard ones like bc327 can handle. I don't have a recommendation for this but I'm sure someone else will...
How about tip125 as the anode-side switches? They have max current of 5A and current gain of 1000. So for a 1.2A collector/emitter current, the base current would need to be 1.2mA. A base resistor of 2K2 would give a base current of 2.3mA, more than enough to saturate it. As it would be driving the common anode layers, one at a time, a 74hc595’s current sourcing abilities would not be an issue.
Sounds like we may be getting confused over our recommendations. Allow me to re-state them as I understand:
For the cathodes: 8 x TIPC6B595 shift registers, daisy-chained (+64 suitable series resistors). 74HC595 not suitable for this due to overall chip current limits.
For the anodes: 1 x 74HC595 (also daisy-chained to the TIPC6B595s), driving suitable pnp transistors or p-channel fets. 74HC595 OK here as it won't need to sink/source much current - just enough to drive one transistor/fet at a time. It appears to me that 8 x TIP125 would be suitable (with 2K2 base resistors), but this needs confirming or a better suggestion.
I can't recommend those Darlington parts.
TIP125 drops 2V Vce for instance. At 1.28A, that's 2.556W dissipated in the transistor.
Would rather see Logic level, Low Rds, P-Channel MOSFET
This one for example
Good suggestion CrossRoads, I was concerned about the voltage drop of the tip125. As well as the power dissipation problem, it would also have limted the choice of leds to those with a low forward voltage. I remember the op had some leds in mind with Vff over 3V, which would have been out.
So a pull-up (down?) resistor will be needed on the gate (10K?) and a low series resistor (100R?).
Another option for driving these fets would be to abandon the 9th shift register and use Arduino outputs directly, if 8 are available.
P-channel, so a 10K pullup to keep them turned off during reset times.
I'd just just use another TPIC6B595 to pull the gates low. 100 ohm would be fine.
You know, this board I have I think would be ideal to drive a cube like this. Need 81 column drives 9 gate drives, and 96 are available when fully populated.
I have been contemplating a 9x9x9 even, just not enough time available to right now to get around to soldering the cube up. http://www.crossroadsfencing.com/BobuinoRev17/
Bare boards $5, I should get the schematic & PL posted. Pretty straightforward, basically an arduino and 12 shift registers with decoupling caps.