RGB LED CUBE 4x4x4

3,702

20

24

Introduction: RGB LED CUBE 4x4x4

About: PLC, Arduino - Do it yourself project

Today I'll share how to make an 4x4x4 led cube which is built from Arduino Nano, RGB LEDs 10mm - common anode and double side prototype PCB.

Let's get started.

Step 1: PARTS LIST

Main parts include:

Step 2: SHEMATIC

For 4x4x4 RGB led cube, we have 4 layers and each layer has 16pcs x RGB leds. The control circuit works as follows:

- 4 layers are controlled by 4 transistors

- 16 RGB LEDs are controlled by 6pcs x TPIC6B595N. Each RGB led has 3 colors so each color of 16pcs x leds is controlled by 2pcs x TPIC6B595N.

Step 3: SOLDERING LED CUBE

You can refer to lots of projects related to build a led cube or check at my instructable:

https://www.instructables.com/id/Interactive-Color...

And you should make a wooden cube template with 16 holes, diameter 10mm and led tester with battery to check before and after soldering your LED.

After soldering 4 planes of led cube, I arranged and assembled them into the Prototype PCB.

I aligned them neatly and symmetrically then soldered them to the Prototype PCB.

On top of led cube, I soldered 16pcs x RGB led in same layer together. We have totally 4 layers and they are connected to a female header 4 pins. Later they will be plugged on control board by this header.

At bottom of led cube, I soldered LED pins to 6pcs x 8P-female headers in color groups: RED, GREEN & BLUE. Because each layer has 16 RGB LEDs, so we need to use 2pcs x TPIC6B595N to control each color.

Led cube is done!

Step 4: SOLDERING CONTROL BOARD

I used a remaining prototype PCB to solder the control circuit following the circuit diagram on STEP 2. Note that in order for led cube and control board to be matched together perfectly, firstly we have to align & solder all male headers on control board following female headers of led cube.

Picture below is bottom side of control board. I soldered all capacitors at bottom and you can see there're 4pcs x high power transistors. They can control layers in case 4pcs x low power transistor A1013 cannot work well. It is an option even though I know the A1013 can handle 16 RGB LEDs in one layer.

Finally I plugged led cube on top of control board. Everything is perfect now!

I glued a box by acrylic plate that contains just enough prototype PCB

With this box, we can place the led cube with different poses as shown below

Step 5: PROGRAMMING

The project code is available at my GitHub:

https://github.com/tuenhidiy/RGB-LED-CUBE-4x4x4

Step 6: FINISH

Above are some pictures which were taken during I assembled and soldered this led cube.

Thank for your watching!

Be the First to Share

    Recommendations

    • DIY Summer Camp Contest

      DIY Summer Camp Contest
    • Fandom Contest

      Fandom Contest
    • First Time Author Contest

      First Time Author Contest

    24 Comments

    0
    BruceC94
    BruceC94

    1 year ago

    I have convinced myself that your schematic has an error for the A1013 transistor (PNP). Pin 1 (Emitter) is Vcc. Pin 2 (Collector) is the LED "LAYER" and Pin 3 (Base) is the Arduino Dx signal. Writing the signal bit LOW causes LED ON. I tested this on a breadboard. Do you concur?

    0
    tuenhidiy
    tuenhidiy

    Reply 1 year ago

    My connection for A1013 is as folow: Pin 1 to 5V, Pin 2 to Led Anode, Pin 3 to Arduino control pin.
    You can check in google the keyword: "pnp transistor and led diagram".

    0
    BruceC94
    BruceC94

    Reply 1 year ago

    Dear Tuenhidiy - OK! Everything works. I had to rewire the A1013 pins. I had finally deduced the same configuration you just sent. The LED test pattern (#3 in your code note) works perfectly. I also had to swap the lines of code in your note #1. THANK YOU! I do recommend writing a "LESSONS LEARNED" note with the corrections in your GITHUB page. I can submit that if you want me to.

    0
    tuenhidiy
    tuenhidiy

    Reply 12 months ago

    Finally you have succeeded. Congrat!

    0
    BruceC94
    BruceC94

    Reply 12 months ago

    Thank you. One strange thing - the unit runs correctly on Arduino power, but when I apply external 5v VCC, the layers are all enabled, and are not independent. Somehow (I think) this biases the transistors incorrectly so they stay on (???).

    0
    BruceC94
    BruceC94

    1 year ago

    Another issue - everything is "working" but the layers0 to layer3 are always ON, so anytime an LED is to turn on, the entire vertical column lights up. Your schematic shows the 5v VCC connected to the A1013 COLLECTOR. Is this correct? And shouldn't the Arduino signal be connected to the BASE rather than the EMITTER? Please explain, thank you.

    0
    BruceC94
    BruceC94

    Reply 1 year ago

    I tried to upload a short video to show this but the server didn't accept it. Hopefully these two screenshots show it. See how the whole vertical column lights up. This is from your software, the first picture is the very beginning.

    snapshot_001.bmpsnapshot_002.bmp
    0
    tuenhidiy
    tuenhidiy

    Reply 1 year ago

    Hi BruceC94!
    1. For anode scanning, if transistors A1013 are used, you can invert the logic here:
    PORTD |= _BV(layerArray[lastAnode]); // turn off the previous layer
    PORTD &= ~_BV(layerArray[anodeLevel]); // turn on the previous layer
    Try this firstly.
    2. For cathode scanning, you can change softwares as below to correct the hardwares connection:
    FROM: (with x: 0~3)
    //Blue
    SPI.transfer(blue[x][level + 1]);
    SPI.transfer(blue[x][level]);
    //Green
    SPI.transfer(green[x][level + 1]);
    SPI.transfer(green[x][level]);
    //Red
    SPI.transfer(red[x][level + 1]);
    SPI.transfer(red[x][level]);
    TO: (with x: 0~3)
    //Red
    SPI.transfer(red[x][level + 1]);
    SPI.transfer(red[x][level]);
    //Green
    SPI.transfer(green[x][level + 1]);
    SPI.transfer(green[x][level]);
    //Blue
    SPI.transfer(blue[x][level + 1]);
    SPI.transfer(blue[x][level]);
    3. You should test each led with each color (R, G, B) in the cube as follow:
    // For RED
    for (byte x=0; x<4; x++)
    {
    for (byte y=0; y<4; y++)
    {
    for (byte z=0; z<4; z++)
    {
    LED(z,y,x,15,0,0);
    delay(1000);
    }
    }
    }
    // For GREEN
    for (byte x=0; x<4; x++)
    {
    for (byte y=0; y<4; y++)
    {
    for (byte z=0; z<4; z++)
    {
    LED(z,y,x,0,15,0);
    delay(1000);
    }
    }
    }
    // For BLUE
    // For RED
    for (byte x=0; x<4; x++)
    {
    for (byte y=0; y<4; y++)
    {
    for (byte z=0; z<4; z++)
    {
    LED(z,y,x,0,0,15);
    delay(1000);
    }
    }
    }
    0
    BruceC94
    BruceC94

    Reply 1 year ago

    It is still not working - I disconnected the control lines from Arduino D4-D7, which should shut off the transistors, but the LEDs still light up in the columns. The transistors are ON (forward bias) all the time. Also I put test LEDs on Arduino D4-D7 and they stay lit the entire time. Shouldn't they turn off when their layer is turned off?

    0
    BruceC94
    BruceC94

    Reply 1 year ago

    Dear Tuenhidiy - thanks for those code suggestions - however they did not work(!), neither #1 nor #2. I still get the full "vertical column" as I showed you in the photo I sent last time. Please know I tested an A1013 in a breadboard and could NOT get it to turn off using your wiring configuration. The only way it worked was PIN 1 (Emitter) VCC, PIN 2 (Collector) to Layer(x), and PIN 3 (Base) to Arduino D(x). Please tell me if I am crazy or if this makes sense??? (You have VCC to pin 2, etc.).

    0
    BruceC94
    BruceC94

    Reply 1 year ago

    Thank you - I will try that. I have the A1013 transistors and common anode LEDs as specified in your instruction sheet. I'll go with option 1 then.

    0
    BruceC94
    BruceC94

    Question 1 year ago on Step 5

    Greetings! I am glad to say that ALMOST everything is working !!! Yay!!! (please ignore all previous comments). The entire LED matrix lights up and runs through your code. BUT the sequence of lights suggests that I misinterpreted your drawings and wired some of the LEDs in a different order than you did. First question - do the serial in/out connections TPIC6B595's have to be wired in the exact order shown on your schematic? And if so, is it possible to fix this in the software definitions rather than rewire the circuitry?

    0
    BruceC94
    BruceC94

    Question 1 year ago on Step 5

    Hi - I am making great progress building this, BUT... I don't understand how you assembled the two boards together. My 40 pin headers (male and female) when together don't make enough space for the the IC's and arduino board to fit underneath the top LED board, especially with all of the wires running underneath. It's VERY tight in there!!! What is your secret? HELP please!

    0
    BruceC94
    BruceC94

    Reply 1 year ago

    Thanks, but NO - this did not help. I was glad you gave me an option but I did not read the fine print - this extended male headers are 2.0mm, not 2.54. So I ordered, waited, and realized a week later that these are not going to fit! I still don't know how you assembled this and got everything (ICs, Arduino) to fit between those two boards with all of the wiring in there as well. My other option seems to be flipping the control board upside down.

    0
    tuenhidiy
    tuenhidiy

    Reply 1 year ago

    Hi BruceC94,
    Sorry for making you confused. I mean, we can choose a male header with pins as long as possible and its spacing is still 2.54mm. Firstly, the male and female headers should be solder on control moulde and led module, then base on this, remaining electronic components are arranged and soldered later. You can see the bottom side of control module at STEP 4. I soldered all de-coupling capacitors and high power transistors TIP42C at bottom.

    0
    BruceC94
    BruceC94

    Reply 1 year ago

    Thank you - I have made much progress now. Everything is assembled. However I am having trouble uploading your code to the Arduino Nano - it says "avrdude:stk500... programmer is not responding" Quits after 10 tries. I am looking for help on getting the IDE to connect! ANY TIPS???

    0
    BruceC94
    BruceC94

    Reply 1 year ago

    OK, thanks for that - the Nano is working fine. However I cannot get the whole thing working. I've gone over the circuit and eliminated any shorts or soldering problems. Can you give me a simple code for turning on all RED LED's? I need them on steady so I can check voltages. Also your schematic shows the 1Kohm resistors as 560ohm. Is that difference a problem or is it sufficient to switch on the transistors?

    0
    BruceC94
    BruceC94

    Reply 1 year ago

    NEVER MIND! I finally found it - I connected the SERIAL / DATA lines incorrectly... :(
    However, if you have any simple diagnostic code - it would still be nice to have. Maybe I'll develop some for you.