Project tutorial
LED Cube

LED Cube © GPL3+

Arduino based 3D LED Cube (3x3x3) which can produce any light pattern with 27 LEDs.

  • 8,218 views
  • 0 comments
  • 15 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

Project Abstract

I have developed an interest in Arduino programming. This is my first Arduino project. The goal is to make an arduino-based 3D LED cube 3x3x3 which can produce different light patterns.

The LED cube is made by using 27 LEDs arranged as cubical lattice. This LED cube can be used to give 3 dimensional light patterns. A microcontroller is used to produce the light patterns.

Status

The project has been completed successfully. The apparatus is able to give the light patterns according to the arduino code.

Specifications

Hardware

I built this apparatus using an arduino-uno microcontroller. I used arduino because I had already purchased a one and had some experience with it and I wanted to learn more.

I used 27 LEDs and 9 resistors for this. I used a arduino based small voltmeter (developed by myself) to find out the forward voltage of an LED. I used 220 resistors for my project because I wanted to avoid the risk of burning the transistors of digital output pins of the arduino board due to high output current.

Structure

I welded 3 separate layers of 9 LEDs with a common anode. The welding part took a little bit of patience as I had make sure that anodes and cathodes wouldn’t get contacted. Then I completed the lattice by welding the 3 layers together forming a cubical lattice with a common cathode for each pillar of 3 LEDs. Welding 3 layers together was hard because I had to make sure that the short circuit won’t happen and had to maintain the cubical structure.

The next part was connecting the LED cube to the breadboard. Since my cubical structure is not rigid, I couldn’t connect it to the breadboard without altering the structure of the bottom layer. In order to overcome this I welded the resistors directly to the cube and connected them to the breadboard. By bending the pins of the resistors, I could keep up the structure and balance.

I connected the 3 common anodes of each layer and the resistors of 9 common cathodes of each pillar to the digital pins of arduino-uno board.

Implementation & Construction

LED Cube Construction

1.Carefully solder the anodes of 9 LEDs together making an E shaped structure.

2.Cut the unnecessary parts of the anode after soldering.

3.Repeat the process producing 3 such layers.

4.Solder the 3 layers together by soldering the cathodes of each pillar of LEDs together.

5.Connect the common cathodes of LED pillars to the resistors.

6.Solder wires to the each layer of common anode.

7.Connect the 9 resistors and common anodes to the digital pins of the arduino-uno board.

8.Program the arduino (Arduino Code is attached to the report).

Figure 1 - Software block diagram

Figure 2 - Hardware block diagram

Functional testing

Power

When I light up more number of LEDs, the brightness of LEDs decreased. This occurred due to low current input to LEDs. I reduce the current output from each digital pins (connected to cathodes of LED pillars) to 13.3mA. I did this because I didn't know about the maximum current output value through the digital pins. As a result of this, each LED got only 4.4 mA current. To overcome this I should replace the resistors. I’m hoping to produce a much more developed version of this cube avoiding these problems.

Unwanted LED bulbs light up problem

After I had programmed some light patterns, results was not as expected. Some LED bulbs that was programmed to be turned off, kept turned on. I didn’t use a separate wire for each bulb so I couldn’t control each bulb separately. In order to overcome this problem I blinked some lights with intervals of 10ms. So it appeared to be lighten up continuously since the brain can’t process the difference.

Retrospective

I’m glad that I chose and finished this project successfully. This was my first project on Arduino platform.Programming arduino makes much fun and gives productive experience.

One thing I learned from this is that we can create an illusion using the delay() function and turning on and turning off some LED bulbs. I’m looking forward to develop this cube and increase its size, and also replace the arduino uno board with an arduino-nano board since it takes lesser space.

Code

LED_Cube.inoArduino
void l(int x, int y, int z) {
  if (y == 0) {
    digitalWrite(2, LOW);
  }
  else if (y == 1) {
    digitalWrite(3, LOW);

  }
  else if (y == 2) {
    digitalWrite(4, LOW);
  }
  if (x == 0) {
    if (z == 0) {
      digitalWrite(9, HIGH);
    }
    else if (z == 1) {
      digitalWrite(11, HIGH);
    }
    else if (z == 2) {
      digitalWrite(13, HIGH);
    }
  }
  if (x == 1) {
    if (z == 0) {
      digitalWrite(8, HIGH);
    }
    else if (z == 1) {
      digitalWrite(10, HIGH);
    }
    else if (z == 2) {
      digitalWrite(12, HIGH);

    }
  }
  if (x == 2) {
    if (z == 0) {
      digitalWrite(6, HIGH);
    }
    else if (z == 1) {
      digitalWrite(7, HIGH);
    }
    else if (z == 2) {
      digitalWrite(5, HIGH);
    }
  }
}
void ol(int num) {
  if (num == 1) {
    digitalWrite(2, HIGH);
  }
  if (num == 2) {
    digitalWrite(3, HIGH);
  }
  if (num == 3) {
    digitalWrite(4, HIGH);
  }
}
void onl(int num) {
  if (num == 1) {
    digitalWrite(2, LOW);
  }
  if (num == 2) {
    digitalWrite(3, LOW);
  }
  if (num == 3) {
    digitalWrite(4, LOW);
  }
}
void off(int x) {
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);
  digitalWrite(12, LOW);
  digitalWrite(13, LOW);
  delay(x);
}
void setup() {
  // put your setup code here, to run once:
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  onl(1);
  onl(2);
  onl(3);

  l(1,0,1);
  delay(500);
  off(50);

  l(0,0,0);
  l(1,0,0);
  l(2,0,0);
  l(2,0,1);
  l(2,0,2);
  l(1,0,2);
  l(0,0,2);
  l(0,0,1);
  delay(350);

  ol(2);
  ol(3);
  delay(350);
  off(0);


  onl(1);
  onl(2);
  onl(3);

  l(1,0,1);
  delay(500);
  off(50);

  l(0,0,0);
  l(1,0,0);
  l(2,0,0);
  l(2,0,1);
  l(2,0,2);
  l(1,0,2);
  l(0,0,2);
  l(0,0,1);
  delay(350);

  ol(2);
  ol(3);
  delay(350);
  off(0);


  onl(1);
  onl(2);
  onl(3);

  l(1,0,1);
  delay(500);
  off(50);

  l(0,0,0);
  l(1,0,0);
  l(2,0,0);
  l(2,0,1);
  l(2,0,2);
  l(1,0,2);
  l(0,0,2);
  l(0,0,1);
  delay(350);

  ol(2);
  ol(3);
  delay(300);
  off(0);

  onl(1);
  onl(2);
  onl(3);

  l(1,0,1);
  delay(500);
  off(50);

  l(0,0,0);
  l(1,0,0);
  l(2,0,0);
  l(2,0,1);
  l(2,0,2);
  l(1,0,2);
  l(0,0,2);
  l(0,0,1);
  delay(350);

  off(0);
  ol(2);
  l(0,0,0);
  l(2,0,0);
  l(2,0,2);
  l(0,0,2);
  delay(400);
  off(100);
}

Schematics

LED Cube 3x3x3
Led cube schem uqaa5nk0zx

Comments

Similar projects you might like

4x4x4 LED cube with Arduino Uno and 1sheeld

Project tutorial by Hassan Ibrahim

  • 29,722 views
  • 6 comments
  • 60 respects

Interactive 4x4x4 LED cube

Project tutorial by Tong Xin Hua

  • 1,608 views
  • 0 comments
  • 0 respects

LED CUBE 4x4x4

Project showcase by MakerRobotics

  • 23,974 views
  • 4 comments
  • 61 respects

4*4*4 LED Cube Using Arduino Embedded Prototyping Platform

Project tutorial by STEMpedia

  • 1,829 views
  • 0 comments
  • 9 respects

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 17,290 views
  • 4 comments
  • 34 respects

LED Cube 7x7x7

Project tutorial by Marcazzan_M

  • 4,442 views
  • 6 comments
  • 27 respects
Add projectSign up / Login