Step 70: Run the cube on an Arduino

Since we published our last LED Cube instructable, we have gotten a lot of questions from people wondering if they could use an Arduino to control the cube.

This time, we are one step ahead of you on the "Can i use an arduino?" front :D

The IO requirements for an 8x8x8 LED cube is:

  • Layer select: 8
  • Data bus for latches: 8
  • Address bus for latches: 3
  • Output enable (OE) for latches: 1

Total: 21

The Arduino has 13 GPIO pins and 8 analog inputs, which can also be used as GPIO. This gives you a total of 21 IO lines, exactly the amount of IO needed to run the LED cube!

But why write about it when we could just show you?

We hooked the cube up to an Arduino and ported some of the software.

Since the multiplexer array and AVR board are separated by a ribbon cable, connecting the IO lines to an Arduino is a simple matter of connecting some breadboard wires. Luckily, we soldered in a female 0.1" pin header for the transistor lines when we were debugging the first set of transistors. Just remove the ATmega and connect wires from the Arduino to these pin headers.

We connected the cube like this: DATA bus: Digital pins 0-7. This corresponds to PORTD on the ATmega328 on the Arduino board, so we can use direct port access instead of Arduinos digitalWrite (which is slow). Address bus: Digital pins 8-10. This corresponds to PORTB bit 0-2. On this we HAVE to use direct port access. Arduinos digitalWrite wouldn't work with this, because you can't set multiple pins simultaneously. If the address pins are not set at the exact same time, the output of the 74HC138 would trigger the wrong latches. Output Enable: Digital pin 11. Layer transistors: Analog pins 0-5 and digital pins 12 and 13.

We had to go a bit outside the scope of the Arduino platform. The intention of Arduino is to use digitalWrite() for IO port access, to make the code portable and some other reasons. We had to sidestep that and access the ports directly. In addition to that, we had to use one of the timers for the interrupt routine.

The registers for the interrupt and timers are different on different AVR models, so the code may not be portable between different versions of the Arduino board.

The code for our quick Arduino hack is attached.

<p>hi , i have made CRR's led cube but something very strange is happening</p><p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/YZucW88VQr0" width="500"></iframe></p><p>there are led lighting that must not light. I have change emmitter with collector , i have use only one 2n222 as <a href="http://www.instructables.com/member/SuperTech-IT/" rel="nofollow">uperTech-IT</a> says but nonthing good.</p>
<p>Check all the ground are connect and the input/output of 74hc are connect</p>
<p>I noticed you got yours up and running. Congrats. I see you went the 2 transistor rout in the end, but that's OK, it's just more parts than needed.<br>My boards are a lot more compact than yours, and allow Arduino's ATmega328p or the ATmega32/32A/32L processors, but the end result is pretty much the same. LOL. Here you can also see one of my completed single colour cubes beside one of my RGB cubes.<br></p>
2N2222 transistor have 600ma current max on colector and one led need 0.015ma mutil by 64 led each layer equal ~1A. Therefore you need at leat 2 2N2222 transistor
<p>More precisely, my design uses single 2N2222 for the layers - the whole cube with all LEDs lit draws under 700mA. Anyways, if you still have not worked this out, go to www.TheLEDCube.com and download my source code for your processor which contains a POWER ON SELF TEST. Video the POST and put the video up here and I will analyze it and point you to pretty much exactly what's wrong right off the bat unless there are multiple shorts / bad connections.</p>
<p>Hey, can u uploade a bit more detailed description of the power supply.</p><p>I cannot figure out how to solder the pieces</p>
<p>Your best bet is to simply get a 5V 2A plug-in power supply.</p><p>These are cheap and plentiful on ebay.</p>
<p>What have you used, atmega or arduino? </p>
<p>i use atmega</p>
<p>It worked flawlessly buddy. it is such a great feeling achieving that task</p>
<p>The Arduino is also ATmega in that the processor is an ATmega328P.</p><p>Most people prefer the ATmega32/32A/32L for this project though.</p>
<p>Finally, It worked flawlessly. Now I want to go to the next level and use atmega32. Problem is to get the crystal, I'll have to import it</p>
<p>and of course i have place 8 pull up resistors on collectors ,6.2k</p>
<p>finally it works! there were many short circuits and tow transistor had electrik leak</p>
<p>Glad you got it all up and running! Hope to see a video of your cube in action!</p>
<p>Is there any program to control led cube and make coding easy ,just clicking on leds we want to gets on with the order we want?</p>
<p>Largest collection of Articles on How to Guides and Software Tutorials</p><p>Please visit <a href="http://www.baatkar.com" rel="nofollow">www.baatkar.com</a> to know more.</p>
<p>Most of the time I don&rsquo;t make comments on websites, but I'd like <br>to say that this article really forced me to do so. Really nice post!<br><a href="https://www.youtube.com/watch?v=aeoevGInTrI" rel="nofollow">publish academy review</a></p>
<p>i made it one years ago and a huge model of tis cube</p><p>thanks a lot &hearts;</p>
<br> Excellent<br> and very exciting site. Love to watch. Keep Rocking.<br><br> <a href="http://phuketmediacompany.com/" rel="nofollow">Phuket web design</a><br>
<p>Nice to read your article! I am looking forward to sharing your adventures and experiences.<br><a href="https://www.youtube.com/watch?v=_pHN8PeeYqU" rel="nofollow">Affilojetpack 2.0 review</a></p>
<p>Awesome and interesting article. Great things you've always shared with us. Thanks. Just continue composing this kind of post.<br><br><a href="https://www.youtube.com/watch?v=YRB6IfTZkGc" rel="nofollow">The Venus Factor Review</a></p>
<p>Thanks, that was a really cool read!<br><br><a href="http://bluestar-eliquid.co.uk" rel="nofollow">nicotine concentrate</a></p>
<p>Your website is really cool and this is a great inspiring article.<br><a href="http://www.profischnell.de" rel="nofollow">profischnell.de</a></p>
<h3><a href="http://psychicfox.co.uk" rel="nofollow">(Tarot Card Readings)</a><p><a href="http://psychicfox.co.uk" rel="nofollow"> </a><br> </p></h3><p>Thank you very much for this great post.</p>
<p><a href="http://www.baatkar.com" rel="nofollow">For how to guides and software tutorial visit this</a></p>
<p><a href="http://www.baatkar.com" rel="nofollow">Great Article I Appreciate Your Work</a>. </p><p>Thanks</p>
<p>where are all the comments</p>
<p>I went over this website and I believe you have a lot of wonderful information, saved to my bookmarks<br><a href="http://memyfriends.com/how-to-get-a-hot-girlfriend-if-youre-ugly/" rel="nofollow">can i get a hot girl if i'm ugly</a></p>
<p>Is it just me, or did all the comments disappear?</p>
<h3><a href="http://nasirilyas.com" rel="nofollow">nasir ilyas</a></h3><p>Thanks for sharing this quality information with us. I really enjoyed <br> reading. Will surely going to share this URL with my friends.</p>
<p>This is a great article thanks for sharing this informative information. <br> I will visit your blog regularly for some latest post. I will visit <br>your blog regularly for Some latest post. <br><a href="http://j.mp/AddSite" rel="nofollow">Submit URL</a></p>
<p>This one is good. keep up the good work!..<br> <br><a href="https://www.youtube.com/watch?v=WXPalR1Ljvs" rel="nofollow">Rich Jerk</a></p>
<br> This is such a <br> great resource that you are providing and you give it away for free. I love <br> seeing blog that understand the value of providing a quality resource for <br> free. <br><p><a href="http://www.nagmauritius.org/how-to-get-a-woman-hooked-on-you/" rel="nofollow">nagmauritius.org/how-to-get-a-woman-hooked-on-you/</a></p>
<p>i love reading this article so beautiful!!great job!<br> <br><a href="http://movietubenow.weebly.com/" rel="nofollow">movie tube now</a></p>
<p>These are some great tools that i definitely use for SEO work. This is a great list to use in the future.. <br><a href="http://www.aconsult.fr/pascher.asp" rel="nofollow">Canada Goose Manteau Solde</a></p>
<br> Great <br> Article it its really informative and innovative keep us posted with new <br> updates. its was really valuable. thanks a lot. <br> <br> <a href="http://www.entretien-menager-genial.ca" rel="nofollow">menage apres construction prix</a> <br>
<br> I read <br> that Post and got it fine and informative. Please share more like that... <br> <br>menage apres construction prix <br>
<p>Thank you for such a well written article. <br>It&rsquo;s full of insightful information and entertaining descriptions. Your <br> point of view is the best among many.<br><a href="https://www.youtube.com/watch?v=_pHN8PeeYqU" rel="nofollow">Affilojetpack 2 Review</a></p><br>
<p>hai guys I want to know how much power and amp give for cube and I am using arduino so arduino hold 1.5 amp 5v and connect to driver board or I give power to driver board separately and arduino separately and how much I want give can u give me detail</p>
<p>Hello i have built this cube but i am having problems. i upload the test code and everything works but after i uploar the second code as well as the firmware nothing happens</p>
<br> This is actually <br> the kind of information I have been trying to find. Thank you for writing <br> this information. <br> <br> <a href="http://womeninneuroscience.org/sleep/side-effects-kavinace.html" rel="nofollow">more</a> <br>
<p>I will make it</p>
<p>Thanks for taking the time to discuss this, I feel strongly that love <br>and read more on this topic. If possible, such as gain knowledge, would <br>you mind updating your blog with additional information? It is very <br>useful for me.<br><a href="https://www.youtube.com/watch?v=NQgksA_SL7Y" rel="nofollow">Fat Diminisher</a></p><br>
<p>Your website is really cool and this is a great inspiring article. Thank you so much. <br><a href="https://www.youtube.com/watch?v=tLRUy_wPIro" rel="nofollow">Video Vibe Pro Review</a></p>
<p>I am using arduino mega as isp to program or usb pic or if u any software for led programming that is also good </p>
I'm good to go now found good files on pyroelectro.com by thepyroelectro www.pyroelectro.com/projects/8x8x8_led_cube/arduino_8x8x8_cube.pde
can you tell me how to copy and paste animations into the my main sketch from other sketches? So I can add more animations. what section sketch to copy and where to place it. thanks

About This Instructable


3,545 favorites


Bio: I like microcontrollers and LEDs :D
More by chr: Reverse Engineering: RGB LED Bulb with IR remote Reverse engineering: USB controlled home automation hack LED Cube 8x8x8
Add instructable to: