3x3x3 LED Cube

From SpiderProjects

Jump to: navigation, search


The Story

I've seen a bunch of these across the net and thought I'd try making one myself. I'll be using a method similar to that of this Instructables tutorial to build it, but with a 3x3x3 cube since my PIC16F84 only has 13 IO pins. There's also an awesometutorial on building a 3x3x3 cube using a PIC16F690. I've converted this to work with the PIC16F84A. That cut out a lot of work that I would otherwise have had to do from scratch.


Thanks to portreathbeach, chr, vladutz2000, and all the people over at Instructables.com for organizing the information that makes projects like these a lot easier to take on.

3x3x3 LED Cube


3x3x3 LED Cube Schematic

This schematic is based on the one by portreathbeach at Instructables. I'm using a 5K resistor from the oscillator input to 5V. I honestly am not sure what frequency that sets the PIC clock at and I don't have an oscilloscope to check it with. I built the circuit on perfboard, but drew up a PCB using the free program, ExpressPCB, to make wiring a little easier.

3x3x3 LED Cube PCB

I started by building the LED Cube. I made a template for the layers by drawing lines 1.5cm apart since my LED cathode(GND) leads were 1.5cm long. Then I drilled holes just big enough for the LEDs to squeeze in.

3x3 LED Layer Template

Following the 4x4x4 LED cube tutorial I built each layer and used 24 gauge steel wire from Ace Hardware to strengthen each layer before removing it from the template. Once all 3 layers were built I just stacked them by placing the prettiest one back in the template and using a set of helping hands to hold the second layer in place while soldering and repeating for the final layer. To make this easier I pre-bent the leads to each layer before beginning to solder and soldered the corners first. Be sure to solder in short bursts so as not to damage the LEDs since the connections are made so close to the LED itself.

LED Cube

With the cube complete I carefully placed it into a piece of perfboard and marked the holes in order to make a template for the project box that will hold all of my circuitry.

3x3 LED Layer Template

I transferred this template to the lid of the project box and drilled holes just large enough for the LED leads to fit. For this I used a #60 drill bit that I also got from Ace Hardware. I drilled the holes as far to one side as I could to avoid the 9V battery as much as possible.

3x3 LED Layer Template

With the LED Cube placed on the lid I drilled 3 more holes for the ground connection to each layer and soldered 3 pieces of the 22 gauge wire to each layer ground.

3x3 LED Layer Template

To connect the LED cube to the controller circuit I used some extra IDE ribbon cable I had. It takes some time to get used to working with ribbon cable like this, but it keeps things organized and saves space. I connected one end directly to the LEDs and layer grounds and the other end to 2 rows of header pins. When doing this you have to carefully check each pin to make sure that everything is only connected where it's suppose to be and nothing is accidentally bridged. Otherwise you could damage your circuit or controller.

Ribbon Cable Connected to LEDs & Grounds Ribbon Cable Connected to Header Pins

Since I used header pins as the connector to the LEDs I was able to use a cut IDE cable as connector to the control circuit. I used a dremel with a cutoff wheel to cut the IDE connector down to size.

IDE Connector Cut to Size

I placed the control circuit and battery in a 1"x2"x3" project box from Radioshack with a power switch added to the side. The power switch is held in place with a couple dabs of hot glue on the inside of the box.

Control Circuit and 9V Battery Inside the Project Box

All that's left is to plug the header pins into the connector and carefully close the box up. You'll want to test everything out before closing the box up to prevent the need to re-open it and troubleshoot.

Finished LED Cube

PIC Code and Programming

The tutorial on building a 3x3x3 cube using a PIC16F690, by portreathbeach at Instructables was a real time saver here. I was able to modify his assembly code to work on a PIC16F84A microcontroller. I wanted to use this chip because I have a few sitting around that I got as samples from Microchip for another project and never ended up using. The other reason for using this chip is that it's really easy to build a cheap serial pic programmer for it.


Base Assembly for PIC16F84

Here is the base assembly code I used for the PIC16F84. Simply add the effect subroutines that you want to the end of this block and call them in the main LOOP.



Here is some assembly code for premade effects. Just copy any effects that you want from here, paste them at the end of the base assembly file, and call them from the main LOOP.


Effect Generator

Portreathbeach also included this awesome application that makes it incredibly easy to generate new effects. It outputs an assembly file to your desktop containing the effect that you generate. Simply copy it into the base program just like the prebuilt effects.

Effect Generator by Portreathbeach

LED Cube pattern generator.exe


To program and compile the assembly into hex I used MPLAB IDE. It's free and fairly easy to use.

Then I used WinPic Programmer to program my PIC16F84 using the Cheap PIC Programmer I built.

Personal tools