Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: Krydder on Nov 10, 2014, 10:36 pm

Title: 4x4x4 LED cube with shift registers
Post by: Krydder on Nov 10, 2014, 10:36 pm
I am planning to build a 4x4x4 cube as a beginner and was looking at several guides/etc to find out how to do it

Guides using shift registers and are almost always using 74HC595 shift registers, thereby lowering the current to each LED. Is there any reason for this? Why not just use registers with greater maximum current, for more light :)?

EDIT:

I am right in assuming that it works because only a single led(~20mA) is on at the time?

Title: Re: 4x4x4 LED cube with shift registers
Post by: PaulRB on Nov 10, 2014, 11:19 pm
Hi,

Many cubes and other led projects use 74hc595 because they are inexpensive and commonly available.

There are registers with more current capability such as tpic6c595. However, while these chips can sink much more current than a 74hc595, they cannot source any current. This means they may not be a drop-in replacement for 74hc595, depending on the circuit.

An alternative chip for 4x4x4 cube is max7219. This chip makes it easy to build a bright cube with minimum extra components. However, the construction of the cube needs to be slightly different to a conventional cube.

Check out my instructions to build one here. (http://forum.arduino.cc/index.php?topic=226262.msg1636691#msg1636691)

Paul
Title: Re: 4x4x4 LED cube with shift registers
Post by: Krydder on Nov 11, 2014, 08:36 am
Quote
In this case you should connect the cathode (short pin) of each LED to a common ground, and the anode (long pin) of each LED to its respective shift register output pin. Using the shift register to supply power like this is called sourcing current. Some shift registers can't source current, they can only do what is called sinking current. If you have one of those it means you will have to flip the direction of the LEDs, putting the anodes directly to power and the cathodes (ground pins) to the shift register outputs.
From http://arduino.cc/en/tutorial/ShiftOut.

From the above it seems like you need common anode for the 4 layers and then have the 16 cathodes go into the shift register, but otherwise no changes to what I had planned/seen on other guides.
Title: Re: 4x4x4 LED cube with shift registers
Post by: Paul__B on Nov 11, 2014, 02:03 pm
For a 4 x 4 x 4, the MAX7219 is pretty much perfect.

I have some on the way from eBay.  Now I know what my first project with them (aside from the pre-built matrices) is!
Title: Re: 4x4x4 LED cube with shift registers
Post by: Krydder on Nov 11, 2014, 05:06 pm
Found this post:

http://forum.arduino.cc/index.php?topic=237511.0

I have the same feeling as the original poster of that thread :O I really cannot understand how people use these low current registers to power so many LEDs.
Title: Re: 4x4x4 LED cube with shift registers
Post by: gippuz on Nov 11, 2014, 05:41 pm
ciao,
I did a project with 74hc595,
they are very cheap...
to solve the current problem you can use drivers as nmos transistor,
you can easily find cheap ones
Title: Re: 4x4x4 LED cube with shift registers
Post by: Krydder on Nov 11, 2014, 06:32 pm
I just still do not understand how you power a cube by using these registers. Clearly they are not capable of powering more than a few LED's (2-3) so i guess you just switch which LED's are on really fast?

http://forum.arduino.cc/index.php?topic=237511.0
Title: Re: 4x4x4 LED cube with shift registers
Post by: PaulRB on Nov 11, 2014, 11:28 pm
Hi,

I imagine most designs that use them exceed the max current of the IC. This may shorten is life by only a little or maybe a lot. There are no guarantees given by the manufacturers around how much the life shortens if you exceed the max ratings by, say 50% or 100%. The chips could die instantly and you would have no comeback.

As you probably know, generally in a 4x4x4 cube, a 1:4 multiplex ratio is used, so only 16 leds will be lit at any instant. If you use 2 chips, you could afford 8 or 9 mA per led without bending the rules.
Title: Re: 4x4x4 LED cube with shift registers
Post by: Krydder on Nov 12, 2014, 08:27 am
Okay I think that answers my original question.

Is it correct that I could just use a ULN2803 transistor array between the register and my cube to supply way more current?
Title: Re: 4x4x4 LED cube with shift registers
Post by: PaulRB on Nov 12, 2014, 11:24 am
To sink more current, yes. But a tpic6c595 does the same with one chip.

You still need to find a way to source more current for the anodes. Neither uln2803 nor tpic will do that for you. Transistors may be the answer.
Title: Re: 4x4x4 LED cube with shift registers
Post by: gippuz on Nov 12, 2014, 11:57 am
IRL540N (if you need really high current) or SI2302 (if 1A per led is enough) will do well the work...
Title: Re: 4x4x4 LED cube with shift registers
Post by: Krydder on Nov 12, 2014, 01:08 pm
To sink more current, yes. But a tpic6c595 does the same with one chip.

You still need to find a way to source more current for the anodes. Neither uln2803 nor tpic will do that for you. Transistors may be the answer.
Isn't the ULN2803 just a transistor array, or did I miss something?
Title: Re: 4x4x4 LED cube with shift registers
Post by: PaulRB on Nov 12, 2014, 04:10 pm
Isn't the ULN2803 just a transistor array, or did I miss something?
Yes, you are missing an important fact. The ULN chip's outputs are the collectors of each transistor (actually they are darlington pairs). The emitters  are all connected to 0V inside the chip. This means you can only use them as "low-side switches", i.e. between the cube's cathodes and 0V.

You also need to source large currents to the cube's anodes, i.e. "high-side switches" between +V and the anodes. Depending on the supply voltage and the forward voltages of the leds being used, I would choose either bc327 (a pnp transistor) or a bc337 (npn transistor used in "common collector" configuration) or even both (npn controlling base of pnp). But there are many other options such as MOSFETs.
Title: Re: 4x4x4 LED cube with shift registers
Post by: Krydder on Nov 12, 2014, 09:34 pm
Right.

The reason I am confused is mainly because I have read several places that you could use ULN2803 to "anti-drive" the LEDs or something like that :O

see link and 2nd answer: https://electronics.stackexchange.com/questions/79718/8x8x8-led-cube-driver-circuit

Side note: could i simply make each layer common anode and have TPIC6B595's sink the current from each cathode column and then use a MOSFET for each anode layer?
Title: Re: 4x4x4 LED cube with shift registers
Post by: PaulRB on Nov 14, 2014, 12:46 am
The diagram on your link shows uln2803 as low-side switch. That's all it can do.

Yes, mosfets to control the 4 common anodes would be a solution. I'm no expert on mosfets so don't have a part number to suggest.

Provided your circuit runs from 5V, you could use a pnp bjt transistor to switch your anode layers, like bc327. Put 2K2 between the bases and the Arduino outputs.
Title: Re: 4x4x4 LED cube with shift registers
Post by: Krydder on Nov 14, 2014, 08:17 pm
Okay, thanks a lot for your answers :)