Making a 4x4x4 LED Cube with kid, he's doing the soldering and animations if I get the set/clear voxel, line and plane basic functions written.
Addresses for each of the 64 LEDs are in an 8 byte array. Each LED is 3mm Teal (Blue/Green) and 1" apart in all directions from nearest neighbor. Common cathode driven, a transistor switches on the cathode for each layer when it is written to, then switches it off while next layer is on.
Does anybody know if a nifty transformation to flip the correct bit / voxel when setvoxel(2,1,1) or clrvoxel (1,3,2) is called?
I'd like to do is along these lines, except with 4 arrays of 16 bits.
Below is for a tiny 2x2x2 cube, lightning fast.
framebuffer on 2x2x2 cube is: yyxxyyxx First set of y's is top level, second set of ys is lower level, same with first/second set of x's.
I was thinking of simply making Z a 2 byte array for xy, unsure of layout of array at the moment. A different Z array for each vertical "layer" and using shift functions.
Interrupt sets outputs/display, lower nibble on first call to interrupt, high nibble on second call to interrupt, redraw is 130 times/second on 4Mhz internal oscillator with no glitches.
This works with a one byte array to put the x and y in the right spot, has anybody worked with this to scale to 4x4x4 or 8x8x8?
Once I figure out the fastest set/clear voxel routines, drawline and plane(x,y,z) functions will be next. Undecided on vector/wireframe operations.
Platform: PIC 16F690@4Mhz code written in Sourceboost BoostC. Will probably switch to 8Mhz for 4x4x4 cube, the 2x2x2 could run at 1Mhz without glitches, but it is just one byte being dealt with.
So far I never realized cool animations could be made with 8 LEDs in 3 dimensions.
For an 8x8x8, may go to an 18F for more I/O on an 8x8x8, or use I2C LED Drivers to shift data into while sticking with the 16F690
There are lots of examples of these on Youtube, from 4 to 15 LED cubes, once past 10 LEDs per side, they get really awesome looking, especially when made with RGB.
Addresses for each of the 64 LEDs are in an 8 byte array. Each LED is 3mm Teal (Blue/Green) and 1" apart in all directions from nearest neighbor. Common cathode driven, a transistor switches on the cathode for each layer when it is written to, then switches it off while next layer is on.
Rich (BB code):
4x4x4 LED Cube
Z-axis 0,0,3
^
| / Y-axis 0,3,0
| /
| /
| /
|/__________> X-axis
0,0,0 3,0,0
I'd like to do is along these lines, except with 4 arrays of 16 bits.
Below is for a tiny 2x2x2 cube, lightning fast.
Rich (BB code):
temp=1 ;for setvoxel (0 for clrvoxel)
temp <<x*1; // Shift left 0 or 1 times if x is 0 or 1
temp <<(y+2)*2; // Shift left 0 or 2 times if y is 0 or 1
temp << z*4; // Shift left 0 or 4 times if z is 0 or 1
framebuffer=framebuffer & temp; //Change only the requested bit via AND
I was thinking of simply making Z a 2 byte array for xy, unsure of layout of array at the moment. A different Z array for each vertical "layer" and using shift functions.
Interrupt sets outputs/display, lower nibble on first call to interrupt, high nibble on second call to interrupt, redraw is 130 times/second on 4Mhz internal oscillator with no glitches.
This works with a one byte array to put the x and y in the right spot, has anybody worked with this to scale to 4x4x4 or 8x8x8?
Once I figure out the fastest set/clear voxel routines, drawline and plane(x,y,z) functions will be next. Undecided on vector/wireframe operations.
Platform: PIC 16F690@4Mhz code written in Sourceboost BoostC. Will probably switch to 8Mhz for 4x4x4 cube, the 2x2x2 could run at 1Mhz without glitches, but it is just one byte being dealt with.
So far I never realized cool animations could be made with 8 LEDs in 3 dimensions.
For an 8x8x8, may go to an 18F for more I/O on an 8x8x8, or use I2C LED Drivers to shift data into while sticking with the 16F690
There are lots of examples of these on Youtube, from 4 to 15 LED cubes, once past 10 LEDs per side, they get really awesome looking, especially when made with RGB.
Last edited: