![]() |
|
|||||||
| The Completed Projects Collection A collection of completed projects from All About Circuits forum members. Comment, ask questions, and add to their ideas. |
|
|
|
Thread Tools | Display Modes |
|
#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 LEDs 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 cameras 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 LEDs 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 Last edited by mhutchie1; 01-23-2013 at 07:45 AM. |
| The Following 2 Users Say Thank You to mhutchie1 For This Useful Post: | ||
absf (01-22-2013), toffee_pie (03-19-2013) | ||
|
#2
|
||||
|
||||
|
7 is an odd number for a cube (and a prime, and...)
![]() Could you go into details about the bit shifting in the frame buffer for the animations? That is the part that few have documented for cubes above 4x4 (nibble math). It's nice to see a solidly built/professional looking project here. I'm also interested in the processing code to create the animations. That would be a goldmine to save work so others can get the project up and running to create new animations as well.
__________________
Bypass Caps! Read Me Also-Impedance Graph paper. |
| The Following User Says Thank You to thatoneguy For This Useful Post: | ||
absf (01-22-2013) | ||
|
#3
|
||||
|
||||
|
Dimensions:
The reason for the cube being 7x7x7 is that effects in general (spirals, text etc.) work much better when there is a true center LED, as it forms an origin for all effects. Similarly text looks far better when the vertical height is an odd number, as you have a "middle line" for letters like "E", B", etc. Bit shifting: To significantly reduce the amount of data required to display the cube (speeding up the running of the script), bit shifting can be used as an extremely effecient method. Basically what happens is I have defined that there are 49 rows of 7 leds (across all layers), so if you use a byte to store data for a single row, you have 7 bits (0100101) representing the value of each LED, and one left over bit, which can be used as a validation bit (1). In the example above I can have the decimal 75, representing the status of that row, along with 48 other bytes of data. The arduino runs on a constant loop, reading these bytes, and then converting it into binary. When it then has the binary, it compares 0100101 to 0000001, and realises that the seventh byte is "on", therefor turning the LED on. It then does the bit shift (in this case to the left) and compares 0100101 to 0000010, it detects it should be of, and then starts the cycle again. By using the for loop shown in the code extract below, it will continue to do this until it has read the 7 bits values and outputted them to the cube. Code:
for (byte mask = 1; mask>0; mask <<= 1) { //cycle through bit mask
if (myFrames[i][layerInternal] & mask){ // if bitwise AND resolves to true
digitalWrite(myPins[bitcycle],HIGH);
}
bitcycle++;
}
Select All
Finally, the 50th byte in the 2D array for each frame stores the number of milliseconds the frame will last. Effect generation: In terms of pattern and effect generation, the scripts that generate it are very much dependent of the exact effect that you would like to achieve, for example, for the sine wave, and fireworks, the scripts that I have written would have to accommodate a far wider range of variables to suite individuals preferences for the effects. That being said, i have already started working on this and will hopefully develop this over the next few weeks. |
| The Following User Says Thank You to mhutchie1 For This Useful Post: | ||
absf (01-22-2013) | ||
|
#4
|
||||
|
||||
|
Excellent code, fast and clever! Compared to some of the code posted for other cubes, it's genius level.
If you could post the complete code and the processing script (I'm getting started with Processing since there are questions about it from time to time), that would be most awesome. Thanks for sharing!
__________________
Bypass Caps! Read Me Also-Impedance Graph paper. |
|
#5
|
||||
|
||||
|
As I only finished this two days ago, I am just commenting and cleaning up the code, so I will post it in the not to distant future.
|
| The Following User Says Thank You to mhutchie1 For This Useful Post: | ||
Markarduino (03-19-2013) | ||
|
#6
|
||||
|
||||
|
Hi mhutchie1,
It's a work of art before you even turn it on (lol)... Would I be correct in assuming your program is basically a small sequencer and that the majority of program memory space is simply the sequence (frame) arrays? Last edited by MMcLaren; 01-22-2013 at 02:14 PM. |
|
#7
|
||||
|
||||
|
Really? Is that 343 bit write operations per frame? Does Arduino force you to write individual bits only? Is there no way to write multiple bits directly to a port?
Last edited by MMcLaren; 01-22-2013 at 01:33 PM. |
|
#8
|
|||
|
|||
|
What an absolutely beautiful piece of work.
Congratulations! The YouTube is great - did you sync the music beat to the LED movement or just time it to the beat? |
|
#9
|
||||
|
||||
|
A lot of code posted is a large number of digitalWrite[Pin]; delay(xx); code (generated from a animation they like), no framebuffer. You can write to an entire port, but the layout of the boards makes that a bit hard to implement. The "Digital" side on Arduino Leonardo has 14 I/O, which are combined from various pins from ports B, D and E, which does make port writes a bit messy.
__________________
Bypass Caps! Read Me Also-Impedance Graph paper. |
|
#10
|
|||
|
|||
|
Could you describe the connections between the wires and the LEDs, or show us a close-up?
How are the wires insulated from each other? |
|
| Tags |
| arduino, cube, effects, generator, led, led cube |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help designing analog filter designs for an audio activated 8x8x8 LED cube | mp4nerd | The Projects Forum | 6 | 12-01-2012 11:29 PM |
| Help figuring out appropriate transistor for LED Cube | jerseyguy1996 | General Electronics Chat | 7 | 01-15-2012 11:56 PM |
| Arduino code Noob Need help | Turkish | The Projects Forum | 7 | 09-03-2010 05:36 AM |
| led cube | elimenohpee | The Projects Forum | 1 | 03-07-2009 08:56 PM |
| Bicycle Bottle Generator for LED Rope Light | YoloMike | The Projects Forum | 1 | 02-11-2009 12:17 AM |
| Thread Tools | |
| Display Modes | |
|
|