All About Circuits Forum  

Go Back   All About Circuits Forum > Circuits and Projects > The Completed Projects Collection

Notices

The Completed Projects Collection A collection of completed projects from All About Circuits forum members. Comment, ask questions, and add to their ideas.

Reply   Post New Thread
 
Thread Tools Display Modes
  #1  
Old 01-21-2013, 08:53 AM
mhutchie1's Avatar
mhutchie1 mhutchie1 is offline
Junior Member
 
Join Date: Jan 2013
Location: Sydney
Posts: 17
Default LED 7x7x7 Cube & Effects Generator

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
Attached Images
File Type: jpg LED_Cube.JPG (192.3 KB, 1217 views)
File Type: jpg LED_Cube_02.JPG (121.0 KB, 1182 views)
File Type: jpg Schematic_Layer.jpg (44.3 KB, 1105 views)
File Type: jpg Schematic_LED.jpg (87.5 KB, 1201 views)

Last edited by mhutchie1; 01-23-2013 at 07:45 AM.
Reply With Quote
The Following 3 Users Say Thank You to mhutchie1 For This Useful Post:
absf (01-22-2013), brian25 (02-12-2014), toffee_pie (03-19-2013)
  #2  
Old 01-21-2013, 11:16 PM
thatoneguy's Avatar
thatoneguy thatoneguy is offline
Senior Member
 
Join Date: Feb 2009
Location: Midwest USA
Posts: 6,356
Blog Entries: 4
Default

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.
Reply With Quote
The Following User Says Thank You to thatoneguy For This Useful Post:
absf (01-22-2013)
  #3  
Old 01-21-2013, 11:53 PM
mhutchie1's Avatar
mhutchie1 mhutchie1 is offline
Junior Member
 
Join Date: Jan 2013
Location: Sydney
Posts: 17
Default

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
Once it has finished this, it loops through reading the other 48 bytes of data, outputting a frame to a cube.

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.
Reply With Quote
The Following User Says Thank You to mhutchie1 For This Useful Post:
absf (01-22-2013)
  #4  
Old 01-22-2013, 12:33 AM
thatoneguy's Avatar
thatoneguy thatoneguy is offline
Senior Member
 
Join Date: Feb 2009
Location: Midwest USA
Posts: 6,356
Blog Entries: 4
Default

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!
Reply With Quote
  #5  
Old 01-22-2013, 12:57 AM
mhutchie1's Avatar
mhutchie1 mhutchie1 is offline
Junior Member
 
Join Date: Jan 2013
Location: Sydney
Posts: 17
Default

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.
Reply With Quote
The Following User Says Thank You to mhutchie1 For This Useful Post:
Markarduino (03-19-2013)
  #6  
Old 01-22-2013, 12:49 PM
MMcLaren's Avatar
MMcLaren MMcLaren is offline
Senior Member
 
Join Date: Feb 2010
Location: Michigan, USA
Posts: 640
Default

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.
Reply With Quote
  #7  
Old 01-22-2013, 01:18 PM
MMcLaren's Avatar
MMcLaren MMcLaren is offline
Senior Member
 
Join Date: Feb 2010
Location: Michigan, USA
Posts: 640
Default

Quote:
Originally Posted by thatoneguy View Post
Excellent code, fast and clever! Compared to some of the code posted for other cubes, it's genius level.
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.
Reply With Quote
  #8  
Old 01-22-2013, 01:44 PM
SPQR SPQR is offline
Senior Member
 
Join Date: Nov 2011
Location: Los Angeles
Posts: 379
Default

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?
Reply With Quote
  #9  
Old 01-22-2013, 06:47 PM
thatoneguy's Avatar
thatoneguy thatoneguy is offline
Senior Member
 
Join Date: Feb 2009
Location: Midwest USA
Posts: 6,356
Blog Entries: 4
Default

Quote:
Originally Posted by MMcLaren View Post
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?
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.
Reply With Quote
  #10  
Old 01-22-2013, 07:35 PM
SPQR SPQR is offline
Senior Member
 
Join Date: Nov 2011
Location: Los Angeles
Posts: 379
Default

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?
Reply With Quote
Reply   Post New Thread

Tags
, , , , ,


Related Site Pages
Section Title
Textbook Semiconductor manufacturing techniques : Solid-state Device Theory


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arduino code Noob Need help Turkish The Projects Forum 8 02-27-2014 02:33 PM
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
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:00 AM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin
Copyright ©2000 - 2014, vBulletin Solutions, Inc.