Introduction: LED CUBE 5x5x5

Build your own 3-dimensional LED Cube (for Educational Purpose)

On Instructables, there is so much to learn also a great platform for people like us to publish their work. This Instructable is all about how you can make your own 3 dimensional 5x5x5 LED Cube easily.

This following Instructable will cover all the fundamental things need you to know along with theory and is in step-wise procedure in detail which will make you understand every thing from how to arrange LED's in proper order, how to connect all LED's together, how to create awesome animations using Arduino Mega 2560, also how to code in short so that you can create your own animations.

Many images are also uploaded, few with some edit as to understand the 3 dimensional structure of cube properly.

Follow this steps and your own LED Cube will slowly start existing.

The purpose and efforts behind these project was educational, to represent 3 dimensional crystal structure and understanding them will become a lot easier by looking at some almost similar model. It helps to understand other by these LED cube than by reading theory and just telling them to imagine 3D and feeding them 2D.

Step 1: Components and Materials Required

There are many things you will be requiring.

List is as follows :-

  • 125 LED's (of any colour),
  • Arduino Mega 2560,
  • 330 Ohm or 470 Ohm - Resistors - Quantity 5,
  • Conducting rod ...(for supporting cube vertically),
  • Wires :- a) Solid core wire ...(for connecting LED's horizontally),
  • Wire for soldering ...(from cube to Arduino),
  • Soldering iron, solder flux and soldering wire,
  • Wire stripper, Multi-meter, etc.

Step 2: TESTING of the LED's


A light-emitting diode (LED) is a two-lead semiconductor light source. It is a p–n junction diode that emits light when activated. Diodes only allow current to flow in one direction, and they're always polarized. A diode has two terminals. The positive side is called the anode, and the negative one is called the cathode.

A LED emits light only when it is in forward bias i.e. anode connected to high and cathode to low.

HOW TO IDENTIFY LED TERMINALS - Terminal longer in length is anode and other terminals i.e. the shorter one is cathode


  • Set multi-meter on continuity test mode.
  • Make sure RED colour multimeter probe is inserted in positive (V) jack and BLACK colour in common (ground) jack. (as just for being systematic and have no confusion ahead).
  • Connect red probe of anode (longer lead of LED) and black to cathode (shorter lead of LED). LED will emit light if not considering all the steps properly followed then you might have to throw it away.

Using bread board we can test many LED's at one time only as to save time. Make sure every LED which will be required lately is working.

Step 3: Arrangement of LED's in CUBE

A]How to bend LED leads -

1) Hold LED in such a way that cathode is in your right and anode in left.

2) Bend cathode towards you and trim the lead a bit.

3) Bend anode in left ( see that anode and cathode are perpendicular to each other). Then bend the anode upwards.

REFER image.

  • Explanation - Logic or reason behind bending LED lead in such proper way is to make sure while making the structure of cube as while connecting /taking out common cathode or common anode of co-linear LED's will be properly align in straight line and nothing gets short circuit i.e. overlap.

B] Arrangement of LED's in a layer -

There will be 5 layers ( from top to bottom ) and each layer will be of 25 LED's of dimension 5 x 5 ; All LED's in one horizontal layer are connected via their cathode. And all five horizontal layers are connected via by connecting LED's aligned vertically. THIS PART WILL BE EXPLAINED IN BRIEF IN 'MAKING OF THE LED CUBE' STEP

Take a cardboard box or polystyrene sheet, draw a square of dimension 12 cm x 12 cm , and then draw 5 x 5 grid lines having spacing of 3 cm.

REFER IMAGE - As shown in image GREEN arrows indicates the direction of cathode and RED arrows indicates the direction anode. (refer image for better understanding)


  • Draw a grid of 5x5 with accuracy on a cardboard or polystyrene foam sheet. (Spacing between two LEDs is recommended about 3 cm, importantly it should be convenient and comfortable to solder the grid all together)
  • Highlight all 25 vertices and make small hole at each one of them such that the LEDs when inserted remain fixed and still and sufficiently tight enough for not to move or slide while soldering.
  • Observed and make correct arrangements such that all the cathodes (Green arrows) are align in a single line from the top view, whereas anodes (Red arrows; vertically bended lead of LEDs) are in straight line from side view. refer image.
  • Note that CATHODES are the lead of LEDs which are bend Horizontally and are Parallel to ground surface, where as ANODES ( Red arrows) are the lead which are bend little bit horizontally for spacing ( As nothing gets overlap) and Vertically Upwards
  • Take a solid core wire and remove its insulation or else any straight sufficiently strong conductor will work and cut it into 7 piece, length equal to 12 cm ( length of your 5x5 drawn grid).

Soldering of Horizontal layer :-

  • First of all place the conductor at a edge and solder one by one point ( i.e. cathode with horizontal conductor)
  • Like that solder all the outside edges of the grid to form a square
  • Now, by observing it can be figure out that three more conductors are require to solder the inner cathodes of LEDs aligned. Note that if you them in a particular direction and follow it for all the 5 grids.
  • OPTIONAL - one more conductor can be solder between the LEDs i.e. in the spacing of the grid just for the increasing the strength.
  • Make sure no anode is stuck/short-circuit with anything and all the 25 LEDs in the grid have one common cathode.
  • Take a multimeter, set it on continuity mode and connect 'com jack' probe to common cathode of the grid i.e. to the horizontal layer at any one place and 'V' jack probe to anodes of each LED one by one. Make sure no LED has stopped working.
  • Remove the grid slowly, and identically make remaining 4 grids. (REASON to make all the grids exact identical is because when all the 5 grids will be solder to each other to form a cube, anode of a LED in a grid will be align with the anode lead of LED with other grids. such that it would be easier to solder grids without getting something short-circuited.

Step 5: Making of Cube

Before going to further steps, check all the grids whether all the LEDs are working properly or not, if there is any fault in any one of them; replace them with other LED after desoldering the faulty one. Mainly search for a short-circuit if any.

Now, take conducting rods enough strong to hold the whole structure neatly. Total 25 conducting rods will be require of length 16cm-18cm.

Take polystyrene sheet or cardboard box like that and draw 5x5 grid with all the corners and intersection. Place a grid such that the LEDs are facing downward and are fixed into the object sufficiently tight enough.

Hold a conducting rod at any corner LEDs and insert it in the object by 1-2 cm just for keeping the structure stable at first later it can be cutted out. Now, roll the anode lead of the corresponding lead around the conducting rod and solder it neatly.

Refer Image,

Like that, do it for all 25 LEDs. Once one grid is done with soldering vertical conducting rods. Take another second grid and hold it in same way the bottom/first grid is and insert it the vertical conducting rods.

Leaving 3 cm distance from first grid, hold the second grid and roll its anode leads around the conducting rods so that it remain in its place. Then it becomes easy to solder.

Its little bit hard to solder middle girds/layers but only first 2 or 3, later being used to its just 5-10 minutes work.

After soldering all the five grids of LEDs to vertical conducting rods, remove it carefully and place it on a insulating surface and LEDs facing up. Now again check all the LEDs with multimeter; connect common probe to horizontal layer and just touch the vertical conducting rods one by one, do it for all the grids.

Congrats, our LED 3 dimensional structure is READY!!! a little way to go.

Step 6: Naming LEDs

Naming LEDs in systematic and proper order is necessary as it will get alot easier to edit the code by knowing a LED directly by its co-ordinates

REFER IMAGE :- Briefly explained....

Co-ordinate system - (Layer Number , LED Number)

That first LED will be at (0,0) and last LED will be at (5, 24)

Step 7: Taking Out Cathode and Anode of Overall CUBE

From this step is all get easier and we are almost reaching to our final point.

Take a good card-board box or even a polystyrene sheets will work, and insert your LED cube in it as to get support and making it compact and portable.

  • Taking out Common Cathodes of Cube

Since every horizontal layer of the LED cube has common cathode so we take out cathode from every layer

Take solid core wire and solder it to bottom layer ( Layer no. 0). We can call it Common Cathode 0 i.e. CC0

Similarly, with other horizontal layers and thus we get CC1 , CC2 , CC3 , CC4

Wire length should be enough to reach to Arduino. Easy right!!

REFER image :-

  • Taking out Common Anodes of Cube

After inserting the cube into the card board box or polystyrene sheet box, turn the whole cube by 180 degree.

Cut out 25 pieces of solid core wires of sufficient length

Solder the wire with every anode which common to all Vertical LEDs. Thus we have now total 25 Common Anode (CA_), i.e. CA0, CA1, CA2, CA3, CA4..............., CA25

REFER image :

OPTIONAL : You can labelled every wire by its numerical name so that there is no confusion.

Now we can test and prove that each combination of {CC0, CC1,........CC5} and {CA0, CA1, CA2, CA3, CA4..............., CA25} lights up one at a time i.e. EACH LED DIODE CAN BE CONTROLLED INDIVIDUALLY.

Step 8: Arduino

Now, since Common Anodes and Common Cathode are taken out of the LED Cube, only remaining steps are:

1) To connect CC0,...CC4 and CA0, ....CA24 to Arduino Mega 2560.

2) Coding the Arduino.

Remove the insulation of solid wires a little and insert them into Arduino pins as follows

  • CC0, CC1, CC2, CC3, CC4 to PIN Number 53, 52, 51, 50, 49 RESPECTIVELY.
  • CA0, CA1, CA2, CA3.........CA24 to PIN Number 22,23,24,25,26...........44,45,46.

REFER IMAGES for better, clear understanding.

NOTE - One can use Jumper wires Male Female or anything else which will work.

Also check the continuity of wires first. If wire is broken in between it will Create problems and importantly, analysing the problem and where it is or which wire is faulty is the MOST challenging and hectic part which one should totally try to avoid at first only.

Note :- Maximum I/O current for Arduino is about 45mA and for LED diode of 5mm 2V forward rated current is 20mA. Since these are maximum values, it's nothing much to worry about getting LEDs blowing up but for being on safer side resistor are used to limit current. Resistor are connected in series between Arduino and wire connections of LED cube to it.

Example :- CC0 -- resistor --- Arduino pin 53

Step 9: Coding

byte colPins[COLS] = {22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46};

byte levelPins[SIZE] = {49,50,51,52,53};

What is Array- 'In computer science, array programming languages (also known as vector or multidimensional languages) generalize operations on scalars to apply transparently to vectors, matrices, and higher-dimensional arrays.'

In simple language, array is an arrangement of list (anything) in a particular way.

Here in code at first we have have declared arrays for Column Pins i.e. for Common Anode and for Level Pins for Common Cathode.

Example - colPins[0] = 22; colPins[1] = 23; colPins[24] = 46

PIN NUMBERS IN ARDUINO, YOU HAVE INSERTED COMMON ANODES; COPY PASTE THE PIN NUMBERS IN "colPins" array's block i.e. in between "{....}" maintaining the sequence.

SIMILARLY, with Common Cathodes.

int frame_nacl[] = {0,0, 0,2, 0,4, 0,10, 0,12, 0,14, 0,20, 0,22, 0,24, 2,0, 2,2, 2,4, 2,10, 2,12, 2,14, 2,20, 2,22, 2,24, 4,0, 4,2, 4,4, 4,10, 4,12, 4,14, 4,20, 4,22, 4,24};

Whichever LED you want to illuminate, that particular LED co-ordinates (defined by layer number and LED number) type it in the above block without brackets in sequential and particular way

Example:- for LED (0,6) , (2,19) and (4,24)


NOTE - Following code is for NaCl Crystal Lattice structure and Diamond Crystal Lattice Structure.

Further editing can be done for different designs or shapes or structure.

Step 10: Finalize Project