6x6x6 LED CUBE

Hey, I just recently created a 6x6x6 cube and have no inspiration for pattern designs. If any of you out there are feeling creative maybe you can help me out :slight_smile:

Here’s the dummy code:
B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000,
B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000,
B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000,
B000000, B000000, B000000, 0,
Thanks!

Edit:
Okay, so in B000000 each zero represents a row. Since the cube is 6x6x6 each of the 6 rows contains 36 LEDS. So that’s why there is 36 "B000000"s.
I am currently using a mega arduino to power the cube, its pretty much the same as 4x4x4 cube (http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/) except i modified the code.
Here is that code in case your wondering:

//Modified code for Arduino_6x6x6_led_cube


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

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

// LED Pattern Table in PROGMEM - last column is display time in 100ms units
// TODO this could be a lot more compact but not with binary pattern representation
prog_uchar PROGMEM PatternTable[] = {
// blink on and off

B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, 
B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, 
B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, 
B000000, B000000, B000000, 10,
B111111, B111111, B111111, B111111, B111111, B111111, B111111, B111111, B111111, B111111, B111111, 
B111111, B111111, B111111, B111111, B111111, B111111, B111111, B111111, B111111, B111111, B111111, 
B111111, B111111, B111111, B111111, B111111, B111111, B111111, B111111, B111111, B111111, B111111, 
B111111, B111111, B111111, 10,

// this is a dummy element for end of table (duration=0) aka !!!DO NOT TOUCH!!! //MAKE 36 FOR 6x6x6
B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, 
B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, 
B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, 
B000000, B000000, B000000, 0};

/*
** Defining pins in array makes it easier to rearrange how cube is wired
** Adjust numbers here until LEDs flash in order - L to R, T to B
** Note that analog inputs 36-41 are also digital outputs 0-35!
** Pin DigitalOut0 (serial RX) and AnalogIn5 are left open for future apps
*/

int LEDPin[] = {13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 14, 15, 16, 17, 32, 33, 34, 35, 36, 37, 40, 41, 42, 43, 44, 45, 48, 49, 50, 51, 52, 53};
int PlanePin[] = {A0, A1, A2, A3, A4, A5};

// 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
}

Hopefully that will help :slight_smile:

You have a byte per LED? Arranged how?

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

1,7,13,19,25,31, 2,8,14,20,26,32, 3,9,15,21,27,33, 4,10,16,22,28,34, 5,11,17,23,29,35

Something different? Each byte represents a column? A Row?

Give us some more info. How you sending the data? Are you using ShiftRegisters?

How would you code look like for lighting up just 1 led, rows, columns, floors?

Let me know, I probably can help you, I made a 3x3x3 one :P

Bump

Bump? You've not answered the responses given.

CrossRoads: Bump? You've not answered the responses given.

LOL Exactly, don't bump, give us that info.

It's impossible to program animations for you, if we don't know how you have thing wired-up, if you have any basic code already or anything.

It's not the same to program a Cube connected directly to an Arduino Mega, or one using ShiftRegisters.

Is it common anode, common cathode, multiplexed, charlyplexed, and so on...

Maybe you could start with something simpler:

http://www.instructables.com/id/1x1x1-LED-Cube/

:D

My layer arrangement is: 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 14, 15, 16, 17, 32, 33, 34, 35, 36, 37, 40, 41, 42, 43, 44, 45, 48, 49, 50, 51, 52, 53

CrossRoads: You have a byte per LED? Arranged how?

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

1,7,13,19,25,31, 2,8,14,20,26,32, 3,9,15,21,27,33, 4,10,16,22,28,34, 5,11,17,23,29,35

Something different? Each byte represents a column? A Row?

Ok, I saw the code now. I'll try to sketch something ;)

Hello, well finally I had some time.

This is just a minor test, so I can be sure to understand how your cube works. Confirm me if this code is making what I describe on it.

If it does, I'll go on with more complex animations, otherwise, correct me on how I should arrange columns and rows...

By the way, on B000000, let's say I send B100000 it turns on led on top floor, or at the bottom? Thanks.

Change the delays if needed, I'm not sure how fast or slow is a "10", is that 1 second?

Rows from back to front
Columns from left to right

* * * * * * R1
* * * * * * R2
* * * * * * R3
* * * * * * R4
* * * * * * R5
* * * * * * R6
C C C C C C
1 2 3 4 5 6

// LED Pattern Table in PROGMEM - last column is display time in 100ms units
// TODO this could be a lot more compact but not with binary pattern representation
prog_uchar PROGMEM PatternTable[] = {
// The Wall

//Start all OFF
B000000, B000000, B000000, B000000, B000000, B000000, //R1
B000000, B000000, B000000, B000000, B000000, B000000, //R2
B000000, B000000, B000000, B000000, B000000, B000000, //R3
B000000, B000000, B000000, B000000, B000000, B000000, //R4
B000000, B000000, B000000, B000000, B000000, B000000, //R5
B000000, B000000, B000000, B000000, B000000, B000000, //R6
10,



//Let's turn on all the left side of the cube and move it like a wall, from left to right
//Step 1
B111111, B000000, B000000, B000000, B000000, B000000, //R1
B111111, B000000, B000000, B000000, B000000, B000000, //R2
B111111, B000000, B000000, B000000, B000000, B000000, //R3
B111111, B000000, B000000, B000000, B000000, B000000, //R4
B111111, B000000, B000000, B000000, B000000, B000000, //R5
B111111, B000000, B000000, B000000, B000000, B000000, //R6
10,

//Step 2
B000000, B111111, B000000, B000000, B000000, B000000, //R1
B000000, B111111, B000000, B000000, B000000, B000000, //R2
B000000, B111111, B000000, B000000, B000000, B000000, //R3
B000000, B111111, B000000, B000000, B000000, B000000, //R4
B000000, B111111, B000000, B000000, B000000, B000000, //R5
B000000, B111111, B000000, B000000, B000000, B000000, //R6
10,

//Step 3
B000000, B000000, B111111, B000000, B000000, B000000, //R1
B000000, B000000, B111111, B000000, B000000, B000000, //R2
B000000, B000000, B111111, B000000, B000000, B000000, //R3
B000000, B000000, B111111, B000000, B000000, B000000, //R4
B000000, B000000, B111111, B000000, B000000, B000000, //R5
B000000, B000000, B111111, B000000, B000000, B000000, //R6
10,

//Step 4
B000000, B000000, B000000, B111111, B000000, B000000, //R1
B000000, B000000, B000000, B111111, B000000, B000000, //R2
B000000, B000000, B000000, B111111, B000000, B000000, //R3
B000000, B000000, B000000, B111111, B000000, B000000, //R4
B000000, B000000, B000000, B111111, B000000, B000000, //R5
B000000, B000000, B000000, B111111, B000000, B000000, //R6
10,

//Step 5
B000000, B000000, B000000, B000000, B111111, B000000, //R1
B000000, B000000, B000000, B000000, B111111, B000000, //R2
B000000, B000000, B000000, B000000, B111111, B000000, //R3
B000000, B000000, B000000, B000000, B111111, B000000, //R4
B000000, B000000, B000000, B000000, B111111, B000000, //R5
B000000, B000000, B000000, B000000, B111111, B000000, //R6
10,

//Step 6
B000000, B000000, B000000, B000000, B000000, B111111, //R1
B000000, B000000, B000000, B000000, B000000, B111111, //R2
B000000, B000000, B000000, B000000, B000000, B111111, //R3
B000000, B000000, B000000, B000000, B000000, B111111, //R4
B000000, B000000, B000000, B000000, B000000, B111111, //R5
B000000, B000000, B000000, B000000, B000000, B111111, //R6
10,


//Let's go back

//Step 7
B000000, B000000, B000000, B000000, B000000, B111111, //R1
B000000, B000000, B000000, B000000, B000000, B111111, //R2
B000000, B000000, B000000, B000000, B000000, B111111, //R3
B000000, B000000, B000000, B000000, B000000, B111111, //R4
B000000, B000000, B000000, B000000, B000000, B111111, //R5
B000000, B000000, B000000, B000000, B000000, B111111, //R6
10,

//Step 8
B000000, B000000, B000000, B000000, B111111, B000000, //R1
B000000, B000000, B000000, B000000, B111111, B000000, //R2
B000000, B000000, B000000, B000000, B111111, B000000, //R3
B000000, B000000, B000000, B000000, B111111, B000000, //R4
B000000, B000000, B000000, B000000, B111111, B000000, //R5
B000000, B000000, B000000, B000000, B111111, B000000, //R6
10,

//Step 9
B000000, B000000, B000000, B111111, B000000, B000000, //R1
B000000, B000000, B000000, B111111, B000000, B000000, //R2
B000000, B000000, B000000, B111111, B000000, B000000, //R3
B000000, B000000, B000000, B111111, B000000, B000000, //R4
B000000, B000000, B000000, B111111, B000000, B000000, //R5
B000000, B000000, B000000, B111111, B000000, B000000, //R6
10,

//Step 10
B000000, B000000, B111111, B000000, B000000, B000000, //R1
B000000, B000000, B111111, B000000, B000000, B000000, //R2
B000000, B000000, B111111, B000000, B000000, B000000, //R3
B000000, B000000, B111111, B000000, B000000, B000000, //R4
B000000, B000000, B111111, B000000, B000000, B000000, //R5
B000000, B000000, B111111, B000000, B000000, B000000, //R6
10,

//Step 11
B000000, B111111, B000000, B000000, B000000, B000000, //R1
B000000, B111111, B000000, B000000, B000000, B000000, //R2
B000000, B111111, B000000, B000000, B000000, B000000, //R3
B000000, B111111, B000000, B000000, B000000, B000000, //R4
B000000, B111111, B000000, B000000, B000000, B000000, //R5
B000000, B111111, B000000, B000000, B000000, B000000, //R6
10,

//Step 12
B111111, B000000, B000000, B000000, B000000, B000000, //R1
B111111, B000000, B000000, B000000, B000000, B000000, //R2
B111111, B000000, B000000, B000000, B000000, B000000, //R3
B111111, B000000, B000000, B000000, B000000, B000000, //R4
B111111, B000000, B000000, B000000, B000000, B000000, //R5
B111111, B000000, B000000, B000000, B000000, B000000, //R6
10,

//And we turn it off
B000000, B000000, B000000, B000000, B000000, B000000, //R1
B000000, B000000, B000000, B000000, B000000, B000000, //R2
B000000, B000000, B000000, B000000, B000000, B000000, //R3
B000000, B000000, B000000, B000000, B000000, B000000, //R4
B000000, B000000, B000000, B000000, B000000, B000000, //R5
B000000, B000000, B000000, B000000, B000000, B000000, //R6
10,



// this is a dummy element for end of table (duration=0) aka !!!DO NOT TOUCH!!! //MAKE 36 FOR 6x6x6
B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, 
B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, 
B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, B000000, 
B000000, B000000, B000000, 0
};

CrossRoads:
You have a byte per LED? Arranged how?

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

1,7,13,19,25,31,
2,8,14,20,26,32,
3,9,15,21,27,33,
4,10,16,22,28,34,
5,11,17,23,29,35

Something different?
Each byte represents a column? A Row?

I have a 4x4x4 LED cube and i connected it an arduino uno can some one Please help me
i don’t know anything about writing codes and i want to know how can I control it using the “B0000” method

Any help would be really, really appreciated!!
I’m stuck here…

Connected:
column a1-13
" a2-12
" a3-11
" a4-10
" b1-9
" b2-8
" b3-7
" b4-6
" c1-5
" c2-4
" c3-3
" c4-2
" d1-1
" d2-0
" d3-A5
" d4-A4
layer 4-A3
layer 3-A2
layer 2-A1
layer 1-A0