4*4*4 RGB LED Cube Controlled by Arduino
Description
The RGB LED CUBE KIT comes with a sketch pre-installed that runs through a test pattern. Or you can upload your own sketches to create your works. You can use it as a mood light, or create your own "ambient device" to remind you of new emails or instant messages! Sound cool.
The remaining steps will show you how to build an LED cube very easily developed by keyestudio.
Components List
1.control board * 1
2.FTDI module * 1
3.soldering fixture * 1
4.top acrylic plate * 1
5.bottom acrylic plate * 1
6.acrylic side plates * 4
7.plane PCB strips with LEDs * 16
8.bottom board * 1
9.fixing strips for PCB strips * 8
10.copper bush * 4
11.16P header strips* 2
12.3*10MM inner hex screw * 4
13.nut * 4
14.holder stick * 8
15.DC socket * 1
16.3*6MM inner hex screw * 8
17.F-F jumper wire * several
18.USB cable * 1
self-prepared tools: Soldering iron & solder
You can purchase this LED CUBE KIT on our official web. Welcome click here to get one.
Cube Assembly
An LED cube is like an LED screen, but it is special in that it has a third dimension, making it 3D.
The controller board is based on an Arduino-compatible 8*8 LED RGB Matrix driver board.
All RGB LEDs are soldered to the plane PCB and tested okay. You just need to solder and assemble the 3D matrix.
Step 1: Soldering the bottom board
Plug the two 16P header strips vertically into the holes of the bottom board (the side with no keyestudio logo facing up as above picture shown ), then solder the pins on the board. Shown below.
Step 2: Soldering the PCB strips with LEDs
1. First, disassemble both PCB strips with LEDs and fixing strips. Shown below.
2. Second, set the 4 copper bushes in standing position, and place the soldering fixture on top of the 4 copper bushes; then place 4 plane PCB strips to the soldering fixture, and set two fixing strips onto the black lines, remember to add solder to the 8 solder points for fixing.
3. Finally, just need to repeat the above steps to finish the other three strips soldering.
Step 3: Soldering the holder sticks
Before soldering, please note that each holder stick has marked letter. Stick A, B, C, D, E, F, G, H should be correspondingly inserted into the 8 holes of bottom board.
1. According to the letter order setting, you could first insert the 8 holder sticks into those strips which are soldered well, steps by steps to finish well.
2. Then, insert the whole assembled part into the bottom board. Shown below.
3. Next, adjust both assembled part and the bottom board in vertical position; then solder the solder pad areas between the PCB sticks and holder sticks to fix well; finally, add solder to the solder pads between the bottom board and the sticks.
4. After soldering well all solder pads, you can see the soldered board as below.
Step 4: Assemble the control board and acrylic plate
1. First, use 4 screws (3*6MM) to fix the 4 copper bushes onto the acrylic bottom plates.
2. Then, use 4 screws (3*6MM) to fix the control board onto the copper bushes.
3. Remember to solder the copper wire on the driven board as follows.
4. Next, fix well the DC socket on the acrylic side plate, then insert the acrylic plate into the acrylic bottom plate and solder the copper wire.
Note: One of the copper wire which close to the screw is soldered to the shorter lead of the DC socket (positive end), the other one is soldered to socket's longer lead (negative end).
5. Plug the header pins of the bottom board (direction shown below) into the VCC, GREEN, VCC headers of the control board. Be aware the direction not to be reversed.
6. Finally, insert the other 3 acrylic side plates into the acrylic bottom plate, then place the top acrylic plate, use two screws (3*10) and two 3M nuts to fix well the side board.
Step 5: All assembly is complete. You can see the finished LED cube shown below. So Great!
Wiring Diagram
RGB control board |
Arduino FTDI basic program downloader
|
VCC | 5V |
GND | GND |
DTR | RST |
TXD | RXD |
RXD | TXD |
Sample Code
#include
typedef struct
{
unsigned char r;
unsigned char g;
unsigned char b;
} ColorRGB;
//a color with 3 components: h, s and v
typedef struct
{
unsigned char h;
unsigned char s;
unsigned char v;
} ColorHSV;
unsigned char plasma[ColorduinoScreenWidth][ColorduinoScreenHeight];
long paletteShift;
//Converts an HSV color to RGB color
/*void HSVtoRGB(void *vRGB, void *vHSV) /////////////////////////////////////
{float r, g, b, h, s, v; //this function works with floats between 0 and 1
float f, p, q, t;
int i;
ColorRGB *colorRGB=(ColorRGB *)vRGB;
ColorHSV *colorHSV=(ColorHSV *)vHSV;
h = (float)(colorHSV->h / 256.0);
s = (float)(colorHSV->s / 256.0);
v = (float)(colorHSV->v / 256.0);
//if saturation is 0, the color is a shade of grey
if(s == 0.0) {
b = v;
g = b;
r = g;
}
//if saturation > 0, more complex calculations are needed
else
{
h *= 6.0; //to bring hue to a number between 0 and 6, better for the calculations
i = (int)(floor(h)); //e.g. 2.7 becomes 2 and 3.01 becomes 3 or 4.9999 becomes 4
f = h - i;//the fractional part of h
p = (float)(v * (1.0 - s));
q = (float)(v * (1.0 - (s * f)));
t = (float)(v * (1.0 - (s * (1.0 - f))));
switch(i)
{
case 0: r=v; g=t; b=p; break;
case 1: r=q; g=v; b=p; break;
case 2: r=p; g=v; b=t; break;
case 3: r=p; g=q; b=v; break;
case 4: r=t; g=p; b=v; break;
case 5: r=v; g=p; b=q; break;
default: r = g = b = 0; break;
}
}
colorRGB->r = (int)(r * 255.0);
colorRGB->g = (int)(g * 255.0);
colorRGB->b = (int)(b * 255.0);
}
float dist(float a, float b, float c, float d)///////////////////////////////////////////////////////
{
return sqrt((c-a)*(c-a)+(d-b)*(d-b));
}
void plasma_morph() //////////////////////////////////////////////
{
unsigned char x,y;
float value;
ColorRGB colorRGB;
ColorHSV colorHSV;
for(y = 0; y < ColorduinoScreenHeight; y++)
for(x = 0; x < ColorduinoScreenWidth; x++) {
{
value = sin(dist(x + paletteShift, y, 128.0, 128.0) / 8.0)
+ sin(dist(x, y, 64.0, 64.0) / 8.0)
+ sin(dist(x, y + paletteShift / 7, 192.0, 64) / 7.0)
+ sin(dist(x, y, 192.0, 100.0) / 8.0);
colorHSV.h=(unsigned char)((value) * 128)&0xff;
colorHSV.s=255;
colorHSV.v=255;
HSVtoRGB(&colorRGB, &colorHSV);
Colorduino.SetPixel(x, y, colorRGB.r, colorRGB.g, colorRGB.b);
}
}
paletteShift++;
Colorduino.FlipPage(); // swap screen buffers to show it
}*/
/********************************************************
Name: ColorFill
Function: Fill the frame with a color
Parameter:R: the value of RED. Range:RED 0~255
G: the value of GREEN. Range:RED 0~255
B: the value of BLUE. Range:RED 0~255
********************************************************/
void ColorFill(unsigned char R,unsigned char G,unsigned char B)
{
PixelRGB *p = Colorduino.GetPixel(0,0);
for (unsigned char y=0;y
for(unsigned char x=0;x
p->r = R;
p->g = G;
p->b = B;
p++;
}
}
Colorduino.FlipPage();
}
void setup()
{
Colorduino.Init(); // initialize the board
// compensate for relative intensity differences in R/G/B brightness
// array of 6-bit base values for RGB (0~63)
// whiteBalVal[0]=red
// whiteBalVal[1]=green
// whiteBalVal[2]=blue
//http://keyes-arduino.taobao.com
unsigned char whiteBalVal[3] = {36,63,63}; // for LEDSEE 6x6cm round matrix
Colorduino.SetWhiteBal(whiteBalVal);
// start with morphing plasma, but allow going to color cycling if desired.
paletteShift=128000;
unsigned char bcolor;
//generate the plasma once
/*for(unsigned char y = 0; y < ColorduinoScreenHeight; y++)
for(unsigned char x = 0; x < ColorduinoScreenWidth; x++)
{
//the plasma buffer is a sum of sines
bcolor = (unsigned char)
(
128.0 + (128.0 * sin(x*8.0 / 16.0))
+ 128.0 + (128.0 * sin(y*8.0 / 16.0))
) / 2;
plasma[x][y] = bcolor;
}*/
// to adjust white balance you can uncomment this line
// and comment out the plasma_morph() in loop()
// and then experiment with whiteBalVal above
ColorFill(0,0,0);
}
void loop()
{
//plasma_morph();
ColorFill(255,0,0);
delay(2000);
ColorFill(0,255,0);
delay(2000);
ColorFill(0,0,255);
delay(2000);
// ColorFill(255,255,255);
// delay(1000);
}
ARDUINO software download: click here
Code libraries download: click here
Test Effect
Done uploading the code to the board, you can see the beautiful lights display. Cheers!
Below show you the video for LED cube assembly.
If you follow this instruction and make your own LED cube, please post pictures and video here! We love getting feedback on our projects!
Thanks in advance.
Below links are the related reference for you. Enjoy it to make your best projects.
http://www.instructables.com/id/Led-Cube-8x8x8/
http://www.hownottoengineer.com/projects/rgb-led-cube.html