Building An 8x8x8 LED Cube

Program Download:

Arduino Sketches
Arduino_8x8x8_Cube.pde
Pyroelectro_8x8x8.pde
The Software
           The software for running a static program on the 8x8x8 is pretty darn complex. But for the most part it consists of two portions:

    -LED Cube Updating via Interrupt
    -Main Loop LED Scheme Execution

           It's simply impossible to describe everything that the software is doing (thanks to CHR from instructables for writing this software!) in this project on a single webpage so I'll just skim over what I think are the most important parts. Starting with the LED updating algorithm. In order to keep the cube up to date, we need to be constantly updating each of the 8 layers to represent changes we might have made to how things should be lit up. To do that we keep specific timing using timer interrupts and constantly updating code.

LED Cube Updating via Interrupt

------------« Begin Code »------------
ISR (TIMER2_COMPA_vect)
{
  int i;
  
  // all layer selects off
  PORTC = 0x00;
  PORTB &= 0x0f;
  
  PORTB |= 0x08; // output enable off.
  
  for (i=0; i<8; i++)
  {
    PORTD = cube[current_layer][i];
    PORTB = (PORTB & 0xF8) | (0x07 & (i+1));
  }
  
  PORTB &= 0b00110111; // Output enable on.
  
  if (current_layer < 6)
  {
    PORTC = (0x01 << current_layer);
  } else if (current_layer == 6)
  {
    digitalWrite(12, HIGH);
  } else
  {
    digitalWrite(13, HIGH);
  }
  
  current_layer++;
  
  if (current_layer == 8)
    current_layer = 0;
}
------------« End Code »------------

           Once you have the LED updating scheme working you can start having fun. Back in the main loop you can now tell the cube which LEDs to light up and where and they'll do exactly that. If you look through the code you can see some unique programs and functions that CHR has written as examples of what the 8x8x8 cube can do:

Main Loop LED Scheme Execution

------------« Begin Code »------------
void loop()
{
  int i,x,y,z;
  
  while (true)
  {
    
    effect_planboing(AXIS_Z, 400);
    effect_planboing(AXIS_Y, 400);
    effect_planboing(AXIS_X, 400);
    
    effect_blinky2();
    
    effect_random_filler(75,1);
    effect_random_filler(75,0);
    
    effect_rain(100);
   
    effect_boxside_randsend_parallel (AXIS_X, 0, 150, 1);
    effect_boxside_randsend_parallel (AXIS_X, 1, 150, 1);
    effect_boxside_randsend_parallel (AXIS_Y, 0, 150, 1);
    effect_boxside_randsend_parallel (AXIS_Y, 1, 150, 1);
    effect_boxside_randsend_parallel (AXIS_Z, 0, 150, 1);
    effect_boxside_randsend_parallel (AXIS_Z, 1, 150, 1);
    
  }
}
------------« End Code »------------

           Anyway, the software is done and everyone is eager to see this thing in action so let's take a look at what it can do next in the results section, go go go!