RGB Led Cube

I am new to Arduino and electronics, and could use some assistance.
I am attempting to make an RGB LED Cube that is 4x4x4, all the LEDs are common anode, and I want to drive it all with an Arduino Uno.

Here is where i’m at so far (Please correct me where i’m wrong):
I have a total of 64 RGB LEDs lined up on a breadboard and I have all the common anodes tied together.

With all 64 anodes tied together, that leaves me with 192 cathode leads. 64 leads for Red, 64 leads for Blue, and 64 leads for Green.

All of the individual cathode leads require a resistor, correct? So that means 192 resistors, right?

Assuming everything is correct so far, this is where things get a bit fuzzy for me.

Arduino can only output 5V, so that means that I have to use some transistors between the Arduino and the resistors, correct?

Since they are common anode, that means that I need to use some NPN transistors, right?

How many LEDs can be powered with one transistor?

I would need an external power source wouldn’t I?

This is how I have it all setup so far. HELP PLEASE!

4x4x4 cubes are generally multiplexed.
You could turn on one complete layer at a time, which would need a PNP transistor per layer and 16x3 = 48 current sinks.
For the current sink, 6 TPIC6C595 open drain shift registers could be used, with 48 current limit resistors.
The cathodes for the 3 LEDs at each vertical location would be connected together.

Send out the data for one layer, turn on the PNP transistor. Wait a few milliseconds, turn off the PNP.
Repeat for the next layer.

A 5V supply could be used for the whole project.

How many colours do you wish to display? If you are happy with 7 colours: red, green, yellow, blue, cyan and white, then it is a little less difficult. If you want to mix more colours than that then things become more difficult.

If you wire up your cube as you describe in your breadboard, it will be very difficult indeed, because you will have 192 cathodes to control with digital outputs. If you want to mix more than 6 colours then these must be pwm outputs. I'm sure you realise Uno does not have this many outputs, digital or pwm.

If you multiplex the cube, as CrossRoads suggested, you will have 4 common anodes to control and 48 common cathodes. Uno does not have that many. So you need more led driver chips. 74hc595 are not really suitable, they cannot supply enough current. Tpic chips can, but series resistors will be needed. Other chips are designed to drive LEDs directly and do not need series resistors. Some of these chips have pwm outputs. These chips can be notoriously difficult for beginners to work with.

What I am trying to say is that this project is going to be about 50 times more difficult than you imagined. Building a 4x4x4 single colour cube is a difficult project for a beginner, RGB cubes are significantly more difficult.

If it were my project, I would consider using apa106 LEDs. These have controller chips built into each led, like ws2812b/"neopixel" LEDs, but are available as 5mm or 8mm package with leads.

PaulRB:
Building a 4x4x4 single colour cube is a difficult project for a beginner, RGB cubes are significantly more difficult.

Actually, before I noted the requirement for RGB, I was going to point out that a 4 by 4 by 4 monochrome cube is dead easy - you use a MAX7219.

And indeed, the RGB version is pretty simple using four MAX7219s - self-multiplexing and three interface pins to the Arduino.

Move up to any larger size and you are in trouble.

PaulRB:
How many colours do you wish to display? If you are happy with 7 colours: red, green, yellow, blue, cyan and white, then it is a little less difficult. If you want to mix more colours than that then things become more difficult.

If you wire up your cube as you describe in your breadboard, it will be very difficult indeed, because you will have 192 cathodes to control with digital outputs. If you want to mix more than 6 colours then these must be pwm outputs. I'm sure you realise Uno does not have this many outputs, digital or pwm.

If you multiplex the cube, as CrossRoads suggested, you will have 4 common anodes to control and 48 common cathodes. Uno does not have that many. So you need more led driver chips. 74hc595 are not really suitable, they cannot supply enough current. Tpic chips can, but series resistors will be needed. Other chips are designed to drive LEDs directly and do not need series resistors. Some of these chips have pwm outputs. These chips can be notoriously difficult for beginners to work with.

What I am trying to say is that this project is going to be about 50 times more difficult than you imagined. Building a 4x4x4 single colour cube is a difficult project for a beginner, RGB cubes are significantly more difficult.

If it were my project, I would consider using apa106 LEDs. These have controller chips built into each led, like ws2812b/"neopixel" LEDs, but are available as 5mm or 8mm package with leads.

Thank you for your quick responses and input. I'm thinking that your right and that an RGB LED cube might be a slightly bigger bite than my current skill level is capable of chewing, but I don't want to let that deter my efforts to learn how to do this because I think that this is a great learning opportunity and would be a good tool to have in my toolbox for later.

Ideally, I'd like to be able to display as many colors as possible. I also know that there are some compromises that i'm going to have to make strictly because of my current skill level.

The APA106 LEDs definitely seem to be the way to go for what i'm trying to accomplish. I didn't know that APA106 LED were a thing. So each individual APA106 LED has a built in shift register, am I understanding that correctly?

Makes me wonder why everyone else doesnt use them instead of wiring up a 2' wide wire ribbon to a bunch of shift registers. Am I correct in assuming that these APA106 LEDs would help reduce all of that noise and confusion?

So going off the assumption that these APA106 LEDs work the way that I think they work, Each LED would still need its own pin on the Arduino for them to be individually addressable wouldnt they?

As an additional note, I have ordered a INPUT EXTENSION SHIELD FOR ARDUINO to greatly expand my number of available inputs.

Once I can get this all sorted out and get a clear road map of what I need to do, I intend to create a guide on my entire process so that maybe it'll help the next person.

STORMINMORMON:
So each individual APA106 LED has a built in shift register, am I understanding that correctly?

Yes, in fact 3, one each for red, green and blue. Also 3 pwm circuits controlled by the registers.

STORMINMORMON:
Am I correct in assuming that these APA106 LEDs would help reduce all of that noise and confusion?

Yes.

STORMINMORMON:
So going off the assumption that these APA106 LEDs work the way that I think they work, Each LED would still need its own pin on the Arduino for them to be individually addressable wouldnt they?

No. One Arduino pin. The Arduino sends data to the first led, the first led sends data to the second and so on.

PaulRB:
Yes, in fact 3, one each for red, green and blue. Also 3 pwm circuits controlled by the registers.
Yes.
No. One Arduino pin. The Arduino sends data to the first led, the first led sends data to the second and so on.

This just gets better and better. I’m glad i came here with these questions. Thank you again for helping out a noob.

So I did a quick search, and it doesnt look like these LEDs require a resistor? So I can just wire these up in series and still address each of them?

What about when I have 16+ LEDs hooked up? Still just the 1 pin connected to just a string of LEDs with no resistors or transistors or anything like that? It almost seems too good to be true lol

You need a resistor between the Arduino pin and the first led. Value not critical, 220R, 330R, 470R. Also a large cap, eg. 1000uF, across the power rails, close to the cube.

Also you are going to need a lot of current at 5V. The cube will not be multiplexed, so all 64x3 LEDs could be consuming 20mA each which is nearly 4A. So a 5V 5A PSU would be ideal. The same PSU can also power the Uno through it's 5V pin. But don't route all that current through the Arduino board, take a separate feed from the PSU to power the Uno.

This type of led does all the hard work for you. You can string hundreds together with no extra components. There are limitations on how many you can string together. With an Uno, ram memory becomes the limiting factor at around 500 LEDs. After that, the speed with which the string can be updated becomes the next limit, and faster processors that can send multiple simultaneous data streams to separate strings of LEDs are needed.

You will need to "snake" the flow of data around the cube, so start working on that idea. Each led will need 5V and ground also, so your design will need to include that too.

Oh, and finally, you are going to need some sunglasses. At full brightness, this thing will burn your eyeballs!

PaulRB:
You need a resistor between the Arduino pin and the first led. Value not critical, 220R, 330R, 470R. Also a large cap, eg. 1000uF, across the power rails, close to the cube.

Also you are going to need a lot of current at 5V. The cube will not be multiplexed, so all 64x3 LEDs could be consuming 20mA each which is nearly 4A. So a 5V 5A PSU would be ideal. The same PSU can also power the Uno through it's 5V pin. But don't route all that current through the Arduino board, take a separate feed from the PSU to power the Uno.

This type of led does all the hard work for you. You can string hundreds together with no extra components. There are limitations on how many you can string together. With an Uno, ram memory becomes the limiting factor at around 500 LEDs. After that, the speed with which the string can be updated becomes the next limit, and faster processors that can send multiple simultaneous data streams to separate strings of LEDs are needed.

You will need to "snake" the flow of data around the cube, so start working on that idea. Each led will need 5V and ground also, so your design will need to include that too.

Oh, and finally, you are going to need some sunglasses. At full brightness, this thing will burn your eyeballs!

THANK YOU SO MUCH!
I'm in an electronics program at my local community college, but the instructors dont seem to be very knowledgeable unfortunately. So I have to try and find information elsewhere. I'll make sure I bust out my welding helmet before testing it on max brightness lol

Have a read of this thread. That guy is building a 5x5x5 cube using ws2812b LEDs, which are very similar to apa106. The diagrams in his first post show the "snaking" of the data path from led to led around each layer. Although, they don't snake quite as I expected. I expected led 25 to be vertically above led 24 in the next layer. But it isn't.

Maybe you could ask the guy for more details about how he has wired the data path between the layers, and why he did it that way.

Note that the apa102 needs two lines from the Arduino, one for data and one for clock. If you were using the WS2812 you would only need one line. However, I would recommend you use the apa102 because driving them is not time critical.

Hi Mike. Could that be apa102 you are thinking of?

Thanks yes that's it. My reply #10 corrected.