7x7x7 LED cube with arduino

So, Over the past few days I have been building a 7x7x7 LED cube...
I made a jig out of birch which was a major help
My father helped me out with this which was nice for a change having the extra hands there not only made the project go faster but look nicer too.
Sorry the code is so short. I was just so excited that it worked I had to show you all..
I did this with a arduino Mega card and nine 7407 TTL dip chips... watch my video and I hope you enjoy!



Quite awesome!

Wanna share source-code? :wink:

Pretty ambitious prototype, did you start off first with the 7XXX goal or did you try out something smaller first? Do you plan on converting that solder-less breadboard driver set-up with a more permanent build? I would like someday to build something like this for the grand daughter but I think 4XXX would be enough for me :wink: I mostly worry about how to make interesting patterns in software possible, that part scares me a little and when you get down to it that is the heart of the application not all the hardware and wires.

Lefty

i will post up my code tomorrow... just remember its just a test pattern so not to impressive.. and its really hard to right all those 0s and 1s... 8 letters/numbers 49 times blows...

I am currently working on putting my breadboard work on a PCB but I am really slow at that... i will have more pictures after next friday. If you go back to the youtube you can see all my videos. I started with a 2x2x2 and then 3x3x3, and then 4x4x4 and said what the heck its time to do 7x7x7.... and it worked so well I could not be happier... Well I take that back I wish I used blue or green LEDs. this is all going into a nice box and I plan on putting plexyglass around it...

some updated pictures... putting all of it on a perfboard and making a nice box/stand for the cube...


this is my code. I couldnt put the pattern in because its extremly large even for one simple pattern. if you would like my full test code. email me at stephenleckemby@hotmail.com and ill send it to you!!!

#include <avr/pgmspace.h>        // allows use of PROGMEM to store patterns in flash

#define CUBESIZE 7
#define PLANESIZE CUBESIZE*CUBESIZE
#define PLANETIME 3333          // time each plane is displayed in us -> 100 Hz refresh
#define TIMECONST 25           // multiplies DisplayTime to get ms - why not =100?

// LED Pattern Table in PROGMEM - last column is display time in 100ms units
prog_uchar PROGMEM PatternTable[] = {

  // for copy and paste  (duration=0)
  B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, B0000000, 0,  



};

  //the B1000000 the 1 is the first led on the left column bottom row when looking at the front if wired in reverse... Cube 1 is forward. 7x7x7 is reverse
  //pins 54 and 55 are anoalog pins 0 and 1
int LEDPin[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 ,44, 45, 46, 47, 48};
int PlanePin[] = {49, 50, 51, 52, 53, 54, 55};

// initialization
void setup()
{
  int pin;      // loop counter
  // set up LED pins as output (active HIGH)
  for (pin=0; pin<PLANESIZE; pin++) {
    pinMode( LEDPin[pin], OUTPUT );
  }
  // set up plane pins as outputs (active LOW) 
  for (pin=0; pin<CUBESIZE; pin++) {
    pinMode( PlanePin[pin], OUTPUT );
  }
}

// display pattern in table until DisplayTime is zero (then repeat)
void loop()
{
  // declare variables
  byte PatternBuf[ PLANESIZE ];      // saves current pattern from PatternTable
  int PatternIdx;
  byte DisplayTime;        // time*100ms to display pattern
  unsigned long EndTime;
  int plane;      // loop counter for cube refresh
  int patbufidx;   // indexes which byte from pattern buffer
  int ledrow;    // counts LEDs in refresh loop
  int ledcol;    // counts LEDs in refresh loop
  int ledpin;    // counts LEDs in refresh loop

  // Initialize PatternIdx to beginning of pattern table
  PatternIdx = 0;
  // loop over entries in pattern table - while DisplayTime>0
  do {
    // read pattern from PROGMEM and save in array
    memcpy_P( PatternBuf, PatternTable+PatternIdx, PLANESIZE );
    PatternIdx += PLANESIZE;
    // read DisplayTime from PROGMEM and increment index
    DisplayTime = pgm_read_byte_near( PatternTable + PatternIdx++ );    
    // compute EndTime from current time (ms) and DisplayTime
    EndTime = millis() + ((unsigned long) DisplayTime) * TIMECONST;

    // loop while DisplayTime>0 and current time < EndTime
    while ( millis() < EndTime ) {
      patbufidx = 0;    // reset index counter to beginning of buffer
      // loop over planes 
      for (plane=0; plane<CUBESIZE; plane++) {
        // turn previous plane off
        if (plane==0) {
          digitalWrite( PlanePin[CUBESIZE-1], HIGH );
        } else {
          digitalWrite( PlanePin[plane-1], HIGH );
        }

        // load current plane pattern data into ports
        ledpin = 0;
        for (ledrow=0; ledrow<CUBESIZE; ledrow++) {
          for (ledcol=0; ledcol<CUBESIZE; ledcol++) {
            digitalWrite( LEDPin[ledpin++], PatternBuf[patbufidx] & (1 << ledcol) );
          }
          patbufidx++;
        } 

        // turn current plane on
        digitalWrite( PlanePin[plane], LOW );
        // delay PLANETIME us
        delayMicroseconds( PLANETIME );
      }    // for plane
    }    // while <EndTime
  } while (DisplayTime > 0);        // read patterns until time=0 which signals end
}

looks great!

A bit OT: what's the song in your YouTube-video?

cheers, Otacon2k

the song is by justice called genesis they are kind of like daft punk

thanks for the comments

Hey There,

Inspiring work!

This is tony from youtube that asked you about the shift registers.

How many of the Mega's pins are you using for you 7x7x7? How do they 7407's work? I'm just starting out with this so I'm trying to make the most sense of it all.

thanks,

tony

there are 49 anodes... they connect to pins 0-48 on the mega... there are 7 cathodes which connect to 49-55 on the mega... but in the middle of that are nine 7407... if you have a true input you get a true output... the chip has a VCC of 5.5 volts, and a ground... so you put resisters in-between the output and the anode, causing the arduino mega to barely have to work... the chips do all the power... there are easier ways of doing this I guess, but I am still new at this.. and really have no clue how to use a shift register.

Thanks for taking the time to explain all of that. I don't know how to use shift registers (yet!) but I ordered 10 of them from china via ebay. I saw the most common used was the 74HC595. I'm just trying to get all of my potential parts together to do this thing.

Also, what do you think is the best kind of LED to use? Diffused? I found one guy who dipped his in wax, was very cool! I don't think water clear would work as well. Did you go with the amber bulbs because that's what you had? I saw some with RGB bulbs, but this is way harder to wire up.

Also (sorry about all of the questions) do you think making the LED's physically closer together might make it look better? I'm thinking a higher dpi would make it look nicer.

Tony

PS .... very clean shop! I would be embarrassed to show my workbench.

PS .... very clean shop! I would be embarrassed to show my workbench.

He probably cleaned it up just for the photos :wink: Real men don't do 'neat/organized shops' :sunglasses:

Lefty

choose whatever LEDs appeal to you the most! I chose orange with red by accident! I know would have liked to do blue or green!

and thanks for the compliments on the work area! thats my dads super garage haha! I flew home to visit and do some hard labor around his house with him, and he let me use his tools, and also was a great helping hand seeing how he has many many years of electrical knowledge.

this is really awesome!
I am working on something very similar. I might have to use the code you provided

That looks amazing!
I wish I could build something like that, I just don't have the time
or money. Very cool effects!

hahaha I know im about a year and a half late but this project really interests me i was wondering if you had an updated source code you would like to share

thanks alot
keep up the good work