Introduction: 4x4x4 LED Cube (Arduino Uno)

Picture of 4x4x4 LED Cube (Arduino Uno)

In this tutorial I'll show you how to make a 4x4x4 LED cube for around $15.00. The cube has 64 green LEDs which make up it's 4 layers(positives) and 16 columns(negatives). These are all wired to a Arduino Uno. An Arduino is a single-board microcontroller, intended to make the application of interactive objects or environments more accessible. The hardware consists of an open-source hardware board designed around an 8-bit Atmel AVR microcontroller, or a 32-bit Atmel ARM. I programed code(sketches) for the Arduino Uno to controll the individual LEDs to display patterns for this captivating desktop light show.

Watch The Video:

-----------------------------------------------------------------------------------------------------

Besides the fun of making and posting this instructable, this project is an entry for the Tech, Teach It, and Epilog Challenge VI Contests. I would really appreciate your vote!

Please click on the orange vote ribbon in the upper right-hand corner of this

page if you enjoy this Instructable.

-----------------------------------------------------------------------------------------------------

Step 1: What You Will Need:

Picture of What You Will Need:

Parts/ Materials:

  1. 64 Diffused LEDs $2.00
  2. 4 100 OHM Resistors $1.00
  3. Pin Header $0.50
  4. Slide Switch $1.00
  5. Wire $0.75
  6. Craft Wire $0.25
  7. Perf Board $2.00
  8. Project Box $6.00
  9. 9V Power Supply $1.00

Total Cost: $14.50

Tools/ Adhesives:

  • Arduino Uno
  • Drill
  • 1/16" Drill Bit
  • 5/16" Drill Bit
  • Knife
  • Straight Edge
  • Needle Nose Pliers
  • Soldering Iron
  • Solder
  • Hot Glue Gun

Step 2: Making the LED Jig

Picture of Making the LED Jig

First, Start by printing out my 4x4x4 LED Cube Template and paste it to a cardboard box.Make sure that the printing settings are set to actual size and landscape orientation. Next, punch out all 16 LED holes(grey dashed circles) using a pencil. Insert a LED into the individual holes to test the fit.

Step 3: Making the LED Cube

Picture of Making the LED Cube

Take the 64 LEDs and test them to ensure that they all work using a button cell battery. This may sound tedious but in the end this will safe-guard your your project! Next, insert 16 LEDs into the holes and bend the leads to the direction of the arrows using needle nose pliers. The red arrows represent the positives(anodes) likewise the blue arrows represent the negatives(cathodes). Solder all of the positive leads together and trim off the access of the leads. Now, you might have noticed that there are two gaps in the layer of the positive leads. This can be solved by straightening a length of craft wire by pulling both ends of the wire with pliers and trimming two 1" sections that are then soldered in place. After the hole positive layer is soldered together, flip the box over and start pushing the tips of the LEDs out of the holes in the jig. Make sure to do this evenly to avoid bending or damaging the layers structure. Now your first LED layer is finished! Follow this step three more times to end up with four layers. Next, take the four LED layers and solder the negative leads together by stacking the individual layers on the top of each other. Start by soldering the leads in the center, then work out to the leads on the edge. The 4x4x4 LED cube is starting to take shape! Straghten another length of craft wire and cut and bend four sections that will later connect the four layers to the perf board. Finally, solder them in place.

Step 4: Installing the LED Cube

Picture of Installing the LED Cube

Start by marking an outline of a square with a Sharpie that is slightly smaller than the interior sides of project box on the perf board. Use a straight edge and a knife to score the outline along the lines, then break off the access material by placing the perf board in a vise or on the edge of a table, then apply pressure till the scored sides snap off. Next, drill 20 holes with a 1/16" drill bit for the leads on the top of the project box. An easy way of doing this is by marking the holes where the leads poke out of the perf board and then taping the board to the top of the project box. Next mark the 20 holes on the top of the box through the board with a sharpened pencil. Take the perf board off and drill where the markings are on the project box. Then glue the perf board inside of the box with some hot glue. Make sure that all 20 holes line up with the holes on the perf board. Next install the LED cube by carefully inserting each lead through the holes on the project box. Finally, solder the leads in place, then trim off the access wire.

Step 5: Wiring the Circuit

Picture of Wiring the Circuit

First, snap the pin header in to 3 pieces that fit the Arduino Unos digital and analog plug-ins. Strip and start soldering wires to the 16 digital leads(columns) on the perf board. For the 4 analog leads(layers), solder 100 OHM resisters to the leads then solder wires to each resisters lead. Next strip and solder the opposite ends of the wires to the 3 pin headers. The wiring is setup to resemble a graph with a 3rd dimension. For the columns, there are two axes X and Y. In addition, the layers serve as the Z axis. If you look straight down from the top of the LED cube it looks like the 1st quadrant on a graph except that the origin is (1,1) on the cube. Likewise each LED can be named using the fundamental graphing technique. Lets try an example; look at the demonstrational picture and find A(1,4). "A" means that it is on the first layer and "(1,4)" is X=1,Y=4 on the graph.

Connection Setup:

Columns

[(x,y)-Pin]

  • (1,1)-13
  • (1,2)-12
  • (1,3)-11
  • (1,4)-10
  • (2,1)-9
  • (2,2)-8
  • (2,3)-7
  • (2,4)-6
  • (3,1)-5
  • (3-2)-4
  • (3-3)-3
  • (3,4)-2
  • (4,1)-1
  • (4,2)-0
  • (4,3)-A5
  • (4,4)-A4

Layers

[Layer-Pin]

  • a-A0
  • b-A1
  • c-A2
  • d-A3

    Step 6: Installing the Arduino/ Power Supply

    Picture of Installing the Arduino/ Power Supply

    Take the sliding switch and cut the mounting tabs off with the wire snips on the needle nose pliers. Next, cut and strip the positive wires of the power supply and solder the switch to the positive leads. Drill a hole on the side of the project box with a 5/16" drill bit. Make sure to work up to the 5/16" hole in increments of bit sizes. Carve away the plastic ribs in the interior of the box near the hole with a knife, then hot glue the switch in place. Next, plug the pin headers and the 9v power supply into the Arduino Uno. Lastly, upload the code(sketch) to the Arduino then tighten the bottom lid on to project box. Now the 4x4x4 LED cube is finally finished!

    Enjoy!

    Want more instructables?Please favorite, follow, and comment for more creative builds, hacks, and more.

    Thanks, KyleTheCreator

    The Code!

    I found this sketch online, then I edited it to work for my LED cube. Soon, I'll have my own sketch that will be posted right here, on this i'ble. But for now, if you have any improvements or add-ons to this current sketch, let me know so I can keep it updated:)

    Step 7: I Made It! Gallery

    Picture of I Made It! Gallery

    This is a gallery of the 4x4x4 LED cubes that members of the community have made by following this instructable. If you would like to have your LED cube featured, click the "I Made It!" button to post it in the comments and I will add it right here, in the "I Made It!" gallery.

    Comments

    whit3light made it! (author)2014-08-28

    how can i program the code to go by b0000?? please

    any help would be really appreciated

    this programming is too complex for me and the b0000 i know how to program

    I am thinking of posting a "LED Cube Gallery" in this instructable with pictures of the cubes that people have made. Do you mind if I feature your LED cube picture in this instructable?

    Thanks,

    -Kyle

    Hey! I am new for the arduino. I didn't understood that which wires I have to connect in which arduino plugins

    Please explain me
    If you have more pics of circuit please post

    Yeah, Yeah man of course! Sorry it took so long
    Kinda moving apartments XD

    Nice picture! How did you make that acrylic enclosure?

    HemantP6 (author)KyleTheCreator2015-12-25

    I'm new to the arduino thing...and this will be my first project using arduino. Thanks for this great tutorial buti have a question that does this project involve multiplexing and what difference it would make if we add multiplexing to this cube?

    Thanks!! & Hahaha funny story I got it from a friend. He got a go pro 3 and that was a part of the box. although i really like you're idea for how you enclosed all the electronics I'm working on something similar with wood

    PS This was my first project using an Arduino too lol. and if you could keep me updated that would be great!! thanks!! If i get any ware ill let you know. but i doubt it XD I've sent you a PM with my email

    Thanks for everything

    whit3light (author)MariusG12015-03-27

    Hey man thanks so much for trying to help! but as close as it is to working.. its way off for some reason. its opposite to start with, when its checked the light is off and when i leave the box empty the light is on. witch i could work with if it was where it says itll be.. any ideas??

    MariusG1 (author)whit3light2015-03-27

    Okey I found the problems, there are mainly two I think.

    1. Your cube uses the 4 floors as +V (anode) and the 16 columns as -V (cathode). This is of course oposite of how most people do it, and the reason is that you need 16 transistors instead of 4.

    This is why your cube lights up when unchecked, and doesn't when checked. This can be easily solved by me changing one little thing in the program, but I recommend you wire it with 16 transistors, that's the optimal way, I can provide a picture.

    -View the blue lines as anode and the red lines as cathode (this is the way YOUR cube works).

    -You wanna wire it like the picture BUT take away the 4 transistors and run the blue lines directly.

    -Add 16 transistors to the red wires and to the cube.

    2. Your wiring to the cube from the pins on the arduino does not match up with the code I wrote. This is easily solved by switching the pins to the way described in my instructable.

    I'll also tell you it's a bad idea to add 4pcs of 100ohm resistors to the anodes, this will make your cube dim in different patterns. You should add 100 ohm to each of the 16 cathodes on your cube. But in my experience it is not necesarry at all because it makes the cube way too dim, your choice.

    ArpitPatel (author)MariusG12015-12-10

    Hello Dear, I am doing this project for my hobby. But i made one big mistakes in this project. I have bend all the cathodes of LED to make horizontal layer and keep anodes straight to make vertical columns. Now when i made it, i have 16 columns which are connected individually in vertical line (one vertical column contains 4 LEDs) and 4 floor of layers of LEDs which are connected individually in horizontal (one horizontal layer contains 16 LEDs). Now according to your project i think i made it reverse. Now is there any solution? is this cube can work? Please reply.

    MariusG1 (author)ArpitPatel2015-12-16

    There are several problems with this and I've tried to offer some solutions but they didn't seem to really work. The easiest way is probably to just do the cube again the right way. I'm not sure I understood your explanation right but it seems like you did it like I did. Do you have 16x4 vertical LEDs connected to each others anodes and 16x4 horisontal LEDs connected to each other with the cathodes?

    ArpitPatel (author)MariusG12015-12-17

    No Dear... I have total 4 horizontal layers...Right? Now each horizontal layer is connected via cathode. Now to make a cube i need to arrange all the horizontal layers in slab form, i.e. one layer is mounted on another via anode. each layers anode is connected to the anodes of another layer just below the one.

    whit3light (author)MariusG12015-03-27

    It works!!! I have control of columns!! thanks! thats all ready a start but why cant i control to floores? what is that 2n2222a?? where can i get it and why do i need it if i can just connect them directly to A0,A2,A3.

    And again thanks for al the help!

    MariusG1 (author)whit3light2015-03-27

    2n222a is a transistor. It is an electrical component that can be used as a switch, it has three legs. one leg is "input", one leg is "output", and the third leg controls wether the input goes out or not.

    The 20 digital I/O pins on your Arduino can output +5V, that's what they do. So the way I wired my cube this means 16 +5V pins goes to the anodes and I need 4 to control the cathodes. But the cathodes needs GROUND and not +5V. So the way you do that is to use transistors as switches. You control transistors with the +5V so when the switch is on the transistor will ground the floors on the cube.

    This is exactly the same for your cube, except you have to reverse it so you need 16 transistors. How your cube lights up at all beats me... I'd really like an explanation :D

    deshsmita (author)MariusG12015-11-19

    hey please can you tell why they are taking 2vinstead of 5 v when calculating resistance. and is it fine if we don't use transistor? arduino outputs 5v then it comes out to be 250ohm. also in one function in the code given layerstompUpAndDown() i think turn all leds function should be there. please tell me if 100 ohm is fine for 5 v?and if we can switch to source 2 v how its done:)

    whit3light (author)MariusG12015-03-28

    OK. so I'm re doing the Cube... and this time making it that each floor is cathode(-). and the columns as anode(+) also adding a 100 ohm resister to each column. and gonna order the transistors But first I was hoping you could take a look at the link and let me know if that's the right thing. ****** LINK http://www.ebay.com/itm/100Pcs-TO-92-NPN-Transistor-2N2222A-2N2222/121087323194?_trksid=p2047675.c100005.m1851&_trkparms=aid%3D222007%26algo%3DSIC.MBE%26ao%3D1%26asc%3D29904%26meid%3Dae1d848938464abe9ae9af7e1baad7d0%26pid%3D100005%26rk%3D3%26rkt%3D6%26sd%3D251541557864&rt=nc *** Is this it?

    MariusG1 (author)whit3light2015-03-28

    No problem! That sounds like a good idea, then you only need 4 transistors and can follow the instructions in my instructable. You sent me a link for the 2n2222a to-92 which is ok to use, it's a little cheaper. I used the 2n2222a to-18 but it doesn't really matter, they should both work great!

    whit3light (author)MariusG12015-03-28

    hey all you have in youre instructable is how to program it.. also are these better? http://www.ebay.com/itm/20-x-2N2222A-2N2222-NPN-Transistor-0-8A-40V-TO-18-/250867361510?pt=LH_DefaultDomain_0&hash=item3a68dc26e6

    MariusG1 (author)whit3light2015-03-28

    View Step 2 "Bulding the cube". Also look at the pictures. The picture I post below will be the way you should wire it now. These transistors will work just as good, no worries!

    whit3light (author)MariusG12015-03-28

    Hey alright so I have ordered these now :

    http://www.ebay.com/itm/20-x-2N2222A-2N2222-NPN-Tr...

    http://www.ebay.com/itm/381087895724?_trksid=p2060...

    and should be getting them in a month or so.. Again I just cannot thank you enough for all the help!!! and i cannot wait to finely have a cube that I can control & program!!

    MariusG1 (author)whit3light2015-03-28

    No problem, that looks good! I also recommend to buy these wires in "male to male" and "male to female":

    http://www.ebay.com/itm/40PCS-Dupont-wire-jumper-c...

    They are really helpful and makes it so fast and easy to connect your arduino and take it out if you wanna use it for something else.

    -----------------------------------------------------------------------------------------

    If you wanna know which pins are which on your transistor just google "<Transistor name> pinout" and it will show up in images. This goes for basicly any component, just search the name of the component and "pinout".

    Let me know how it goes!

    whit3light (author)MariusG12015-03-28

    Oh in the picure you sent me it looks like you have a risister in front of each npn? and how would i kknow which leg goes for the ground and which is for the floor I figure the middle one is for A0 pins

    and I can not thank yo enuagh dor all the help

    MariusG1 (author)whit3light2015-03-28

    Since the transistor works as a switch you can think of it like there is a switch inside of it that connect the collector to the emitter depending on the signal on its base. If it reads "0V" on the base it's open and there's no connection between the collector and the emitter. If it's bigger than "0V" it will make a connection between the collector and the emitter.

    ----------------------------------------------------------------------------------

    Since the arduino outputs 5V the connection is made when the arduino ouputs a signal. Now there is an "ideal voltage" to make the connection as good as possible, to get this in this case we use around 1k resistors before the base.

    whit3light (author)MariusG12015-03-28

    I see. so would that also mean that I can connect ether pins "E" or "C" to the cube or ground since the just close the connection?

    MariusG1 (author)whit3light2015-03-28

    Normally you could do that with a switch but not with transistors. The collector needs to get the +V in and the emitter goes to ground.

    whit3light (author)MariusG12015-03-28

    Alright then. well thanks to your picture I can now distinguish the collector from the emitter from the flat side

    MariusG1 (author)whit3light2015-03-27

    I added the program for the ones who wired the cube "opposite" in the instructable. You can use this program and just change the column leads to match the way it's written in the code. This is an easy fix so I still recommend my first comment, but you can try this first if you wish.

    whit3light made it! (author)MariusG12015-09-23

    Dude it works!!!!! well sorta I add a screen so it'll tell whats playing and whats next but i cant seem to put the code together.... take a look!!

    https://www.youtube.com/watch?v=PPym_BUpTpc

    MariusG1 (author)whit3light2015-09-23

    So at least the LCCG works to make patterns like it should?

    I don't think I can help much on the LCD part, I haven't really tried to program them yet!

    whit3light (author)MariusG12015-09-24

    yeah man!! it works!! Thanks for all the help!!

    and No dont say that!! you are my last chance... I have the two programs that run each thing, and they work. but I cant just copy and past one in the other.. error pops up.. come on youve gotta know something!!

    After all you help me make one i can program myself!!! thank you so much for that!!!!!!!!!!!!!!!!!!!!

    MariusG1 (author)whit3light2015-11-10

    I recommend this site for learning about microcontrollers, it is great! We even use it in our microcontroller-subject at school. It's very detailed, easy to understand and it says a lot about LCDs as well!
    https://newbiehack.com/MicrocontrollerTutorial.asp...

    whit3light (author)MariusG12015-05-01

    OK! So I have gotten all of the pieces. and I'll be cutting the acrylic this week for the box and i have to do it before i put the hole thing together.. I'll let you know how it turns out!! also any other ideas on how to make a nice looking box for it?

    whit3light (author)whit3light2015-05-01

    And by box I mean for the bottom, under the gopro's acrylic box.

    MariusG1 (author)whit3light2015-05-01

    Cool! Yeah sure, I'm working on my 8x8x8 now and I used plexiglass that I tinted with mirror film. That should look pretty cool and it will also reflect the light to give a cool effect!

    whit3light (author)MariusG12015-05-02

    Wow Dude!! it looks amazing!!

    why don't you build the hole led cube before connecting it to the base?

    much easier if you ask me.. XP Oh and where can I get a mirror film?

    MariusG1 (author)whit3light2015-05-02

    Because it's like getting 64 threads through a needle, pain in the ass! And I wanted to use the base to build it on so I can build it as straight as possible :D

    I would just order something from ebay, unless you have some local window tint company or store that sell them. They were a pain in the ass to get here in Norway but I knew someone who had it.

    Fozzibehr (author)whit3light2015-02-19

    I love the idea of using the gopro lid, I was thinking about trying to make an acrylic case, and thats perfect!

    whit3light (author)Fozzibehr2015-02-20

    Thanks man!

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

    Thanks for the recipe! I just used some spare LEDs i had lying around, so they are of different color. I was thinking it would be nice to integrate a VU meter circuit, but i guess that's impossible with all of the analog pins occupied, right?

    KyleTheCreator (author)J.W.N.R.2015-01-28

    Wow! The final product looks amazing! I like the multicolored effect that your cube displays. Your pics are a great addition to the "I Made It" gallery. Unfortunately, I don't have enough experience with VU meters to know if it would work for this application.

    -KTC

    J.W.N.R. (author)KyleTheCreator2015-01-29

    Thanks! I guess an arduino with more A-pins would do the trick.

    WileyI made it! (author)2014-12-23

    Very helpful!! This is what I made my girlfriend for christmas.

    KyleTheCreator (author)WileyI2015-01-28

    Great job! I hope she likes it;)

    hainam8x (author)2015-01-03

    Thank you for the useful instruction, here is my result

    benjamin.hollatz made it! (author)2014-11-08

    Awesome instructable, thanks!! Time to try the big one.

    adamantum made it! (author)2014-11-03

    Nice Instructable.

    Thank You KyletheCreator!

    Rustie0125 made it! (author)2014-09-01

    Here you go!

    I added a "LED Cube Gallery" in this instructable with pictures of the cubes that people have made. Do you mind if I feature your LED cube picture(s) in this instructable?

    Thanks,

    -Kyle

    its fine go ahead