### Introduction:

We are two students on our second year of a Bachelor Programme in Software Development.

This is a small guide on how to make a 5x5x5 LED cube.

The purpose of the project was to learn some basics about working with Arduino. This project was the first that let us work with any kind of hardware (except for computers).

The project was made in under 10 days due to a small timeline. Our focus has been on the code and getting the cube up and running. We focused very little on the design of the cube.

Step One, investigation:

Question: How do we make a cube with 125 diodes and control it with only the pins on the Arduino?

The answer we came up with was using multiplexing!

Here's a good explanation of multiplexing: (The creds are not mine)

What more?

Now we know multiplexing, but how about knowing which components to use?

We searched around the Webb to find answers to that! There are many guides and many forums that will help with this.

We found out our list of items, these are the items we used:

• 125 Diodes (We didn’t use defused, you SHOULD use defused to make it easier to see individual diodes)
• 30 resistors (150-250 Ohm)
• 5 transistors (BC182LA TO-92 NPN) 5 Decoders (74HC238N, you can get holders for the decoders, we did)
• Initials (a board, cables and solding materials)

When the project was made we used a Potentiometer. You can skip this part as we only used it to get values from a physical component to control the diodes.

We live in Sweden, all the materials we needed could be found at electrokit.com, we bought some items from there and some from Kjell & Company.

Total price got around 350kr, though we bought all solding materials and a potentiometer. You might pay less!

## Step 1: Led Cube 5x5x5 - a Small Student Project. P2

### Let’s start!

As of now we have all the materials we need!

What now? Circuit diagram!

One of us owns a Surface Pro 3, we used OneNote and the stylus to create the actual circuit diagram.

We stared out by deciding how the diodes should be setup to make the actual cube. We found out that if we take the anode (longer leg +) and bend it straight out and then down we will be able to put diodes on top of each other.

Next we bend the cathode out so that the diode will have its two legs in a about a 90 degrees angle. Now we are able to build a cube out of this!

We used extra cable as we made our base stand for the diodes too big. This led us to do more work than we had to actually do. Think about dimensions! Before you start!

Let’s talk about the Circuit diagram!

The upper left decoder is the one to control which other decoder that should be active, let’s call it the controller!

The other decoders are the once connected to the columns of the cube. These will all get the same in-signal. If you give a binary 8 then with the help of the Controller choose which decoder to be active you will be able to say which diode you want to light up!

001 will give 1 and if you give 001 from controller you will light diode nr 1…..

When you have choosen the right column you will need to choose the right layer. We are using pins streight from the arduino for this. The transistors get a + signal and then they let the current to trough, giving your choice of diod all it needs, plus and minus.

Lager = layer, I'm sorry about my handwriting! I Hope you can read it anyway!

E1 and E2 will need GND and E3 will need 5v (Shown in truth table), otherwise the image will show you all you need to know to make the cube.

Let's talk simple code example:

This is the initial code needed to run this exact cube.

Setup your pins, use a shift method to get to the right decoder, choose layer and a colum number!

Now just make a simple method to make the cube shine! Ps: don't forget the delay, give the diod its time ;)

```void setup() {<br>  // decoder 1-4 in signals
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);

//decoder 5 in signals
pinMode(10,OUTPUT);
pinMode(9,OUTPUT);

//E3
pinMode(8,OUTPUT);
digitalWrite(8,HIGH);

// Layers
pinMode(7,OUTPUT);
pinMode(6,OUTPUT);
pinMode(5,OUTPUT);
pinMode(4,OUTPUT);
pinMode(3,OUTPUT);
}
```
```// This method will auto-shift to the right decoder for the diode.
// This will simplify the rest of the code. To light a diod simply choose layer and column!
void diod(int column, int layer) {
PORTD = B00000001 << layer+3;
int temp = column/8;
PORTB = ((column << 3) + (temp << 1)+1);
}```
```void loop() {
example();
}```
```void example() {
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 25; j++) {
diod(j,i);
delayMicroseconds(150); // 150microseconds delay to let the diod actually light up!
}
}
}
```

## Step 2: Led Cube 5x5x5 - a Small Student Project. P3

### At last, Thanks!

It's been a fun few days and we've leared alot!

We both hope that you will enjoy what you've read and seen!

The project takes a litle background knowledge, programming basics and math logics.

It does not take much to understand though! :D We hope that what you've got will be enough for your project!

If you have any questions just ask, cheers!

Here's a our cube!

It's simple, but it's cool anyway! (sorry about the quality!)

Authers: Alexander Herlin & Joakim Kajsjö Students at HKR Sweden

<p>Can I use the BC547 or BC548?</p>
<p>Which transistor you are using?</p>
<p>what TRANSISTOR to replace BC337N ??</p>
<p>What you need it a NPN transistor. </p><p>This one is at 0,5A and 50v. </p><p>A stronger one or an equivalent is needed =)</p><p>Sorry for the late answer!</p>
<p>you can explain the picture!!!</p>
<p>What do you need explained?=) how can I make it more understandable? =)</p><p>It should be as readable as I can get it. But i'll try to help!</p><p>// Alex</p>
<p>thanks so much</p>
<p>I'm make cube 5x5x5...can you help me?</p>
You're right about using the diffused LEDs. My first cube was a 3x3x3 with clear blue LEDs. My second was a 4x4x4 with diffused blue LEDs and it looks SOOOOOO much better when you use diffused. Great looking cube. Thanks for sharing.
<p>Yeah, since we are using non-diffused diods it's hard to see the individual diod.</p><p>Don't know if it has to do with the color of the diod itself, but using diffused diods should make it easier to see individuals. </p><p>Thanks for taking time reading it! :D</p>
<p>That turned out looking great! Thanks for sharing! </p>
<p>Thank you!</p><p>Yeah, the color of the diods make it look even cooler!</p>

### About This Instructable

11,120views

198favorites

License:

More by alexander.herlin:
Add instructable to: