Introduction: 3x3x3 LED Cube


Here is my 3x3x3 LED Cube project. It runs using a PIC16F690. Along with the brief explanation of how to make it, I have also included the .asm file for the PIC and a piece of software written in VB.NET that you can create your own LED patterns. These can be exported as .asm files and put into the main .asm code.


Step 1: Building



Each layer of 9 LEDS are connected with all of the cathodes together. The cube is multiplexed, meaning that only one layer is on at any one time. It happens so quickly that the whole cube looks like it is illuminated. RB5, RB6 and RB7 controll which layer is being illuminated.

From the picture you can see the connections to the top layer. I have only connected RC2 to show you how the connection should be made, the rest of the LEDs are connected the same way.


The easiest way to connect the LEDs together is to drill 9 holes into a piece of wood (picture 2), then place the LEDs into the holes, bend the legs and solder the cathodes together. After 3 of these are created, simple stack them and solder the anodes together. You should end up with 9 anodes and 3 common cathodes to connect to you circuit.


All you need to build this cube is:

1 x 5v regulator
1 x switch
1 x PIC16F690
3 x NPN tansistors
3 x 330 ohm resistros
9 x 220 ohm resistors
1 x 220uF capacitor
27 x LEDs

oh, and MPLab PIC programming software. (Other software may work, but my .asm file may have to be changed a little)

Step 2: The Software



Now that you have an idea of how to build the cube, here is the software that you can use to generate the LED cube patterns.

Along with the software is the .asm file, in this file, there are already some patterns loaded in and it is pretty straight forward to see how to insert your own patterns.

The second picture shows you how the software saves the binary info for the patterns.

Layer 1, Layer 2, Layer 3 and Layer 4 are 4 registers used in the PIC. Obviously Layers 1,2 and 3 represent the top, middle and bottom layers, but they are only 8 bits, so another register is used Layer 4, which holds the 9th LEDs data for the 3 layers and the brightness and time the LEDs need to be on.

Hope this is a good enough explanation of the project. It's not too hard to build, just takes a bit of time to arrange the LEDs.

I have also added a zip file with the source VB code as someone asked for it!

Comments

author
jwzumwalt (author)2017-07-11

Your Code.rar file actually downloads as a *.tmp file and looks like an incomplete download. I suggest you get the file name corrected to .rar

author
SokHaN1 (author)2015-10-26

I need code cube 3x3 can u help me .need all code

author
J.W.N.R. (author)2015-01-02

author
Qsonic2014 (author)2014-03-22

Merci jimy268, je vais commencer avec le test des led. j'espère réussir.

Jimy268 thank you, I'll start with the test LED. I hope to succeed.

Kyno Québec (canada)

author
hkerr (author)2013-12-01

can you please post a pic of bottom and top of the circuit

author
dark clerick (author)2009-08-19

hey how do you plug it in the computer? like do you use a usb or some sort of wire or what? also what powers it?

author

could somone post a better picture of how to wire it?

author
hkerr (author)dark clerick2013-12-01

agreed

author
Gasburner (author)dark clerick2009-08-20

through the serial port on your computer i imagine, with a PIC, on the pic circuitboard there will be what looks like a headphone jack. When you acquire a serial lead, it will have a stereo 3.5mm jack on one end, and a plug with two layers of holes on the other. plug one end into the PIC board, and one into your computer, assuming you have a serial port in your PC. If not, then buy a serial to USB and do the same. You can get software to program PICs all over the internet, just search :D you also need a 5V regulated power supply, which you can buy from most hardware stores, im british so i would go to maplin, if you are american go to Radioshack, hope i helped :D

author
portreathbeach (author)Gasburner2009-08-20

You need a PICKit 2. Plugs into a USB and then you can program the PIC

author
GeArGuY (author)2011-12-19

Does anyone have a website where you can get all of this????

author
hkerr (author)GeArGuY2013-12-01

cheaper from ebay

author
antoon (author)GeArGuY2012-08-08

radioshack

author
vanvan67 (author)2013-09-05

Help.,!!!!!!!!!!! can anybody tell me where can i see the program of this.?

author
PH0t0G3N1US (author)2013-07-02

can anyone direct me to website or video that makes the 3x3x3 led cube that uses 4pin Leds??? Thanks

author
mcruz27 (author)2013-06-28

http://www.youtube.com/watch?v=BBa0B99A610&list=FLOhEsbZGGzNAmJ6jLGZzL1g&feature=mh_lolz

author
Robbiezxc (author)2013-01-24

i have made made the HEX file for this cube if any one would like it e-mail me robbiezxc@me.com or if you don't have a programmer i will send you a per-programmed 16F688 for a small fee

author
Robbiezxc (author)2013-01-23

could one some please please send me the HEX code robbiezxc@me.com

author
rkshirsagar (author)2013-01-18

Hi origami_roast, Once you have made your pattern.You have to insert the generated code in the given ASM file ,Lable the sub routine and then open the saved ASM file in MPLAB to generate the HEX code.

author
origami_roast (author)2013-01-11

Hi, Craig! So I made my pattern using the VB software and opened it on MPLAB and I was wondering if the VB software generates a code that is ready for compiling to .hex? Or do I still need to modify the code? Define the labels, include pic16f690 etc.? Thank you!

author
fehera85 (author)2012-12-11

Hi there I would like to attach this picture might be helpful!https://www.instructables.com/files/deriv/FOZ/OPB2/HAFHLHW3/FOZOPB2HAFHLHW3.THUMB.jpg

3x3x3.JPG
author
eagletech201 (author)2012-08-05

When i unzip the vb code file I get a "temp" file. what opens it?

author
OrciTheOrca (author)2012-07-23

http://www.youtube.com/watch?v=_cEJHCtgkok

My cube.

Also I etched my own PCB's. Files can be found in the description of the video.

I used:
3mm Blue LED's
PIC16F690
PICkit 2 programmer
3x 330ohm resistors
9x 220ohm resistors
16V 220uF Capacitor
PN2222 Transistors
L7805CV 5V regulator
Power connector
Male and female pin connectors

Also a 20 pin easy release thing for the chip that I never remember what is called....

author
jackjackboom (author)2012-07-20

How many volts does the capacitor need to be?

author
midknight5000 (author)2012-03-12

how many i o pin are needed to control this cube?

author
jimy268 (author)2011-01-16

I attach the improved photo, the schematic graph and the modified ASM. I DID MY OWN PATTERNS AND DELAYS. You can use the " LED Cube pattern generator " to create his own patterns. Remember that the PICF84A has a limit of 1024 words whereas the PIC16F690 of 4096. " Make to Pocket LED Cube " it is the manual of how to construct the Led Cube

Foto.JPGDiagrama 3.PNGMake a Pocket LED Cube.pdfLED 3x3x3 PIC16F84A.asm
author
jimy268 (author)jimy2682011-03-01

New schematic

Diagrama 3.PNG
author
J.nk.yonek (author)jimy2682011-11-20

as did his scheme and wanted to test it so a lower layer but the LEDs do not blink, you can test only one layer?
I appreciate if you can help me thanks.

author
jimy268 (author)J.nk.yonek2011-11-21


This is a simple program (Test LED 3x3x3) which test (lights) the layers one by one

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
LIST P=16F84A
INCLUDE

cblock 0x0C
PDel0
PDel1
PDel2
ENDC

; Main program starts here
;-----------------------------------------------------------------------------------------------

Start
BSF STATUS,RP0 ;SELECCIONAMOS EL BANCO 1
CLRF TRISB ;LIMPIAMOS EL REGISTRO TRISB
MOVLW B'11110000' ;ENTRADAS RA4-RA4, SALIDAS RA0-RA3
MOVWF TRISA ;PONEMOS EL VALOR DE W EN TRISA
BCF STATUS,RP0 ;SELECCIONAMOS EL BANCO 0
CLRF PORTA
CLRF PORTB

Loop
MOVLW B'11111111'
MOVWF TRISB
BSF PORTA,0
BSF PORTA,3 ;ACTIVA TOP LAYER
CALL DEMORA
BCF PORTA,3
BSF PORTA,2 ;ACTIVA MIDDLE LAYER
CALL DEMORA
BCF PORTA,2
BSF PORTA,1 ;ACTIVA BOTTOM LAYER
CALL DEMORA
BCF PORTA,1
Goto Loop

; Generado con PDEL ver SP r 1.0 el 21/11/2011 Hs 03:47:41 p.m.
; Descripcion: Delay 700000 ciclos
;-------------------------------------------------------------
DEMORA movlw .17 ; 1 set numero de repeticion (C)
movwf PDel0 ; 1 |
PLoop0 movlw .47 ; 1 set numero de repeticion (B)
movwf PDel1 ; 1 |
PLoop1 movlw .218 ; 1 set numero de repeticion (A)
movwf PDel2 ; 1 |
PLoop2 clrwdt ; 1 clear watchdog
decfsz PDel2, 1 ; 1 + (1) es el tiempo 0 ? (A)
goto PLoop2 ; 2 no, loop
decfsz PDel1, 1 ; 1 + (1) es el tiempo 0 ? (B)
goto PLoop1 ; 2 no, loop
decfsz PDel0, 1 ; 1 + (1) es el tiempo 0 ? (C)
goto PLoop0 ; 2 no, loop
PDelL1 goto PDelL2 ; 2 ciclos delay
PDelL2 clrwdt ; 1 ciclo delay
return ; 2+2 Fin.

End;

author
audis3man (author)jimy2682012-03-10

can i use avr studio 4 to programatize this pic with this code?

author
kkcg (author)jimy2682011-03-05

new schem? Why? Your first schem worked only on breadboard but by the time we do the ckt it doesn't work. How can that be? How will this new schem help us?

author
jimy268 (author)kkcg2011-03-06

The new schematic is to show you where the 22 pF capacitor y crystal are place. Should be a wrong connection or wrong track. If you want sent me de the PCB schematic.

author
cesar correia (author)jimy2682011-04-01

can you send me the instructions via email?

correia7cesar@hotmail.com

author
brunder (author)jimy2682011-03-04

with my 3V leds with what volts I need to replace a 220om resistors?

author
jimy268 (author)brunder2011-03-04

R = (Vbattery - Vled)/I of the led
Vbattery =12V  
Vled = 3V
I Intensity of the current in ampere (A).
If your led works with different I you must change it.
If you work with different voltage you must change it.

I
of the led = 20mA = 20/1000 = 0.02A

R = (12-3)/0.02 = 450 Ohms

http://mx.answers.yahoo.com/question/index?qid=20100703021150AAzGxqT

author
vvaidya (author)jimy2682011-03-12

hey can u send me pcb schematics and source code on my email
plzzzzzzzzzzzzzzz

vaidya.vaibhav91@gmail.com

author
brunder (author)jimy2682011-03-04

MY leds are 0,025A(I)
wait vbattery are 5v? in the picture you show 5V?
it follow R=(5-3)/0.025=80 OM resistors right?IF IM not please tell me what resistors?

author
jimy268 (author)brunder2011-03-04

That is correct. Though if you place a major resitor the led was illuminating less.

author
brunder (author)jimy2682011-03-04

I willl try first with 200 OM resistor iff the lef light low I will change with 80 OM resistrors what do tou tink?

author
brunder (author)brunder2011-03-05

Hey jimmy can you send me the soursecode for the programing? the .hex fail right?My email is beam124@abv.bg or on skupe naruto.u2 please sedn me the fail...

author
jimy268 (author)brunder2011-03-05

The downloading file : FM2PAY6GIYWWDPW.TEM
You have to change it : FM2PAY6GIYWWDPW.ASM
If you want, you can change the name. (Led3x3x3x.ASM)

To obtain the file hex, you can use MPLAB.

author
brunder (author)jimy2682011-03-05

I dont understend please send me the fail?

author
brunder (author)jimy2682011-03-04

IM from bulgeriq and here 5mm leds are 3V(red,green,yewoll,blue and other)Please tell me whit what I need to replace a 220 om resistor?Can I replace with 80 om resistor?OR with 200?please tell me with what resistors I need to replace?

author
brunder (author)jimy2682011-03-03

Please jimy telll me what voltage arre yours leds.My leds are 3V ?

author
jimy268 (author)brunder2011-03-04

Since you see I use led red of 5mm, the voltage is 1.9 approximately.
Green Led is 2.1V.This project works with 5v

Look at this link http://es.wikipedia.org/wiki/Circuito_de_LED

If it has another question do not hesitate to ask

author
kkcg (author)jimy2682011-01-19

Big thank you! :D hmm, the cathode of the top layer doesn't connect at the cathode of the middle layer right?

author
jimy268 (author)kkcg2011-01-19

Not, every cathode connects with his corresponding transistor. Top cathode layer connected to the Transistor of the RA3, cathode middle layer to the transistor of the RA2 and cathode bottom layer to the transistor of the RA1.

author
kkcg (author)jimy2682011-02-17

hi again! my teacher wanted me to use an RBG LED for this project. Can you help? Please. :) If you have any idea if we could still use a PIC16F84A, so as the circuit diagram you've given so is the program.

author
tboultwood1 (author)2012-02-19

Hello, thank you for the very good software. It successfully outputed a asm file but is there any way to put this on an arduino? Thank you very much Trevor B

author
hrpearl01 (author)2012-02-01

COULD SOMEONE PLZ TELL ME:

Which type of PIC16F690 do I need:

PIC16F690-E/P
OR
PIC16F690-I/P

OR ELSE SEE: http://bit.ly/zWPoZC

PLEASE TELL ME WHICH ONE OF THESE ON SITE LINK.

THANKS IN ADVANCE

About This Instructable

250,222views

232favorites

License:

More by portreathbeach:Cheap PIC controlled Helmet Camera using Sony LANC (Good for Extreme Sports)3x3x3 LED Cube
Add instructable to: