I am using 3 4051 8-channel de/multiplexers to run a 4X4X4 LED cube and am using LEDs that run 3-3.6V at 20ma. I am not sure what the best (and hopefully cheapest $)) way to do this is. Help would be greatly appreciated. :)
Using a 4051 analogue multiplexer for switching outputs is a rubbish idea, there are no latches and only one LED can be on at any one time pushing up your required refresh rate and cutting down the brightness.
Most cubes work with the Persistence of Vision principle, none of the leds are on at the same time. By switching 'm fast enough, it seems all are on at the same time, we humans are just too slow to see the difference. In the same way film is nothing more as a bunch of pictures shown at a high enough frequency.
A 4051 seems like a difficult chip to use for a cube, since you only can address one of it's outputs at the same time. One led can there for never be on for more as 1/64 of the time using a 4051. It usually also is used to multiplex a signal and not really to drive much power.
Since only one in 64 can be illuminated at the same time you'll need a lot of speed to keep the persistence of vision real and.... Leds are on for such a short period of time that they'll hardly be able to see. Try analogWrite(4) on a led you'll be using to see what the maximum brightness of a led will be.
It's quite common to drive a cube Layer-wise. Using a 16bit shiftregister (or 2 8-bit ones) you can turn on/off all 16 leds of a layer at the same time before going to the next. With 4 layers that makes it possible to switch on each led for 1/4 of the time and get a brightness 16 times as high.
There are many possibilities, here are some of them:
Drive the LEDs from a 64-bit shift register, no multiplexing. 3 Arduino pins needed (clock, data, and reset) - or 2 if you can get by without reset. Has the advantage that the Arduino doesn’t have to do anything when the pattern is not changing.
Use a 16-bit shift register to capture the data for a whole layer, then multiplex the 4 layers. 7 Arduino pins needed (clock, data, 4 layer lines). The layer lines will need buffering so as to drive up to 16 leds at once.
Drive the 64 leds as if they are an 8x8 multiplexed array. 11 pins needed if you use a 3 to 8 line demultiplexer to decode the common lines, which may also serve to boost the current driving capability so drive up to 8 leds at once.
(3) probably uses the least hardware if you can spare 11 pins and don’t mind having the Arduino doing the multiplexing.
PS - if you want to try the shift register approach, take a look at the TLC5940 combined 16-bit shift register and LED driver, see http://www.ti.com/lit/ds/symlink/tlc5940.pdf. This chip can drive LEDs without the series resistors because it regulates the LED current itself.
thanks for all the help!!!
on the TLC5940 combined 16-bit shift register and LED driver, would you mind giving an example of how this would work?
Here's an example:
thanks much :D