Ever heard of an embedded electronic project called LED cube? Actually, this project had been done by many embedded electronic hobbyists due to its interesting display effects by lighting up LED Cube in certain patterns. The LED Cube lighting patterns can be controlled by microcontroller based on the program loaded into it. In this tutorial, user will be guided to build up a 8x8x8 LED Cube in step by step. The resulted LED Cube from this tutorial will be looks similar to picture below:
Few pictures when the resulted LED Cube light up are shown below.
a) Light up of all LEDS of the Cube b) Light up of a particulat LEDs layer of the Cube
c) Light of a particular LED of the Cube d) Light up of pattern “C” at the top of the Cube
A short video demonstrating available lighting mode of the resulted LED Cube is shown below.
Note of the video:
- The SK40C is an enhanced 40 pins PIC Start-Up Kit that will be plugged in with PIC16F877A acts as the microcontroller module for the LED Cube.
- All the lighting modes of the LED Cube in the video are working based the sample code provided for the LED Cube project to be executed in this tutorial. The sample code can be downloaded through the “Attachments” section at the bottom of this article,
Before proceed to start doing the LED Cube project, let’s have an understanding on working principles of a 8x8x8 LED cube.A 8x8x8 LED Cube is built up with 8 LEDs layers with each layer contains 64 LEDs. All cathode legs of LEDs in a particular layer will be soldered together. While anode legs of LEDs in a particular layer will be connected to anode legs of another layer in such away that an anode leg of a LED in the upper layer will be soldered to an anode leg of a LED just located below it in the lower layer for each of 64 LEDs during the stacking up of the LEDs layers to build up the LED Cube. Hence, it can be said that a 8x8x8 LED Cube is made of 8 “cathode” layers and 64 “anode” columns.
a) A particular “cathode” layer b) A particular “anode” column
Figure 2: “Cathode” layer and “anode” column
For each LEDs layers, their respective cathodes normally will be connected to 8 transistors (which are controlled by 8 I/O pins of a microcontroller) separately. The cathode for a particular LEDs layer can be activated (shorted to ground) by turn on the transistor connected to it. While, the 64 “anode” columns will be controlled by another 64 I/O pins of the microcontroller. Hence, to light out a particular LED of the LED Cube, just need to activate the “anode” column and cathode of the LEDs layer it belongs to while deactivating the rest of other LEDs layer cathodes and “anode” columns. Using the same concept, to light up whole LEDs of a particular LEDs layer, just need to activate all 64 “anode” columns and the cathode of that particular LEDs layer. Untill now, it is believed that users have know some basic principles of working of a LED Cube. Well, without any further delay, let’s start the LED Cube tutorial project.
- LED Super Bright 3mm Blue (DS-LED-3SB ) – 512 (advisable to prepare LEDs more than indicated (likes 550) for sparing purpose)
- 74HC164N Shift Register IC ( IC-74HC-164 ) and 14-pin IC Socket – 8 sets
- IC ULN2803 (IC-ULN-2803 ) and 18-pin IC Socket – 1 set
- 34 Ways Right Angle Box Header (CN-IDC-BOX-34RA ) – 2
- 10 Ways Right Angle Box Header (CN-IDC-BOX-10RA ) – 1
- 34 Ways IDC Socket (CN-IDC-34 ) – 2
- 10 Ways IDC Socket (CN-IDC-10 ) – 1
- Terminal Block KAR301-2 Way (CN-TB-KAR-2 ) – 1
- Terminal Block DG128V-02 (Green) (CN-DG128-02 ) – 2
- Straight Female Header 1×40 Ways (CN-PH-F140S ) – 2
- Potentiometer 5kohm – 1
- Resistor 240 0hm – 64
- Donut Board (Fiber) 1mm 10x22cm (BD-DB-FG1-1022 ) – 1
- Rainbow Cable 34 Ways (WR-RM34 )
- Wrapping wire (WR-WM30)
- Multicore wire AWG 26 (WR-MM26)
- Multicore wire AWG 22 (WR-MM22)
- Multicore wire AWG 14 (WR-MM14)
- Cell Battery CR2032 (A-3V-CR2032 ) – 1
- Breakout Board ATX Right Angle (BB-ATXRA ) – 1
- 2.1mm DC Plug with Cable (CN-DCP-WC) – 1
- ATX power supply (480W) with power plug – 1
CN-DCP-WC – 1 ATX power supply (480W) with power plug – 1
- Enhanced 40 pins PIC Start-Up Kit (SK40C) – 1
- PIC16F877A – 1
- USB ICSP PIC Programmer V2010 (UIC00B ) – 1
- Acrylic Sheet (A4) 5mm ( HD-AC-A4-5 ) – 1
- PCB Stand (screw & screw)30mm (SD-SS-30) – 4
- PCB Stand (screw & screw)15mm (SD-SS-15) – 4
- Bolt M3x10mm (HD-PM-M3-10 ) – 8
- Bolt M3x6mm (HD-PM-M3-6 ) – 4
- Steel Wire
- Sand paper
Tools and equipments:
- Crocodile clip cable
- Soldering station
- Solder Lead
- Solder paste (optional)
- Wire stripper
- Wire cutter
- White masking tape
- Pencil and Eraser
- Screw driver
- Electric drill (drill bit 3mm)
**Can refer to Tools and Equipments, Cytron Technologies Website for getting some of the equipments above.
- MPLAB IDE Version 8, the latest can be downloaded from Microchip website. The compiler used is HI-TECH Compiler for PIC 10/12/16 MCUs version 9.82.
- PICKit2 V2.61 , can download here.
- 74HC164N Shift Register IC datasheets, can download here.
- IC ULN2803 datasheets, can download here.
- The schematic and tutorial of Breakout Board ATX Right Angle (BB-ATXRA ), can be downloaded from Cytron Technologies, BB-ATXRA.
- User manual and other related materials of SK40C, can be download from Cytron Technologies, SK40C .
- User manual and other related materials of UIC00B , can be downloaded from Cytron Technologies, UIC00B.
**Users are encouraged to read through all related references stated above before start doing the LED Cube project.
Part I: Create a mold to facilitate soldering process of LEDs to build up the LED Cube
1. The mold is created from a Acrylic Sheet (A4 size, 5mm thick). Its appearance will be similar to picture as shown below.
Figure 3: Mold to facilitate soldering process of LEDs
2. The top and bottom surface of a new acrylic sheet should be covered with thin light brown sheets for protection. Please do not remove these thin brown sheets.
3. By using the blank side of acrylic sheet, starts draw frame lines based on the dimensions as shown below by using pencil and L-shaped ruler.
Figure 4: Drawing frame lines
4. Next, draw vertical lines which are parallel to the reference vertical frame line with the separation distance 2.5cm with each other. There are total 7 of them.
Figure 5: Draw vertical lines parallel to the reference vertical frame line
5. Then, draw horizontal lines which are parallel to the top reference horizontal frame line with the separation distance 2. 5 cm with each other. There are total 6 of them since the 7th horizontal line is already drawn, which is the bottom reference horizontal lines.
Figure 6: Draw horizontal lines parallel to the top reference horizontal line
6. The picture below is the resulted 8×8 grid and yellow dot marked locations are the interception points between horizontal lines and vertical lines, which are also the locations to be drilled for holes to place in LEDs for soldering.
Why the holes for the mold must be drilled with distance 2.5 cm apart? As we can seen from the picture of a Super Bright 3mm Blue LED with its cathode leg bent 90 degree below, the length of cathode measured from its center is 2.6cm.
Figure 8: Super bright 3mm blue LED with its cathode leg bent 90 degree
In soldering a layer of LEDs, all cathodes of LEDs will be connected together, where the cathode leg of a LED will be soldered to the cathode leg of adjacent LED. The separation distance of 2.5cm between holes for provides a 1mm contact point when the LEDs are put into the mold for soldering as shown by picture below:
Figure 9: 1mm contact point between cathode leg of a LED to cathode leg of an adjacent LED
7. It’s time for drilling. Mark the locations to be drilled with the sharp end of a Phillip head screw driver. This action will pilot the electric drill with its drill bit to the locations to be drilled during the drilling process.
Figure 10: Mark the location to be drilled using a Phillip head screw driver
8. The drill bit used is 3mm in diameter, which will produces holes to fit in LEDs nicely. Drill the marked locations slowly without pushing the electric drill to hard because this indiscreet action may break the acrylic sheet.
9. Once all holes have been drilled, the mold is considered done as shown by the Figure 11 below.
Figure 11: The ready mold
Part II: Solder LEDs layers
1. Firstly, check the functionality of all LEDs purchased. This can be done by using a 3v Cell Battery CR2032 by touching a LED anode with its positive terminal and cathode with its negative terminal as shown below.
Figure 12: Checking a LED functionality using 3v Cell Battery CR2032
**The anode leg of LED is longer than its cathode leg
2. To build up a LEDs layer of a 8x8x8 LED Cube, 64 LEDs are needed. Choose 64 LEDs in good condition and bend their cathode leg 90 degree up as shown below.
Figure 13: Bend up LEDs cathode leds 90 degree up
3. The LEDs with their cathode legs bent are ready to be put into the holes of mold for soldering.
4. Let’s start put in the LEDs with their heads into the 1st row of holes of mold as shown below.The bent cathode leg of a LED is aligned to touch the cathode leg of the next adjacent LED. Solder the cathode and cathode contact points.
(a) Contact between cathode of a LED with the (b) Solder the cathode and cathode contact points
next adjacent LED
(c) Row of LEDs with their cathodes connected together
by soldering the cathode and cathode contact points
Figure 14: The connection of cathodes of LEDs inserted into the 1st row holes of the mold
5. Next, let’s puts in LEDs into the 1st column holes start from 2nd row till 8th row in such away the bent cathode leg of a LED is aligned touch the cathode leg of LED of the previous row. Solder the cathode and cathode contact points.
Figure 15: The connection of cathodes of LEDs inserted into the 1st column holes of the mold
6. Repeat the step 5 for 7 times for the remaining columns. The resulted LEDs cathodes connection is shown as below.
(a) Real view LEDs cathodes connection (b) Virtual view LEDs cathodes connection
Figure 16: The resulted LEDs cathodes connection
7. Although all cathodes of LEDs in this LED layer are connected, the whole thing still looks very flimsy (or lack of solidity). So, two braces (steel wires) will be added to support the LED layer. One is added to middle space between 4th and 5th LEDs row and another one is added to space between 7th and 8th LEDs row but situated more close to 8th LEDs row as indicated.
Figure 17: The space where the braces will be added to support the LEDs layer
8. Cut out 2 steel wire with length of 18cm. Clean the stains and thin oxide layer of of these wire using sand paper.
**The dimension of cut wire is 18cm since distance between 1st vertical grid line and the 8th vertical grid line is 17.5cm. Hence, there will be an extra 0.5 cm for sparing.
**The stains and thin oxide layer of the steel wire will cause problems in the process of soldering it onto the LEDs layer. Hence, the steel wire should be clean with sand paper first.
9. Then, straighten the cleaned steel wire by gripping firmly its each end with a pliers and then pull hard with force. Surprisingly, the steel wire becomes straight as shown below.
a) The steel wires before straightened b) The steel wires after straightened
Figure 18: The state of steel wires before an after straightened by using a pair of pliers
10. The cut wires are ready to be used as braces. Place in the 1st brace into space between 7th and 8th LEDs rows and fix its position using white masking tap.Start solder 2 contact points between the brace ends and cathodes leg of 8th LEDs row. Then, solder the remaining 6 contact points.
a) Fixing the position of the brace using masking tap b) Contact points between cathode legs
and the brace
c) Solder all contact points between cathode legs and
Figure 19: Process of inserting a brace to LEDs layer
11. Repeat the step 10 to insert another brace to the space between the 4th and 5th LEDs rows.The resulted LEDs layer with braces is shown below.
12. The LEDs layer is considered done here. Somehow, it must be tested before it be taken from the mold. One end of a crocodile clip cable is clipped to the sticking out cathode leg at the top right corner of the LEDs layer while the other end is clipped to one end of a resistor 240 0hm. Change your multimeter into the continuity checking mode. Touch the negative probe to another end of the resistor 240 ohm and tap the positive probe to each anode leg of LEDs of the LEDs layer. The LED with its anode tapped by positive probe will light up if the connection correct and the condition of that LED is good.
**The LED does not light up when its anode leg tapped with the positive probe of multimeter during testing may due to the following reason:
a) The soldering is not proper that cathode of a particular LED is not connected with other LEDs cathodes.
b) The LED may be broken due to overheating since soldering close to head of a LED may damage the electronic inside.
13. If everything is checked and the LEDs layer is working fine with each of its LEDs lights up during testing, it is ready to be taken out from the mold.
**Please do not cut off the sticking out cathode leg as it also will be used for testing during process of stacking up LEDs layers to form the LED Cube.
Figure 22: The appearance of the LEDs layer taken out from the mold
14. Repeat steps above to solder other 7 LEDs layer.
Part III: Stacking up the LEDs layers to form the LED Cube
1. Before starts to stack up the LEDs layers, please straighten each LED anode leg in a LEDs layer for 8 available LEDs layers.
2. Then, insert the 1st LEDs layer into the mold as orientation shown below. The sticking out cathode leg is at the top right corner.
3. Try to place 2nd LEDs layer in the same orientation on the top of the 1st LEDs layer with the help of triangle supports (made from card) as shown below. The triangle supports are made to provide separation distance about 2.5 cm height between LEDs layers to be stacked up. Over separation distance may cause the anode legs of lower LEDs layer not able to be soldered to that of upper LEDs layer.
(a) Place in the triangle suports (b) The triangle supports provide separation
distance about 2.5cm height
Figure 25: Placing 2nd LEDs layer on the top of 1st LEDs layer
4. As seen in Figure 25 (b), it seems it is hard to solder the anode leg of a LED in lower LEDs layer to that of the LED just right above if the anode leg remains totally straight. Hence, it is recommended to bend small section of all anode legs of LEDs in the lower LEDs layer.
(a) Bending small section of the anode leg of (b) Bend small section of all anode legs of
a LED in the lower LEDs layer facilitates LEDs in the lower LEDs layer
soldering to anode leg of LED above
Figure 26: Bend small section of all anode legs of LEDs in the lower LEDs layer
5. Then, solder each bended anode leg of LED in the lower LEDs layer to anode leg of each LED right above in the upper layer LED layers. Start the soldering along the sides of the LEDs layer. Try to move around the triangle supports during the soldering process to ensure 2.5 cm separation distance between lower LEDs layer and upper LEDs layer thorough the structure.
(a) Solder each bended anode leg of LED in the lower (b) Move around the triangle support during
layer to each anode leg of LED right above the soldering process
Figure 27: Soldering anode legs of LEDs in the lower LEDs layer to that of LEDs in the upper layer
6. As all the solder joints (anode to anode) have been soldered, it’s time to test the stacked LEDs layers. Firstly, check the upper LEDs layer by following the step 12 in the previous PART II since soldering close to head of LED in the upper LEDs layer may damage the LED.
7. Then, check the connection of anodes of LEDs between layers. Different from step 12 in the previous PART II, the sticking out cathode leg of lower LEDs layer is clipped with crocodile clip while each of anode leg of LED in upper LEDs layer is tapped with positive probe of multimeter. As a LED anode leg is tapped, the LED situated right below it in the lower layer will light up and this means the connection of anode between the 2 LEDs is good.
Figure 28: Checking connection of anodes of LEDs between layers
8. If everything is checked and the LEDs layer is working fine with each of its LEDs lights up during testing, proceed with stacking up 3th, 4th, 5th, 7th, and finally 8th LEDs layer by repeat steps above.
9. The structure of complete stacked LEDs layers is shown below. It has the shape of a cube. The LED Cube is considered done here.
(a) Front view (b) Top view
(c) Side view
Figure 29: The structure of complete stacked LEDs layers
10. Then, remove the LED cube from the mold.Now, the mold will be modified into a base for placing resulted LED Cube and microcontroller circuit board to be build.
Part IV: Modify the mold into a base for placing LED Cube and microcontroller circuit to be build
1. The current appearance of the acrylic sheet is shown below. In this stage, these holes will be used to mount the LED Cube later.
2. Draw a 1cm x 1cm square box at each corner of the acrylic sheet as below. The interception point between lines connect pair of opposite corners will be drilled for hole installed PCB stands to stack up the base.
Figure 31: Draw 1cm x 1cm square box at each corner of the acrylic sheet
3. Draw a straight vertical line 1cm to the left of the 8th grid line. Then, add in short horizontal lines at a distance 1cm after each horizontal grid line (except for 8th horizontal grid line). Also, add in another short horizontal line 1cm after the short horizontal line which situated at a distance 1cm from the 7th horizontal grid line. The interception points formed between these short horizontal lines and the straight vertical line (1cm to the left of 8th grid line) will be drilled for holes to pass through the cathode risers (formed by steel wire connected to cathode of specific LEDs layer).
4. Drill the marked points in step 2 and step 3 using drill bit 3mm. The resulted acrylic sheet is shown below.
5. Next, it is a need to drill holes for fitting in the microcontroller circuit (still have not created in this part). The donut board used has the dimension of 10cm in width and 22 cm in length as shown below.
6. Please align the donut board with one of its length side parallel to the left width side of the acrylic sheet as indicated. Try to centralize the position of the donut board and it seems there is an extra 0.5 cm at each end since the width side of the acrylic sheet is only 21cm (compare to length side of donut board : 22cm). The positions of pre-drilled holes at the corners of the donut board are also do not fit the dimension.
7. Hence, there is a need to drill holes on both donut board and acrylic sheet to fit in the microcontroller circuit board. After some considerations (including the position of holes at the corners of the acrylic sheet), drill holes on the donut board at positions indicated by red points below slowly using 3mm drill bit.
8. Place the drilled donut board on the acrylic sheet again in the orientation same in step 6. Mark the points to be drilled for holes on the acrylic sheet through the new drilled holes of the donut board using pencil or marker pen. Then, drill holes at the marked points using drill bit 3mm.
9. The base for mounting LED Cube and placing microcontroller circuit is considered done here.
**Summary about the holes on the base:
- Holes surrounded by red box are used for mounting LED Cube.
- Holes surrounded by yellow box are used for cathode risers to pass through.
- Holes surrounded by green box are used for fitting in microcontroller circuit board.
- Holes surrounded by blue box are used for installing PCB stands to stack up the base.
Part IV: Mount the LED Cube onto the base and install cathode risers to the cube
1. Stack up the resulted base by installing PCB stands to each hole (marked by blue box in Figure 29) at each corner of the base. The type of PCB stands used is screw & screw, 30mm in length and the type of bolts used is M3 in size and 10mm in length.
2. Mount the LED Cube with its each anode leg into each respective hole of the mounting area in the orientation seen from top as below. Notice the direction of the sticking out cathode legs of each LEDs layer.
**Mounting LED Cube as above orientation will prevent braces of the most bottom LEDs layer blocking holes for cathode risers to pass through. Mounting LED Cube is not easy as we think. User may need to use to tool like pen to adjust anode legs into their respective mounting holes. Try to start with anode legs at one side of the LED Cube.
3. After the LED Cube is successfully mounted, cut off the sticking out cathode legs and fixing the position of LED Cube at the part of the most bottom LEDs layer using masking tape so as to prevent the LED Cube anode legs drop out from the base as the base lift up.
4. Lift up the base 90 degree up with the bottom view with the part of 2 holes for cathode risers to pass through separate 1cm from each other at the position indicated as shown in Figure 42 facing you.
5. Cut each anode leg into length about 1cm and bend each of them in the direction as shown below.
Figure 43: Cut and bend anode legs of LED Cube
6. Next, it’s time to install cathode risers to the LED Cube. A cathode riser is made from a straight wire that will be connected to cathode of a particular LEDs layer. Let’s start with the 1st LEDs layer.
7. Cut the required length of steel wire. Clean it with sand paper and straighten it with a pair of pliers as previous part.
8. Bend one end of the steel wire 90 degree. Solder it to the cathode of the 1st LEDs layer. Let the other end pass through the 1st hole of hole on the base specialized for cathode risers to pass through. Then, bend the other end of the steel wire from the bottom of the base in the direction indicated in Figure 44 below.
9. Construct other cathode risers for 2nd, 3rd, 4th, 5th, 6th, 7th and 8th LEDs layers. Please make sure the cathode riser for a particular layer does not touch cathodes of the other LEDs layers.
10. The resulted LED Cube installed with cathode risers is shown in the following pictures.
Part IV: Solder wire to cathode risers and anode legs of the LED Cube
1. The wire used in this part is 34-ways rainbow cable. Let’s start with soldering wires to cathode risers of the LED Cube by following few steps below:
a) Cut out a 10 ways rainbow cable about 25cm from the 34 ways one. Separate part of the first 8 wires and left the last 2 wires remained sticked since they will not be used.
b) Strip the ends of the separated 8 wires and solder them sequentially to the cathode risers with
- Green wire to 1st cathode riser
- Blue wire to 2nd cathode riser
- Purple wire to 3rd cathode riser
And finally, Red wire to 8th cathode riser as shown in Figure 48 below.
c) Cut off the extra part of the unused wires (indicated in a ) and cover them with masking tape.
**Users must asking why have to cut out 10 ways rainbow cable since there is only 8 of them are connected to cathode risers while leaving 2 wires unused. This is because the other end of the cut out 10 ways rainbow cable will be installed with an IDC socket. While the IDC socket and box header types available are 6 ways, 10 ways, 14 ways, 16 ways, 20 ways and so on. The 8 ways type is not available. Instead, we use the 10 ways IDC socket.
2. After the required wires are finished soldered to cathode risers of LED Cube, next, install a 10 ways IDC socket to another of the 10 ways rainbow cable by following few steps below:
a) Place in the 10 ways rainbow cable end to the cable slot of IDC socket as shown.
b) Fit in the cable into the IDC socket firmly by tightening the IDC socket using G-clamp.
c) Install the IDC socket clip to IDC socket as illustrated below:
d) IDC socket slots numbering and connection of wires of the 10 ways cable to the slots
As seen from the picture above, the connections from cathode risers to IDC socket are:
- 8th cathode riser to IDC slot 10
- 7th cathode riser to IDC slot 9
- 6th cathode riser to IDC slot 8
- 1st cathode riser to IDC socket slot 3
- Unused wires to socket slot 1 and slot 2
3. Next, soldering wires to each column of anode legs of the LED Cube by following few steps below:
a) Let’s do the numbering on the anodes of the LED Cube as shown in Figure 55.
b) Cut out a 32cm 34 ways rainbow cable and divide one end of it in the way as shown below.
Figure 56: Cable divisions and assignments at one end of the 34 ways rainbow cable
- Wires of 8 ways cable (1) will be soldered to 1st – 8th anode legs in column 1 sequentially.
- Wires of 8 ways cable (2) will be soldered to 1st – 8th anode legs in column 2 sequentially.
- Wires of 8 ways cable (3) will be soldered to 1st – 8th anode legs in column 3 sequentially.
- Wires of 8 ways cable (4) will be soldered to 1st – 8th anode legs in column 4 sequentially.
- Wires of 2 ways cable are unused.
c) Strip and solder each wire to each anode leg of the LED Cube as assigned above. The resulted wire connections to anode legs of column 1, 2, 3, and 4 viewed from bottom of the base are shown in the Figure 49 below.
**Users must asking why have to cut out 34 ways rainbow cable since there is only 32 of them are connected to anode legs of Column 1, 2, 3, and 4 while leaving 2 wires unused. This is because the other end of the cut out 34 ways rainbow cable will be installed with an IDC socket. While the IDC socket and box header types available are 6 ways, 10 ways, 14 ways, 16 ways, 20 ways, 24 ways, 28ways, 34ways and so on. The 32 ways type is not available. Instead, we use the 34 ways IDC socket.
4. Next, install a 34 ways IDC socket to another of the 34 ways rainbow cable by following few steps below:
a) Place in the 34 ways rainbow cable end to the cable slot of IDC socket as shown.
b) Fit in the cable into the IDC socket firmly by tightening the IDC socket using G-clamp.
c) Install the IDC socket clip to IDC socket as illustrated below.
d) IDC socket slots numbering and connection of wires of the 34 ways cable to the slots
As seen from the picture above, the connections from anode legs of (Column 1, 2, 3, and 4) of LED Cube to IDC socket are:
- (1st – 8th) anodes of Column 1 to (34th – 27th) socket slot of IDC socket
- (1st – 8th) anodes of Column 2 to (26th – 19th) socket slot of IDC socket
- (1st – 8th) anodes of Column 3 to (18th – 11th) socket slot of IDC socket
- (1st – 8th) anodes of Column 4 to (10th – 3rd) socket slot of IDC socket
- Unused wires to socket slot 1 and slot 2
5. Repeat the steps 3-4 by using a new cut out 43cm rainbow cable for the wire connections to anode legs of remaining Column 5, 6, 7, and 8 of the LED Cube. The resulted wire connections to anode legs of column 4, 5, 6, and 7 viewed from bottom of the base are shown in the Figure 63 below. The IDC socket slots numbering and connection of wires of the 34 ways cable to the slots are also described in Figure 64.
As seen from the picture above, the connections from anode legs of (Column 4, 5, 6, and 7) of LED Cube to IDC socket are:
- (1st – 8th) anodes of Column 4 to (34th – 27th) socket slot of IDC socket
- (1st – 8th) anodes of Column 5 to (26th – 19th) socket slot of IDC socket
- (1st – 8th) anodes of Column 6 to (18th – 11th) socket slot of IDC socket
- (1st – 8th) anodes of Column 7 to (10th – 3rd) socket slot of IDC socket
- Unused wires to socket slot 1 and slot 2
6. All three rainbow cable (two 34 ways rainbow cable and one 10 ways rainbow cable, which are connected to anodes and cathode risers of the LED Cube) with IDC socket installed are shown below.
7. Part IV is considered done here. The schematic of the connections in this part is shown below.
**Please click the image to enlarge it for better looking
Figure 66: Schematic of connections done in part IV
Part V: Build up the microcontroller circuit board
1. The microcontroller module used is the SK40C with PIC16F877A. This microcontroller module will work with other ICs like 74HC164N 8-bits shift register IC and ULN2803 8-channels Darlington-pair transistors IC to control lighting of the LED Cube.
**To control lighting of the LED Cube, the minimum number of I/O pins required is 72 (64 pins for 64 anodes and 8 pins for 8 cathodes of 8 LED layers), somehow, the PIC16F877A has only 33 general purpose I/O pins which is insufficient. Hence, 74HC164N IC is used to expand the I/O pins of PIC16F877A indirectly.
One 74HC164N IC is able to provide 8 outputs, surprisingly controlled by only two I/O pins of PIC16f877A. One of the two I/O pin is used to provide clock pulses to shift data at serial input to outputs of the 74HC164N IC while the other one I/O pin is used to provide data at serial input to be shifted to outputs of the 74HC164N. This indirectly expands 2 I/O pins of PIC16F877A to 8 output pins.
To provide 64 outputs to control 64 anodes of the LED Cube, correspondingly eight 74HC164N ICs are required. Somehow, to control eight 74HC164N ICs, only 9 I/O pins of 16F877A are required (but not 16 I/O pins) since only one I/O pin is used to provide common clock pulses to all IC. The example of connection to control eight 74HC164N ICs using 9 I/O pins of a microcontroller is shown in Figure 67 below.
While, as mention in the “Introduction” section at the starting of this article, to control activations of cathodes of LEDs layer of the LED Cube, 8 transistors are required. Hence, ULN2803 IC is suitable to be used here since it contains 8 Darlington-pair transistors ready for use for cathodes activation of the LEDs layers. The example of the connection of ULN2803 IC to control activations of cathodes of 8 LEDs layers of the LED Cube is show in Figure 68.
Figure 67: The example of connection to control eight 74HC164N ICs using 9 I/O pins of a microcontroller
2. Next, it’s time to place in the components to be soldered to the donut board. Firstly, please step up the donut board by installing PCB stands through the holes drilled previously for the purpose of fitting the completed microcontroller board to the base. The type of PCB stands used is screw & screw, 15mm in length and the type of bolts used is M3 in size and 6mm in length.
3. The schematic of the microcontroller circuit board is shown in Figure70 and Figure 71.
**Please click the image to enlarge it for better looking
Figure 70: Microcontroller circuit schematic part 1
**Please click the image to enlarge it for better looking
Figure 71: Microcontroller circuit schematic part 2
**As seen in the “Note” section of schematics provided, the VDD of SK4oC is not connected to VCCs of shift registers to provide 5V supply. Instead, their VCCs are connected to an external 5V supply. The 5V supply required for shift registers has to be able to provide enough maximum amount of current to power up the ICs and light up 64 LEDs at the same time. Somehow, the maximum current provided by the regulated 5V of SK40C is not enough.
**The resistors array connected to outputs of ULN 2803 IC is pulled up with the external 5V supply (the same external 5V supply connected to VCC of shift register) to hinder the light-up of any LED at any LED layer effectively when cathodes of LEDs layer are not activated to short to ground by the ULN2803 IC.
4. Based on the schematic, the electronic components, sockets and connectors to be soldered on the donut board consist of:
- Straight pin header(Female) 1×21 ways (cut out from Straight pin header(Female) 1×40 ways) – 1
- Straight pin header(Female) 1×20 ways (cut out from Straight pin header(Female) 1×40 ways) – 1
- Box header (10 ways) – 1
- Box header (34 ways) – 2
- Resistance array (consists of eight 4.7k ohm resistors) – 1
- IC socket (18-pin) for ULN 2803 IC – 1
- Potentiometer 5k ohm – 1
- IC socket (14-pin) for 74HC164N IC – 8
- Resistor 240 ohm – 64
- Capacitor 0.1uF – 8
- Terminal block (2 ways) – 1
5. Please try to arrange electronic components, sockets and connectors stated above in the recommended orientations and positions as shown in the following diagrams (Figure 72,73,74,75 and 76) (especially the position of the box headers close to side of the donut board since the completed microcontroller board will be placed on the base in the way shown in Figure 77 that facilitates the connections of IDC sockets to their respective box headers).
Figure 73: Arrangement of resistors and capacitor around the each IC socket (14-pins) for 74HC164N IC and pin numbering of terminal block (2 ways)
**8 resistors (240 ohm) are placed with each of them at each output of a 74HC164N IC that conforms to pins diagram of the datasheet.
The value of resistor (240 ohm) is chosen under consideration of the DC VCC/GND current rating of 74HC164N IC, which is 75mA in max. The voltage across the 3mm blue LED when it is on is about 3.0-3.4V. Let’s assume the voltage across the LED is 3V and the logic high output of 74HC164N is 5V. Then, the current flows through a LED is equal to ((5-3)/240), which is 8.33mA. A 74HC164N IC will handle 8 LEDs, then the maximum DC VCC/GND current reached is equal to (8×8.33mA), which is 66.67 mA < 75 mA, so the resistors with value of 240 ohm is suitable to be used.
**A capacitor 0.1uF is also placed close to the socket as it will be used to smoothen the 5V supply to each 74HC164N IC.
Figure 75: The position of the 1st pin of box headers
Figure 77: How the microntroller circuit board will be placed on the base as it is completed
6. Next, do the numbering of IC sockets for shift registers. The IC sockets are numbered as shown in Figure 69 in this case where the outputs after resistors of shift register 1,2,3 and 4 will be soldered to Box Header 1 (32 ways) and the outputs after resistors of shift register 5,6,7 and 8 will be soldered to Box Header 2 (34 ways) based on the schematics provided above.
7. Next, solder all stated components on the donut board based on the schematics shown in Figure 70 and Figure 71.
**Please do not plugin SK40C, ULN2803 IC and 74HC16N ICs first to the header (Female) or sockets on the donut board. They may be damaged during soldering process due to overheating.
**The components can be prevented from dropping out as the donut board is turned around for soldering by using masking tape to fix their positions firmly.
**During soldering, jumpers may be inevitable. In this case, guides to use wires with suitable sizes as jumpers for different purpose are shown below:
a) Jumper for power lines VCC , VDD, GND and VSS ——> Multicore wire AWG 22 (WR-MM22), 0.64mm
b) Jumper for outputs of ULN 2803 to pins of Box Header (10 ways) ——> Multicore wire AWG 22 (WR-MM22), 0.64mm
c) Jumper for outputs of shift registers to pins of Box Header 1 or 2 (34 ways) ——> Multicore wire AWG 26 (WR-MM26), 0.4mm
d) Jumper for signal lines (for eg. from RA1 of SK40C to clock pins of shift register) ——> Wrapping wire (WR-WM30), 0.25mm
**This means the size of wire used as jumper is proportional to the amount of current to be handled.
8. After the soldering process is completed, check the resulted circuit connections to make sure all connections are done accordingly to schematics provided by using multimeter for the continuity test.
**Ensure the VCC/VDD and VSS/GND are not shorted.
**Ensure the VDD of SK40C is not connected to VCC of shift register as mention in the “Note” section of the schematics.
**Ensure connections of I/O pins of SK40C to ULN 2803 IC, 74HC164N ICs and potentiometer 5k ohm are done accordingly.
**Plug in each IDC socket to each Box Header accordingly:
- IDC socket (10 ways) to Box Header (10 ways)
- IDC socket 1 (34 ways) to Box Header 1 (34 ways)
- IDC socket 2 (34 ways) to Box Header 2 (34 ways)
For IDC socket (10 ways) and Box Header (10 ways) set, check and make sure that each output of the ULN2803 IC are connected to each cathode of LEDs layers accordingly. This can be done by touching one probe of the multimeter at outputs of the ULN2803 and another probe to cathodes of LEDs layers for continuity test.
For IDC socket 1 (34 ways) and Box Header 1 (34 ways) set, check and make sure that each output after resistor of shift register 1,2,3 and 4 are connected accordingly to each anode (Column 1, 2, 3 and 4) of the LED Cube. This can be done by touching one probe of the multimeter at outputs after resistors of shift registers and another probe to anodes (Column 1, 2, 3 and 4) of LED Cube for continuity test.
For IDC socket 2 (34 ways) and Box Header 2 (34 ways) set, check and make sure that each output after resistor of shift register 5,6,7 and 8 are connected accordingly to each anode (Column 5, 6, 7 and 8 ) of the LED Cube. This can be done by touching one probe of the multimeter at outputs after resistors of shift registers and another probe to anodes (Column 5, 6, 7 and 8 ) of LED Cube for continuity test.
9. If everything is checked and all connections are correct, the microcontroller circuit board is considered done here. Please do not plugin SK40C, ULN 2803 IC and 74HC164N ICs first to the resulted microcontroller circuit board as it will be tested again when it is provided with DC power supply.
Part V: Build up DC power supply of the microcontroller circuit board and complete the hardware part of the LED Cube
1. The DC power supply used is the standard PC ATX power supply unit (PSU) as it is able to provide different level DC voltages (3.3V, 5V, 12V and even -12V). So, the DC 12V supply from ATX PSU can be extended to connect to SK40C (for power up purpose) and the 5V supply from ATX PSU can be extended to connect to 74HC164N ICs (for power up and providing current for lighting up LEDs purposes) on the microcontroller circuit board. To extend out voltages supply from the ATX PSU to be used by the microcontroller circuit board, the Breakout Board ATX Right Angle (BB-ATXRA), a product of Cytron Technologies can be used for this purpose. The close overview of the BB-ATXRA is shown in Figure 79 below.
**As mentioned in the previous section, the regulated 5V of SK40C is not able provide enough maximum amount of current to power up the 74HC164N ICs and light up 64 LEDs at the same time. Hence, external 5V supply is required.
2. Please follow the few steps below to extend out 5V and 12V from ATX PSU using BB-ATXRA.
a) Firstly, combine 2 Terminal Block DG128V(Green-2 ways) to form a 4 ways terminal block.
Figure 80: A 4 ways terminal block resulted from two ways terminal block
b) Solder the resulted 4 ways terminal block to BB-ATXRA in the orientation shown in figure below.
Figure 81: 4 ways terminal block soldered on the BB-ATXRA
c) The 12V supply extended by BB-ATXRA will be connected to SK40C through its adapter socket. Hence, a 2.1mm DC Plug with Cable (CN-DCP-WC) is needed. While the 5V supply extended by BB-AXTRA will connected to microcontoller circuit board through the blue 2 ways terminal block. Hence, wires are only needed. The type of wire recommended to used is Multicore wire AWG 14 (WR-MM14).
Figure 83: 2 cut out Multicore wire AWG 14 (WR-MM14) (1 Black and 1 Red) for 5V supply from BB-ATXRA to microcontroller board
d) Connect one end of the black multicore wire AWG 14 to GND out of BB-ATXRA and one end of the red multicore wire AWG 14 to 5V out of BB-ATXRA. While, connect the negative wire (Black) of 2.1mm DC plug to GND out of BB-ATXRA and positive wire (Red) of 2.1mm DC plug to 12V out of BB-ATXRA. This can be done by screw in firmly related wires ends to their respective slots of 4-ways terminal block. The resulted connections are shown in figure below.
e) With the toggle switch of BB-ATXRA at the “off” position, please plugin the ATX connector (Male) of PSU to ATX connector (Female) of the BB-ATXRA. Turn on the plug of the PSU and the “StandBy” indicator of BB-ATXRA will light up as shown below. This means the PSU still in standby mode but not turn on yet.
**Switching the position of toggle switch to “on” will on the PSU. The power indicator of BB-ATXRA will light up as the PSU is turned on. Somehow, please do not turn on the PSU in this stage first.
3. As promised before, the microcontroller circuit has to be tested with DC power supply connected before plugin SK40C, ULN2803 IC and 74HC164N ICs. Connect the 5V supply from BB-ATXRA to 2 ways terminal block (Blue) of the microcontroller circuit board as shown in Figure 86.
Figure 86: Connection of 5V supply from BB-ATXRA to microcontroller circuit board
4. Turn on the PSU through swicthing “on” the toggle switch of the BB-ATX. Check voltage values of the related parts of microcontroller circuit that are connected to pin 1 of the 2 ways terminal block (Blue) with reference to GND from BB-ATXRA using multimeter. The value of the voltage read should be around 5V.
5. If everything is checked and the connections are correct, turn off the PSU through switching “off” toggle switch of BB-ATX and turn off the plug of the PSU for safety purpose. Plugin SK40C (attached with PIC 16F877A), ULN 2803 IC and 74HC 164N ICs to their respective header (Female) and sockets in correct orientation. Plugin the 2.1mm socket DC plug from BB-ATX to adapter socket of the SK40C.
6. Place and attach the microcontroller circuit board to the base of the LED Cube using bolts with M3 in size and 10mm in length through the holes drilled previously for this purpose. Plugin the IDC sockets to their respective box headers accordingly.
7. Then, tape all three rainbow cables of three IDC sockets together using binding tape at the bottom of the base for tidiness.
8. The LED Cube with the microcontroller circuit board and DC power supply installed is shown in Figure 90 below. The hardware part of the LED Cube project is considered done here. The thing only left is the program to be loaded to PIC16F877A to control the lighting of the LED Cube.
Figure 90: The completed hardware part of the LED Cube
Part VI: Loading program into PIC16F877A of SK40C for the lighting effect of the LED Cube
1. This tutorial is provided with a sample program for lighting effect of the resulted LED Cube and it can be downloaded through the “Attachments” section at the bottom of this article.
2. Without turn on the PSU first, load the sample program hex file into PIC16F877A plugged in the SK40C using UIC00B programmer.
3. Plug the PSU to AC supply and then turn on the PSU by switching “on” the toggle switch of the BB-ATXRA. Then, switch on the SK40C by switching “on” its toggle switch. According to the program loaded into PIC16F877A, all LEDs of the LED Cube will light up initially.
4. Then, user can start choose lighting mode (but not execute) by pressing the button SW1 of SK40C. There is total of 7 lighting modes available and they are named as mode A (the 1st mode), mode B, mode C, mode D, mode E, mode F, and mode G. When a particular mode is chosen, the alphabet of the mode will be shown at the top of the LED Cube. For example, if mode A is chosen, the alphabet ‘A’ will be shown at the top of the LED Cube. Please refer to the sample program for the descriptions on the available modes.
5. Next, after the desired mode is chosen, user can execute the mode by pressing the button SW2 of the SK40C.
6. If user like to choose another mode, please press the Reset button of the SK40C and then choose the new mode to execute same as previous step.
7. A short video that illustrating on how to choose and execute particular lighting of the LED Cube is provided below.
**Please refer to the video at the starting of this tutorial for available lighting modes of the LED Cube.
Untill here, the LED Cube project is considered completed here. Have fun with the resulted LED Cube and try to program the microcontroller with other interesting lighting effects. That’s all from me. See ya!