Step 16: Arduinize it.

Now we are going to add the Atmega328 chip, the brains of our cube.

Place it somewhere near the center of the board, use a socket for this one as it is possible that you may need to replace it.

In this step, we'll also add the 3  3-pin headers and 2 resistors for each, the 4k7 ones and the 8k2 ones, place those near the center of each TLC5940 leaving a 1 pin thick gap between the two (pic 1).
I tested it with GreatScottLab's code need few changes but it give a good start to your own animation. I wonder if anyone has managed to implement MSGEQ7 code?
<p>Would you like to share your modified code, so we can make animations together?</p><p>Greets from Germay</p><p>Mike<br></p>
<p>Hey, Mike<br>First of all I have made a little hardware modification taken from GreatScottLab's cube.<br>What I did with Emilliano's cube is to re-group RGB channels separately.<br>Every color is connected with a corresponding TCL.<br>As a result of which a &quot;frankenstein&quot; cube came up :)))<br>But both sketches run successfully with a little changes on Emilliano's one.<br>You can see changes in code from attached files.<br>I'm novice in Arduino programm language and for now I just mixed up code from different sources :)<br>Sorry for my english (a little Google translate).<br>Best regards<br>Milen</p><p>1. </p><p><a href="https://drive.google.com/open?id=0B9ugGjFQzs5ca1lpdkl2VW1GcGs" rel="nofollow">https://drive.google.com/open?id=0B9ugGjFQzs5ca1lp...</a></p><p>2. </p><p><a href="https://drive.google.com/open?id=0B9ugGjFQzs5cMWhWbWNPLVBYbFk" rel="nofollow">https://drive.google.com/open?id=0B9ugGjFQzs5cMWhW...</a></p>
<p>Here are my Code for foldingWalls:</p><p>function:<br><a href="http://pastebin.com/1E8tWHr7" rel="nofollow">http://pastebin.com/1E8tWHr7<br></a></p><p>To Use:</p><p>// FoldingWalls<br>int wiederh = 5; // Speed 5 = slow, 0 = fast<br>if(count==20){ // Number of animation<br> for (int s = 0; s&lt;3; s++) // Number of repeats<br> {<br> for (int a = 0; a&lt;=36;a++) { // Scenes<br> for (int w = 0; w&lt;wiederh; w++) { // Speed<br> reset();<br> FoldingWalls(4000, a); // hue of animation<br> for(int i=1;i&lt;5;i++) {<br> while(micros() &lt; oldMicros) { }<br> oldMicros=micros()+LayerDuration; <br> CubeUpdate(i); }<br> }<br> if (a&lt;36) count--; }} //increment conut only after complete animation<br>}</p>
can i use an arduino uno is this one?
<p>yes, you can.</p>
<p>Work very well, but has anyone programed animations and would share these to get insight of the code?!</p>
<p>should be easiest using an ArduinoOneR3</p>
It seems better to build a arduino tight into the cube so that when you want to use your arduino moard you can use it and still have one operating your LED cube.
Hi there! :) Could someone please explain me the code.Also I'll be very thankful, if someone could email the whole code . It's very important because i'm building a 5x5x5 rgb led cube for my project in college. Please reply as soon as possible. <br>Thanks in advance ! :) <br><br>
<p>hey jimmy, I've spent sometime working on this cube and can tell you a bit about the code. First off, the code is actually posted in a zip file within the instructions but you will also need to download the TLC5940 header which can be found here: <a href="https://code.google.com/p/tlc5940arduino/" rel="nofollow">https://code.google.com/p/tlc5940arduino/</a> . you'll have to place the file within your libraries folder in arduino. Once you have this all you have to do is redefine some of the pins on both the arduino and the TLC's. It's a similiar process described within the instructions. Honestly, once you get a good grasp of what your doing you can rewrite some of the code and take out a lot of it to make things simpler. Another important thing to do within the TLC header is to change the number of TLC's in your circuit. this function can be found within a file called something like &quot;config.tlc&quot;. I hope this helps you out a bit, feel free to contact me if I didn't answer something. </p>
<p>Please, cammace, send me a working code for this cube. The TLC5940 header was installed properly but the program reports a compile-time error: </p><p>\Arduino\libraries\Tlc5940/tlc_progmem_utils.h:65:41: error: 'gsArray' was not declared in this scope</p><p> void tlc_setGSfromProgmem(prog_uint8_t *gsArray)<br>Thank you.</p>
<p>i went to the link but i don't know what to go to get the code. can you help me , i just got done with the cude.</p>
<p>Hi cammace, I am building the led cube but I can't find the zip file within the instructions, could you be able to email me the code? I would be very thankful.</p>
<p>Hello cammace, i've been looking for the zip file within the instructions but I can't find the code, could you be able to email me the zip? I would be very thankful :)</p>
<p>Hi guys! I have any questions.</p><p> Which external EEPROM should I use in this project?</p><p>Here he does not say. it is essential to put it, or I can do without it?</p><p>If in case the EEPROM, then I have to add something to the program code?</p><p>Please help ^^</p><div><div><div><div></div></div></div><br></div>
<p>I didnt use one dude, just ignore it haha</p>
<p>Hi. I have a little problem here. If I try to download LED Cube Sketches I will get .rar file. But I can not unpack files from it. It gives an error after unpacking. Files are unavaileable. Is there any chance to get sketches?</p><p>Second problem is with tlc library. I get lots of errors while uploading main cube scetch to arduino. Something like:</p><p>In file included from C:\Users\Marius\Documents\Arduino\libraries\Tlc5940/tlc_animations.h:30:0,</p><p> from Declarations.ino:1:</p><p>C:\Users\Marius\Documents\Arduino\libraries\Tlc5940/tlc_progmem_utils.h:32:27: error: variable or field 'tlc_setGSfromProgmem' declared void</p><p> void tlc_setGSfromProgmem(prog_uint8_t *gsArray);</p><p> ^</p><p>C:\Users\Marius\Documents\Arduino\libraries\Tlc5940/tlc_progmem_utils.h:32:27: error: 'prog_uint8_t' was not declared in this scope</p><p>C:\Users\Marius\Documents\Arduino\libraries\Tlc5940/tlc_progmem_utils.h:32:41: error: 'gsArray' was not declared in this scope</p><p> void tlc_setGSfromProgmem(prog_uint8_t *gsArray);</p><p> ^</p><p>C:\Users\Marius\Documents\Arduino\libraries\Tlc5940/tlc_progmem_utils.h:68:27: error: variable or field 'tlc_setGSfromProgmem' declared void</p><p> void tlc_setGSfromProgmem(prog_uint8_t *gsArray)</p><p> ^</p><p>C:\Users\Marius\Documents\Arduino\libraries\Tlc5940/tlc_progmem_utils.h:68:27: error: 'prog_uint8_t' was not declared in this scope</p><p>C:\Users\Marius\Documents\Arduino\libraries\Tlc5940/tlc_progmem_utils.h:68:41: error: 'gsArray' was not declared in this scope</p><p> void tlc_setGSfromProgmem(prog_uint8_t *gsArray)</p><p> ^</p><p>Error compiling.</p><p>Do I have to edit TLC library to get my cube work with 3 TLCs? And if its so, then How?</p><p>Im working on this project for 2 years and still no progress. I have built 3 RGB led cubes and control units for them and even trying to make it work on breadboard. </p><p>I really need some help. </p><p>Waiting for any response.</p>
<p>I made it! I used a PCB instead of the perf board, and I also decided to just keep the chip in there because I do not plan on re-programming it. I made one for myself, and one for my teacher who wanted one as an example. (I bet you can guess which one I kept) This was a fun project!</p>
<p>What code did you use? and did you add a MSEGQ7? if so can you share your code?</p>
<p>I did not use a MSEGQ7 (since I don't plan on adding new programming) I decided I was just going use the code given, just make sure to look in the library settings and change the number of Multiplexers or the program won't work.</p>
<p>I'm new to electronics, but I love them and will defeinitely create this one. Got couple of questions though. Are these mosfets OK to use? <a href="http://www.ebay.com/itm/5PCS-MOSFET-Transistor-IR-IRF-TO-220-IRF9540N-F9540N-IRF9540NPBF-New-/201270060280?hash=item2edca164f8" rel="nofollow">http://www.ebay.com/itm/5PCS-MOSFET-Transistor-IR-...</a></p><p>Also about capacitors - 0.1uf and 22pf capacitors on ebay are 50v. Are they the ones to use?</p><p>Please check this collection http://www.ebay.com/cln/stancheg/rgb-led-cube/234958035011?</p>
<p>This is a very nice and a good project, but I am wondering why didn't you use PCB instead of soldering the whole circuit? It could save a lot of effort and solder.</p>
<p>Because everyone makes their cub a bit different. It's hard to know were the the 50 legs will slide through the board.. </p>
<p>if i don't want music.</p><p>when how can i do it,</p><p>and what I need to prepare material.</p>
<p>hey. when i connect the power my cube do noting...</p><p>when i try to connect the cathode from one led its blinds. so maybe any problem it the TLC?!</p><p>i check the connections and its seems to be fine...</p>
<p>guys.. where do we connect the common anode connections taken from each layer to? i mean to the arduino?</p>
<p>to the drain of the mosfets, while the cathodes goes to output of the TLCs</p>
<p>Hello to those out there that built this cube and only got some of the layers to light,</p><p>My build of the 4x4x4 cube only got 3 layers to light up. After checking all the connections, i then started to look at the code. I started playing around with the pin number that are set for the PinMode command. Here is the code that i was looking at. It is in the RGB_4x4x4_LED_Cube_main_1 at the beginning:</p><p>#define LayerOne 16</p><p>#define LayerTwo 4</p><p>#define LayerThree 2</p><p>#define LayerFour 15</p><p>So, i changed the number for LayerFour from 15 to 17, and presto magic, all 4 layers are lighting up.</p>
<p>Hi bill3780,</p><p>How did you figure <br>out the value of 17 instead of 15? I have similar issue with my cube. I <br>run the main code and my 4th layer isn't lighting up or only very <br>faintly. If I run the mapping code, then it lights up very well... I <br>tried with 17 instead of 15 but then another layer stopped lighting... so <br> it must be related to this but I am not sure... I take that 2 and 4 are the <br>digital pins 2 (PD2) and 4 (PD4) on the ATMega chip and they actually match the layers associated with <br> them... but I used A1 (PC1) and A2 (PC2) for the other layers on a ProMini and I am not sure how they relate to 14 and 15 (or 17).</p><p>Thank you</p>
<p>Would this work with an Arduino MEGA 2560? Please relpy</p>
<p>Here is an updated schematic. with the MSEGQ7 chip added in, and a rest circut for those with out an auto rest programer. </p><p>I'm not sure how to code the MSEGQ7 in to this cube, so any help would be great! </p>
<p>I plan on building this myself. I'll probably start writing the code while I'm waiting for the parts. I have used the MSEGQ7 chip in many projects so I'll be happy to share what I come up with. One question: where did you source the uninsulated wire that supports the structure? Also, what LEDs did you use?</p>
<p>Also, GreatscottLabs built one very similar. http://bit.ly/1vUOasm . His code also works with basic changes. BUT i like This code better. </p>
<p>That would be great! I used 18 gauge Bus wire. but it was a PAIN to fit through bread board, had to dremmel an angle on each wire. I will use 20 or 22 gauge next time i built it, BUT the 18 Gauge makes it super strong. </p><p>I used CLEAR common ANODE LED's, from ebay... <a href="http://bit.ly/1vUMX4h" rel="nofollow">http://bit.ly/1vUMX4h</a></p><p>Hope to see your code soon. I had to make a few changes to his code to make it work with the way its wired up, all of which i found in these comments. I can send you what i have if needed. </p>
<p>Have my Cube built and Atmega programed. It turns on with the Main code and starts to run, But the LED's are Dim and each color flickers as it's fading in and out. as if it's to low on power. After a minute the top layer goes on solid and the rest turns off (like the chip locked up)</p><p>I am using a 5v 2A power suply, have tried two of them. </p><p>Any suggestions? I have looked for shorts, and test connections</p><p>Thank you...</p>
<p>So I have determined the flickering is part of the PWM used for fading by the 5940's. i wonder if there is a way to turn that up so it's not so noticeable. </p><p>Also the cube seams to work fine via USB power from my PC.. so it's just my larger power supplies that cause issue!</p><p><a href="http://youtu.be/zscuqmPN3rM" rel="nofollow">http://youtu.be/zscuqmPN3rM</a></p>
<p>I made a full schematic of the &quot;Basic cube&quot; So you don't have to go back and forth. I</p>
<p>Thanx dude :) Thats what I&acute;ve been waiting for a long time :D </p>
<p>Can someone send me the file that is working on a cube. my cube is built but i cant find a code that works with out any errors? The one in this instructable is having a lot of errors and anything with the TLC5940 name is a error or &quot;not decleared in this scope&quot; . CAN SOMEONE PLEASE SEND ME A WORKING CODE. I NEED HELP</p>
<p>If you didnt solve it by yourself: The code is working, you just dont have the tlc5940.h in your Arduino library folder. Download it here: https://code.google.com/p/tlc5940arduino/</p>
<p>Hi , I build your cube on a breadboard (the electronics, not the cube ...). If you connect the red leads to the first tlc, the green to the second and the blue to the third, with ,starting from left to right on the first row of led's, right to left on the second row, left to right on the third row and finally right to left on the last row, then you can map your leds from 0 to 47...hope this make sense...</p>
<p>How are the mosfets suposed to be wired? I have the layer pin to the leftmost pin center pin goes to actual layer and third pin with 2k resistor to 5v</p>
<p>The leftmost pin comes from the ATMEGA328P chip, The center pin goes to the layer and the left pin you have described correctly.</p>
<p>correction</p><p>and the rightmost (3rd) pin you have described correctly.</p>
<p>I can't seem to be able to have different layers on at the same time.</p><p>Any advice?</p>
<p>Which program are you running? RGB_4x4x4_LED_Cube_main_1 is the program that will light up all layers. If you are running RGB_4x4x4_LED_Cube_map_1 then only 1 layer will light up. This is the program that you use to find out the sequence of the LED lights, so that you can reprogram RGB_4x4x4_LED_Cube_main_1.</p>
<p>Hello! I need some help, i've been looking for the zip file which contains the code but I can't find it anywhere, could anyone email me the code? i'll be very thankful.</p>

About This Instructable




Bio: Interested in all kind of projects, mainly electronics but other stuff too! I try t publish everything I make, eventhough this is not always possible ... More »
More by Emiliano Valencia:CNC Wall Mounted Desk DIY Modular Guitar Amp! TinyDice: Professional PCBs at home 
Add instructable to: