LED 7x7x7 Cube & Effects Generator

jamieh

Joined Jun 12, 2013
1
any chance of being able to get a copy of the code to make this cube work? I can build the cube with no problems but I am not able to write the program at this stage to get it to work. If you could send me the code so I can test the cube I built that would be greatly appreciated.
 
i'm from indonesia. I am still learning and still lay on microcontroller. can u give me the source code.... please. <snip>
 
Last edited by a moderator:

Art

Joined Sep 10, 2007
806
I hope there's a polycarbonate box for it, otherwise, one day, all that work!
Props to you before I even see the thing running, that is meticulous.
 

Art

Joined Sep 10, 2007
806
Can you draw lines between points locally on the micro controller?
It would use a lot less memory if you can at least draw lines locally,
then you only have to worry about rotating points, and connecting them
with lines once the code is running.
It's also easy to matrix rotate points with a higher level platform,
and use a lot less memory for that data.

But no matter, you are certainly no lazy ass!
 

takao21203

Joined Apr 28, 2012
3,702
There is reundant array access in the loop.
It is not changing, only mask is iterated.
Move it outside the loop.

Have you thought of variable brightness for each LEDs?

I made one 768 LEDs matrix with 8 controllers since it is a lot of effort to do brightness in software. 16 levels are possible, 4 bits for each LEDs.

The lines are stored compressed (4 bits each LED), then they are expanded for faster access.
 

spankman

Joined Dec 8, 2013
1
I recently finished constructing and programming a 7x7x7 Blue LED Cube, so I thought I'd share a brief overview of the Cube itself. Please ask any questions if you are interested in making a cube, hopefully I can help you out.



Parts List:
• 343x Blue LED’s
• 49x 470 Ohm Resistors
• 7x 2N2222AG Transistors
• Approximately 30m of 0.9mm galvanised steel wire
• 1x Arduino Mega 2560

Equipment Used:
• Soldering Iron
• Heatsink
• Pliers
• Multimeter
• Vice

Software Used:
• Arduino Development Platform
• Processing (Used to design the frames & effects)

The cube is able to process 142 frames per second, that is, 1 frame every 7 milliseconds. Within this time period, it loops through a still frame 7 times (Each cycle of POV lasts 144 microseconds). This is able to compensate for flickering during video recording, allowing all camera’s to record fluid video without distortion.

The cube itself is controlled with an Arduino Mega 2560. For each frame in memory, the Arduino reads and bit shifts 49 bytes of data for an encoded duration. This allows for the cube to be applied to a variety of purposes, from text display to effects to music visualization.

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

The frames were generated through complex Processing scripts, allowing for a multitude of operations such as shifting in any direction (seen in the rain effect), and an edge shift (seen in the scrolling text around the outside of the cube). These scripts were used to perform the basis of calculations for fireworks, as well as sine waves in 1, 2 & 3 dimensions (seen in the video).



In this cube the supporting structure was made 0.9 mm galvanized steel wire, straightened by stretching the wire. The 5mm Blue LED’s are positioned 30mm apart, with the anodes being attached to the verticals (white wires in the image above) & the cathodes are attached to the horizontal layers (green wires in the image above – bottom right – shown passing through NPN transistors). The Arduino Mega 2560 R3 is positioned on a suspended platform, with the anodes controlled on the Digital Pins as opposed to the cathodes on remapped Analog Inputs.

As the cube is divided into layers (shown in the schematics) I made a template with drill pressed holes that I could fit the 49 LED's in with a spacing of 30mm while soldering the layer. By using a template, the LED's were aligned consistently. On the wooden template, I attached several lugs that allowed me to position the structural layers consistently and accurately. Soldering the layers took me approximately 6 hours, as all of the LED's legs need to be bent to attach to the structure.

I then made a jig out of foam that allowed me to join the first two layers. Layers are joined by soldering vertical straight pieces of galvanised wire to the anodes of the LED's. Once I had done two layers, I shifted the jig up a layer, and mounted the next layer until I had joined all seven layers.



The vertical wires (49 of them) attach to the Arduino on Digital Pins 0-48 directly, shown in the above schematic. At this stage, you essentially have a 2D display with 49 pixels.

To add the third dimension, a small circuit is required (shown below), which uses seven transistors (one for each layer) to connect the cathodes to ground in sequence, so a 1 pixel resolution is the result. This could be done through an IC, however I opted for a small prototyping board, which has seven transistors (I used 2N2222AG - High Speed). The emitters of these transistors are wired to a common ground on the Arduino Mega 2560, each collector is connected to one of the layers, and then the base's are connected to the Arduino's Analog Pins A0-A6.



Please feel free to ask any question, I more than happy to help!

Hutchie

there might be someone on this forum who has a code for me ?
 

Thread Starter

mhutchie1

Joined Jan 21, 2013
17
Sorry for the extremely long delay, but my HSC school work has been my focus all year

Attached is a version of the Arduino side code that was almost the final version, however this version best displays the logic within the code itself to achieve the correct multiplexing.

View attachment LED_Cube_Serial.zip

The program on the computer side is not available for upload, however all it is essentially doing is outputting a series of 49 bytes to be stored in the array "myFrames".
 

Gadmek

Joined Jan 3, 2014
1
I've been looking at building an arduino cube for a while now, I haven't really messed with an arduino yet.

would a loop speed it up a bit since it'd be going through less code?

If you start a loop before digital write High, and end the loop after the digital write low.
increase the pin by 1 each loop, and increase the layer check by 7


something like this maybe? (or I may have not noticed something else changing , it just looked like something that a loop would work on)

Rich (BB code):
else{
int layercount = 0;
for (int Anum = 0; Anum < 7; Anum++){
      layercount = layercount + 7; //increase layer by 7
      digitalWrite(Anum,HIGH);
      bitcycle=0;
      for (int layerInternal = 0; layerInternal<=6;layerInternal++){
          for (byte mask = 1; mask>0; mask <<= 1) { //iterate through bit mask
              if (myFrames[layerInternal + layercount] & mask){ // if bitwise AND resolves to true
                  digitalWrite(myPins[bitcycle],HIGH);
              }
              bitcycle++;
          }
          bitcycle=bitcycle-1;  
      }  
      delay(1);
      bitcycle=0;
      for (int layerInternal = 0; layerInternal<=6;layerInternal++){
          for (byte mask = 1; mask>0; mask <<= 1) { //iterate through bit mask
              if (myFrames[layerInternal + layercount] & mask){ // if bitwise AND resolves to true
                  digitalWrite(myPins[bitcycle],LOW);
              }
              bitcycle++;
          }
          bitcycle=bitcycle-1;  
      } 
      digitalWrite(Anum,LOW);
}
}
 
perfect, I missed the part where they Resistances Connected, you can put in 220hom, and if come upstairs An image With flat or very serious Useful diagram and connections between the anodes and cathodes Ranging Way the adruino thanks.

and if it's too much trouble could you provide me some codes that I'm doing this project and I need mismito pormultimo more detailed information and to schedule program that utilizastes IDE adruino? thanks
 
the code u provided I guessing is a flat sheet to create own frames from I noticed all zeros so I change to binary to suite am I right could u please post example frame to work from as a bases
 

rleigh

Joined Nov 15, 2013
2
I will have my cube completed next week and have followed your design. I'm hoping that you have not given up on the project and can provide the code and program that you have used to design your animations. I'm learning to program but my way of learning is taking someone elses information and reverse engineering it to help me understand how to get the results.

Please provide what is needed to get the results that we see in your video.

Thanks and happy holidays!!
 

takao21203

Joined Apr 28, 2012
3,702
the code is extremly inefficient since array access is costly.

the index doesnt change inside the inner loop, and bitcycle also doesnt change. Move it out of the inner loop.

myFrames[layerInternal + layercount] can be converted to a pointer for the nextmost outer loop, then you just increment this pointer by one. Its faster.

Maybe the Atmel chip has suitable instructions for array access? Anyway, instead of
digitalWrite(myPins[bitcycle],LOW);

you should "write" into a uchar (byte) variable, then output the whole 8 bits. Saves you the function call 8 time + array indexing.

Inefficient C can be very slow.
 

rleigh

Joined Nov 15, 2013
2
Looks like the OP has abandoned this project. :( Guess I shouldn't have designed my cube around a project that hasn't released the source to get it going as demonstrated.

I was hoping to use this platform to learn some coding with my Arduino Mega. Can anyone point me to another source that I can get my 7x7x7 cube up and running? I'm afraid I should have built a 8x8x8 as it seems to be more common out there on the interweb. This one attracted me because I already had everything to make it. Thanks for any guidance that might help me get some animations going on my cube.
 

pedro147

Joined Jan 1, 2013
52
rleigh - Have you tried the Arduino form http://forum.arduino.cc/ I am a member there and they are a helpful and smart bunch of guys and a few girls:cool: I would think that you might be able to adapt some cube code that is available to start to learn how to program your cube. Good luck.
 
Top