8x8x8 multiplexed LED cube with an Arduino Mega 2560

Yepp, the top/front is the ground plane :slight_smile:
I'm not quite sure yet about how the pads (round and rectangular connection areas) are connected to the whole ground plane (which is mostly all a big copper rectangle), as they seem to have some isolation circle or rectangle around them, but I'll figure that out...

I have a really basic, but important question. The Arduino has some pins marked 5V and GND. See the group of pins which is leftmost on the bottom of the following image:

My question is: Are those 5V/GND pins directly connected to the power jack of the Arduino or the current passes through some circuitry in the Arduino before it reaches the 5V and GND pins? I'm asking because I want to determine whether I can feed my LED Cube Driver circuit from these 5V/GND pins of the arduino or I need to connect my LED Cube Driver to the real power supply's 5V and GND. As you know, my LED Driver Circuit can work with currents up to 1.3A and I'm wondering if it's safe to take that much current from the Arduino's 5V/GND pins...
It would be nice if I could feed my custom circuit from the 5V/GND pins of the Arduino because that way I would have only one power connector (on the Arduino), I would only need to solder some pin headers on my own custom circuit.

Thanks!

Im not sure about the mega, but the 328 based units seem to be limited to 500ma at the 5v pin. My guess is that 1.3a is going to too much, even for the mega. I think that the 5v pin limit is from the specific voltage regulator that is used (the part right next to the external power socket.)

Hippynerd:
Im not sure about the mega, but the 328 based units seem to be limited to 500ma at the 5v pin. My guess is that 1.3a is going to too much, even for the mega. I think that the 5v pin limit is from the specific voltage regulator that is used (the part right next to the external power socket.)

That and when using USB power there is a 500ma thermofuse that limits the maximum 5V current one can draw.

Lefty

Too bad... Well, then I'll just connect the LED driver board directly to the power supply unit.

Un4Seen:
Too bad... Well, then I'll just connect the LED driver board directly to the power supply unit.

Always a better way to go. The arduino boards are great at controlling stuff but are pretty wimpy at powering things.

Lefty

5V & Gnd are connected to the output of the 5V regulator, which is rated at 800mA,and is fed by a 1A rated diode from the barrel jack connector, or 500mA from the USB port.
For 1.3A, you need an external source for sure.

Extrenal 5V/GND connector it is then :slight_smile: This makes me wonder, though... the fact that I need to connect the Arduino's GND pin to the ground of the LED circuit still holds true, right?

Yes, Gnds must be connected. Arduino, LED "shield", power supply.

I have perfected the dual layer design. Here is the result:

Front (ground layer):

Back (Mirrored):

The power supply is supposed to connect through a barrel jack identical to the one on the Arduino (this should be soldered onto the LED cube driver board's front). The MOSI, SCK, SS and GND of the Arduino are supposed to be connected via standard pins (breakable pins soldered onto the front of the circuit, either male or female). The anode planes and cathode columns are supposed to be connected to the board via standard pins (male/female pin headers soldered onto the front of the board).

If any of you guys want to try producing a real board from the design, I'm happy to send you the Sprint Layout file or some exported results (PDF, Gerber file, drill data, isolation milling, PCB outline milling, etc.). Please keep in mind that this has never been tested (except virtually inside Sprint Layout), so there's a chance that it has some bugs :slight_smile:

Nice. See you figured out how to run some traces on the top too.
What's the size of the board now?

Thank you, CrossRoads :slight_smile: It may not seem like it, but there's a lot of work in that dual layer design :slight_smile: That's why I would happily share it with anybody who wants to use it. Of course, it would be nice if I could first prove that it's correct by building a board myself. I'm afraid that's going to take months, because soldering the 8x8x8 cube together is a tedious task. But it will be done one day and I'll be back here to inform you about it!

In the meantime, I've finished putting together the circuit today for the 4x4x4 test cube. I've done it on 3 solderless prototyping boards, without any soldering. I hope it will work. It also includes variable resistors to the LED cathode columns, so we'll know exactly just how much current we'll need for the big cube.
The 4x4x4 test cube is also soldered together and ready to go. It will take a few more days to write some basic software for it. I'm hoping that in about one week from now I will be able to show you some nice video about the 4x4x4 cube working. Perhaps I'm too optimistic, it will be a miracle if everything will work on the first go. Actually, I'm hoping that at least it will do something, even if not exactly what is expected and I'll be able to debug it. If no LED will light at all, that won't be funny... let's hope it does not happen.

Ok, good luck! I'd like to try a cube myself some day, not enough hours in the week right now tho.

Yeah, I know the feeling... if only there was enough time for all the projects that I can come up with...

Hi!

I've started writing the code for the LED cube and I've bumped into a question which might be very basic, but it's also important.
An SPI transfer begins by setting the SS pin to LOW and ends by setting it back to HIGH. In between you transfer the bytes with calls to SPI.transfer(). My question is: when exactly does the transferred data become live on the cube? Immediately after it's written with SPI.transfer(), or only after the SS pin is set back to HIGH?

I'm planning on transferring the data of an NxN horizontal plane like this:

void displayCurrentPlane ()
{
    digitalWrite (PIN_SS, LOW); //Start transferring data
    SPI.transfer (0xFF);  //Turn off the current plane (in fact all planes)(all 1s)
    digitalWrite (PIN_SS, HIGH); //Done transferring data

    digitalWrite (PIN_SS, LOW); //Start transferring data

    for (byte i = N - 1; i >= 0; --i) //Set up the LEDs inside the current plane
    {
        SPI.transfer (cubeData[currentPlaneIndex][i]);
    }

    SPI.transfer (~(1 << currentPlaneIndex)); //Turn on the current plane (current plane's bit 0, all other bits 1)

    digitalWrite (PIN_SS, HIGH); //Done transferring data
}

Does this seem correct?

Thanks!

Output registers of the shift register get loaded when SS goes high.

This only sends 1 byte out. I don't know how your shift registers are connected up - 3 daisy chained, 2 for the 16 LEDs in the layer and 1 more to control the layers?
If so, you'd need 3 SPI transfers.

    digitalWrite (PIN_SS, LOW); //Start transferring data
    SPI.transfer (0xFF);  //Turn off the current plane (in fact all planes)(all 1s)
    digitalWrite (PIN_SS, HIGH); //Done transferring data

You have a loop for the plane, and then 1 more for the layer. As long as the layer shift register is last in line I guess the 2nd part would work.
How is cubeData [currentPlaneIndex] organized? as 1 byte/LED, so you have 64 byte altogether representing the cube?

Hi CrossRoads!

Yes, the N+1 shift registers (where N is the size of the cube in one dimension) are daisy chained, one for the anode planes and N for the cathode columns. The first shift register on the line controls the anode planes and the rest of N shift registers control the cathode columns.

Indeed, this only writes out one byte:

digitalWrite (PIN_SS, LOW); //Start transferring data
SPI.transfer (0xFF);  //Turn off the current plane (in fact all planes)(all 1s)
digitalWrite (PIN_SS, HIGH); //Done transferring data

That should be enough to turn everything off, because the value (all 1s) gets into the first shift register and turns off all the anode planes, so it does not matter what is left in the next N shift registers, which control the cathode columns. Or at least, that's how I imagine it...

cubeData is a matrix consisting of NxN bytes. The first index is the plane index, the second index is the row index inside the plane. Each element of the matrix contains one byte, which holds the data for one column inside the horizontal plane. In other words cubeData has NxN elements and each element contains N bits (obviously N cannot exceed 8 ).

Did I understand correctly that when you have X pieces of shift registers daisy chained, the first byte sent out via SPI.tansfer() goes into the first shift register, then the second SPI.transfer() pushes it into the second shift register, and so on?

Actually, if the data goes live only when the SS pin is turned back HIGH, then I think this should be enough to switch to the next horizontal LED plane (next multiplexing step):

void displayCurrentPlane ()
{
    digitalWrite (PIN_SS, LOW); //Start transferring data

    for (byte i = N - 1; i >= 0; --i) //Set up the LEDs inside the current plane
    {
        SPI.transfer (cubeData[currentPlaneIndex][i]);
    }

    SPI.transfer (~(1 << currentPlaneIndex)); //Turn on the current plane and turn off all other planes (current plane's bit is set to 0, all other bits are set to 1)

    digitalWrite (PIN_SS, HIGH); //Done transferring data
}

Tonight I've "fired up" the LED cube. For about 2 hours it did not work at all. Turned out I had one short plus some misunderstanding about how my solderless breadboard's +/- rails work. I've solved these and the cube started working :smiley:

Unfortunately it doesn't quite work as I would have expected it to. There are some mysteries that I can't explain:

  1. In theory we have discussed that a cathode column can be turned on by setting its bit to 1. This works as expected. We have also discussed that an anode plane can be turned on by setting its bit to 0. Instead of this it turns on when I set its bit to 1, not to 0. I have followed CrossRoads circuit design 100%.
  2. When I turn an anode plane on (by setting its bit to 1) some other planes also turn on (one or two planes above/below it), but much more faintly than the plane that actually needs to be turned on.
  3. When I set all anode planes to off (by setting all bits to 0), the middle two planes turn on at full brightness.

For the anode/layer, writing a 1 into the shift register bit makes the output go low & turns on the PNP to make the anodes High.
For each cathode, writing a 1 into the shift register bit to make the output go low and turn on the LED.

Can you seperate the SS for the anode from the SS for the cathodes?

Instead of your funny << shift thing, pull the data from an array:

for (layer = 0 to 7){
// turn off all layers
digitalWrite(AnodeSS, LOW);
  SPI.transfer(0x00);
digitalWrite(AnodeSS, HIGH);

// write cathode - I suppose this could be the array structure you have above too
digitalWrite(CathodeSS, LOW);
  SPI.transfer(cathodeData[2*layer]);        // 0,2,4,6,8,10,12,14
  SPI.transfer(cathodeData[(2*layer)+1]); // 1,3,5,7,9,11,13,15
digitalWrite(CathodeSS, HIGH);
// this seems simpler to me tho - just 2 bytes per layer

// turn on anode
digitalWrite(AnodeSS, LOW);
  SPI.transfer(anodeData[layer]);
digitalWrite(AnodeSS, HIGH);

}