8x8x8 multiplexed LED cube with an Arduino Mega 2560

Thanks, Hippynerd! You've helped me a lot lately :slight_smile: When my final 8x8x8 LED cube will be done, I will symbolically dedicate one of it's LEDs to you :slight_smile: Another one is definitely for CrossRoads and the rest of you guys who have given me so many useful bits of information should also get one :slight_smile: I guess I'm talking nonsense here, but hey, it's my way of expressing gratitude.

So back to the hardware, I agree with you. The gate-source resistors are needed as pull-up resistors (I've just learnt today what that means). The resistors between the shift register and the mosfets can probably be left out, as CrossRoads said earlier.
As for the LED cathode resistors, I think the safe way to go is to calculate their value based on a voltage of 5V - 3.3V (5V comes from the power supply and 3.3V is the voltage drop across the LED). With a target current of 20 mA, we get 100 Ohms for the resistor value (http://led.linear1.org/1led.wiz?VS=5;VF=3.3;ID=20). Even if the mosfet drops an additional 0.5V (which I don't know, I'm just assuming the worst here), with 100 Ohm resistors the current passing through the LEDs will be about 13 mA, which should be well enough for the LEDs to work properly.

I've done some experiments a few months back with some standard 5 mm white and blue LEDs and they give up pretty strong light even at 0.5 mA. I don't know if that's still true when they are switched very fast. I don't know if their turn-on time is affected by the intensity of the current. I guess we'll find out :slight_smile: Anyway, for the 4x4x4 test cube I will include some variable resistors in line with the 100 Ohm resistors to see how much I can reduce the current without affecting the cube's light levels too much. This way, wehn I build the real cube, the 8x8x8 one, I might be able to use resistors which will reduce the current values much and this way the cube's power requirements will be significantly lower.

The Gate-Source pullup resistors, 5K should work well. Provides 1mA of pullup curent.
The Arduino-Gate resistor, 220 ohm , will pull the gate good & low. Vg will be ~5V*220/(5000+220) = 0.2V.

The LED current limit resistor:
(5V - Vce-pnp transistor - Vf-led - Vds-shift register)/(current-desired) = R
So an example might be:
(5 - 0.5 - 3.3 - 0.08)/20mA = 56 ohm
0.5 & 3.3 are my speculation, dependent on the parts selected.
0.08 is from Rds of TCIP6B595 of 4 ohm at 100mA, so 4ohm * 20mA = 0.08V

So read your datasheets, plug in your numbers & desired currents, go from there.

Thank you, CrossRoads!

So, in other words we do need the 220 Ohm resistors between the shift register and the NDP6020P-ND gate. We also need pullup resistors between the gate and source of the NDP6020-ND and their value should be 5 KOhm.

As for the LED current limiting resistor, I understand now which components drop voltage and need to be taken into account. I guess your guess of 0.5 is from the NDP6020-ND. I've read the datasheet, not just once, but I can't figure out the voltage drop based on the graphs. Here is the excat datasheet of the NDP6020-NDs that I've bought from Farnell: http://www.farnell.com/datasheets/59594.pdf

The 3.3 voltage drop for the LEDs is a correct assumption.

One more important question: CrossRoads, in your image the Arduino had some additional things (capacitors, resistors) connected to some pins on the top and left, so it would seem that not only the MOSI, SCK, SS and GND pins are connected. Is that needed, or is that just some leftover from another circuit? If needed, what values would those be and what is their role?

Thank you very very much or your answer!

Ok, I didn't realize the NDP6020 was a MOSFET with 0.023 ohm on-resistance. Its voltage drop will be 0.023 * planned current (# of LEDs per row) or very small.

I drew up a standalone microcontroller circuit; if you are using an actual arduino, those are already built in, so you only to connect to the SPI pins and Gnd.
The standalone circuit has 10K reset pullup resistor, 16 MHz xtal, 22pF caps, and 100nF caps on VCC/AVCC/Aref.

Thank you, CrossRoads, very much! :slight_smile:

So that means that the voltage for which we need to calculate the current limiting resistors for the LEDs looks like this:

5V (source) - 3.3V (LED) - 0.08V (TCIP6B595) - 0.023 * 64 * 0.02 = 5 - 3.3 - 0.08 - 0.03 = 1.59. In other words we need 82 Ohm resistors. Luckily I have a few hundred of those laying around :slight_smile:

At this point I understand the driving circuit 100%. I will soon post an updated diagram to reflect the reality accurately.

In the meantime I'm progressing with the 4x4x4 test cube. You guys were right when you advised me not to start with the 8x8x8 one. No amount of theory can prepare you for the difficulties encountered during soldering. A practice cube is a must. In a few days it will be ready and I'll come back with pictures.

Thank you all for your help!

1.59V/20mA = 79.5 ohm, 82 being a standard value should work well.

Here's the updated, hopefully 100% correct circuit diagram:

Thats pretty nice, I must admit, im a bit jealous. That looks like a pretty good schematic, it even includes specific part values, and the calculations.

I have been busy the last couple days strugling with my NPN transistor cube design. I accidentally smoked a few test parts (good thing for off board testing!), and my measurements are not what I had expected, and I think the parts I have, may not work well for what Im doing :frowning: I have considered re-designing it using n-channel mosfets instead of bjt. I think maybe 12 LEDs maybe too much for one sot23 2222 BJT NPN.

Im starting to like your design better, since mine isnt going anywhere quick!

Have you figured out Your BOM ? I hope this is close:
Nine TPIC6B585 shift register ICs
Nine .1uf ceramic capacitors
Eight 220 ohm resistors
Eight NDP6020P-ND P-channel mosfets
Eight 5k ohm resistors
Sixty-four 82 Ohm resistors
Five-hundred and twelve LEDs

Six-hundred and eighteen parts. That sounds like a lot, but its mostly the LED and resistors.

Wire/patience/skill...

You know, I sell this bare board for $5 that will do all but the resistors and P-channel MOSFET.
96 open drain outputs (TPIC6B595) that can sink cathode current from 64 columns and pull P-channel gates low to enable the 8 layers.
Save you a ton of assembly wiring time, you can concentrate on the cube wiring.

I was going to mention that in my BOM post, but I wasnt comfortable selling someone elses product, so im glad you posted that. That board will make that project a lot easier, and tidier. I didnt know it was only $5.

Do you also sell a populated board? I would think that a board that is populated and ready to use would also be of value to many people.

It seems to me, you could use that board, another board for the rest of parts (except the LEDs), and the LED cube. That would be very nice and tidy, and my guess is a lot harder to make a mistake.

I could sell them as populated. I don't advertise that, there are too many variations as to the parts that make up the board.
The ones I've assembled have been for specific projects.
IC Sockets? Male/Female headers? LED colors & brightness? Right angle or straight FTDI connector? Power connector type?

Same for the 'LED support' board.
I suppose a generic board with up to 81 cathode current limit resistors, 9 PNP or P-channel parts, and 9 gate/base pullup resistors could be put together.
(base current limit resistors too?)
Basically just not enough hours in a day for all the projects I'd like to do.

Hippynerd, I think your list of parts is accurate, or at least that's about what I have bought. But you might need to add the following:
-About 40 meters of silver plated copper wire (if you plan to make the cube quite lose, to ensure good visibility, the leggs of the LEDs just arent'long enough, so you'll need to make the whole structure out of craft wire)
-Some small size crocodile clips (at least 4) to hold the LEDs and craft wire together while soldering
-Some small hair clips to hold them together (or you could just borrow from a lady :stuck_out_tongue: )
-9 IC sockets for the shift registers so you can avoid soldering them directly onto the board
-A few hundred breakable male and female pin headers to attach to the LEDs (making it possible to detach the cube from the circuitry) and to attach different parts of the circuitry to each other (I'm planning on putting it on 3 PCBs)
-A few appropriate size PCBs to hold the whole thing
-A 5V power supply which can power 64 LEDs at once (for 20 mA per led I got myself a 5V 2A power supply)

CrossRoads, you did mention this board you are selling earlier in this thread and I was very tempted to request one from you (still am tempted in a way, but now it might take too long to arrive). The only reason I didn't ask you to sell me one was that I did not really understand what's on it and how exactly I could connect it to my project. Sometimes I wish they taught us some hardware at the university. Unfortunately I've only ever learnt software, all that I know about hardware is just from reading on my own...

Here's my idea for an LED support board.
Place to accept cathode drive, series resistor and connect out to LED columns.
Place to accept gate/base drive, pull up the gate/base, and connect out to the anode layers.

USPS mail only takes a few days in the US, and not much longer internationally.

This board is 132 x 100mm, maybe I'll see if resistor can be squeezed to fit on a 100x100mm board for lower cost.

I built my 5 x 5 x 5 cube on a perf. board with the resistors on the same board. I need to take another picture to show it.

@CrossRoads, I need a FET driver board for the Anode layers just like part of the board you are showing. Then, I think your sinker board that you have shown earlier would complete my project. I do not need the 81 resistor part of the board because my cube board already has the needed resistors.

Nice board design though!

Here we go, rearranged to fit in 100x100mm.

@cyclegadget,
The bare driver boards are $5 each mailed to US locations. I've got 10 on hand.
paypal to cardinaflyer @ comcast dot net.

CrossRoads, you should change your nickname to "SolutionMan" or "TheManWithTheSolutions" or something :slight_smile:
I's stretching my mind to understand the boards you presented here and I think I'm starting to realize how deeply convenient they are for this LED cube project!

I am seriously thinking about requesting an LED support board as it would be much more elegant than the perfboard solution I had in mind and it would save me a lot of time. I can't use it for the 4x4x4 test cube because with that one I plan to include variable resistors connected in series with the 82 Ohm resistors in order to experiment with how much current is exactly needed for the LEDs. With this approach I'll be able to determine the exact resistor values which I will use for the big cube (8x8x8). So, if my 4x4x4 cube will prove to work fine, I'll have to order such an LED support board from you. I like the 13.2 x 10 cm version better because it's less crowded.

As for the other board, which is meant to hold the shift registers, it's also very tempting. There are quite a few things I don't fully understand about it yet. For example I suspect that the IC1 (the big IC) on it is a microcontroller which is meant to replace the Arduino. If that's true, I probably don't need most of the left part of the board. But the bigger part, the right part, is a convenient way to hold the shift registers. Another thing I can't see is where I'd connect the MOSI, SCK and SS signals coming from the Arduino.

I see that you design very nice boards, which you also sell for more than correct prices. Do you by any chance happen to have a version of the shift register board specifically designed to work with the Arduino? If I understood things correctly, that would make the board smaller because it would leave out the left part of it. It would also be more elegant.

Final question: Did I understand correctly that these boards that you presented are completely naked, I mean there aren't even pin headers soldered to them, they are just the boards, and nothing else?

Thanks,
Andras

SolutionMan, I like that.
I'm still playing with the LED support board, iteadstudio is still closed so there's time.
I like the 10x10 because it will a lot less money - 10 x 13.2 jumps way up in price.
The other board has Arduino function built right in - just connect an FTDI Basic, FTDI Cable, CP2102 module for a USB interface.
Or, build it up with shift registers & caps, and connect arduino SPI wires to the correct pins.
$5 gets you a bare board.
I can assemble one for you, we'd have to discuss specifics on parts, as I mentioned on Reply #143.

Ok, thank you :slight_smile:
I'll first see how my 4x4x4 test cube turns out and if the hardware and software parts both prove to be correct, then I'll most likely need an LED support board :slight_smile: I'm still thinking about the other one...

CrossRoads, I think I've spotted a mistake on all he connection diagrams that we've shown so far:

If you look carefully at the TPIC6B595 shift register on the bottom of the diagram (the one which drives 8 cathode columns) and at the connections to its pins 13 and 12 (SRCK and RCK), you'll see that according to the connection diagram the SRCK connects to the next shift register's RCK and the RCK connects to the next shift register's SRCK. It think that's messed up and should be the other way around. I think that all shift registers should have their SRCK pins connected together and their RCK pins connected together, including the shift register which drives the anode planes. In other words, the Arduino's D13 (SCK) should be connected to all shift registers' SRCK and the Arduino's D10 (SS) should be connected to all shift registers' RCK. Am I right?

Another question that came to my mind: looking at the TPIC6B595's data sheet, I se that its pin 2 is marked VCC. In our diagram pin 2 is not connected to the 5V rail. Is that OK?

Thanks,
Andras

The "To Next Device SCK" & "To Next Device SS" notes are swapped, I'll agree with that.
Pin 2 is shown connected to +5V.