Introduction: My 4x4x4 LED Cube

*Note* This project is done by students from Singapore Polytechnic
4x4x4 LED Cube

This fun pet project is using Arduino with 64 LED to display any patterns of your choice.
This idea was giving by our Final Year Project Supervisor, Mr Teo Shin Jen. 

Components used :
1 Arduino
64 5mm LED of any of your favorite colour
Blue Tack (To stick the LED on for easier soldering)
Wire
Molex Pins and headers.

The tools and components were provided by our FYP supervisor Teo Shin Jen.

Instructions:
1. Solder up 4x4x4 LED together
2. Connect up the pins to Arduino
3. Code used







Step 1: Soldering the 64 LED Together

Concept of this LED Cube :

(First layer of the cube is from the bottom and the fourth layer of the cube is at the top)
Layer 1 and layer 2 positive side of the LEDs are connected.
Layer 2 and layer 3 negative side of the LEDs are connected.
Layer 3 and layer 4 positive side of the LEDs are connected.
Layer 1 and layer 4 negative side of the LEDs are connected.

All in all, the total number of pins this 4x4x4 LED cube used is 16.

Soldering of the 64 LEDs :

Start by soldering layer by layer. Bend the negative/positive side of each LED and join them together. Place the LED upside down and stick them on BlueTac so they are stable upright. (Easier to solder)
After finishing up 4 layers, join them up using wires and solder everything on a strip board.
This strip board will act as a shield for the Arduino.

Step 2: Connect Up the Pins to Arduino

Arduino Pins

Basically, all the digital pins of the arduino are going to be used and 2 analog pins (A0 and A1) will also be used.
The positive side of layer 3 and layer 4 will be digital 0-3
The negative side of layer 2 and layer 3 will be digital 4-7
The positive side of layer 1 and layer 2 will be digital 8-11
The negative side of layer 1 and layer 4 will be digital 12-13 and A0-A1 

(If you want to make the wires look neater, you can use molex pins to connect the wires to the shield)

Step 3: Code Used

void Light (int);

void setup() {                  
  for (int i=0; i<16; i++)
    pinMode(i,OUTPUT);
}

void loop() {

 Light(1);
  delay(50);
  Light(0);
  delay(50);
  Light(2);
  delay(50);
  Light(0);
  delay(50);
  Light(3);
  delay(50);
  Light(0);
  delay(50);
  Light(4);
  delay(50);
  Light(0);
  delay(50);
  Light(3);
  delay(50);
  Light(0);
  delay(50);
  Light(2);
  delay(50);
  Light(0);
  delay(50);
  Light(1);
  delay(50);
  Light(0);
  delay(50);
  Light(2);
  delay(50);
  Light(0);
  delay(50);
  Light(3);
  delay(50);
  Light(0);
  delay(50);
  Light(4);
  delay(50);
  Light(0);
  delay(50);
  Light(3);
  delay(50);
  Light(0);
  delay(50);
  Light(2);
  delay(50);
  Light(0);
  delay(50);
  Light(1);
  delay(50);
  Light(0);
  delay(50);

}

void Light(int x)
{
  switch (x)
  {

    case 1: PORTD=B11111111;
              PORTB=B00000000;
              PORTC=B000000;
              break;

    case 2: PORTD=B00001111;
              PORTB=B00110000;
              PORTC=B000011;
              break;

    case 3: PORTD=B00000000;
              PORTB=B00111111;
              PORTC=B000011;
              break;

    case 4: PORTD=B11110000;
              PORTB=B00001111;
              PORTC=B000000;
              break;


  }
}


By changing the binary you can get different LED to light up.
The default binary is PORTD = B11110000;
                                      PORTB = B00110000;
                                      PORTC = B000011;

So if you wan specific LED to light up u have to invert that particular bit of the binary.


Step 4: Final Product


LED Contest with Elemental LED

Participated in the
LED Contest with Elemental LED