Introduction: Interactive Color-wheel RGB Cube 8x8x8
This is special version of RGB Led Cube 8x8x8, so called "Interactive Color-wheel RGB Cube 8x8x8". Let's see all attached videos to know how it works.
- Interactive effect: whenever you move led cube in any axis, cube's color will be changed according to color-wheel rule. See DEMO version below.
- Color-wheel effect: It looks more amazing if we do effects with color-wheel function. For my project, you can see on videos, there are a lot of effects that were collected from many sources, some of them were done by myself.
- VU meter effect: Read music signal by MSGEQ7 through 3.5mm audio jack.
On the forum, I saw a lot of posts talking about led cube so I just briefly discussed how to do a RGB led cube in the simplest way.
Step 1: Bill of Material
With RGB CUBE 8x8x8, we have 512 LED RED, 512 LED GREEN and 512 LED BLUE, so totally we have to control: 512x3 = 1,536 LEDs.
By 4-bit BAM method, we can create 4,096 separated colors (16 ^ 3) for each RGB LED.
For this project, we'll do a lot of soldering works. Let prepare masks, gloves and exhaust fan for health protection.
Step 2: Cube Template & Led Tester
Print this template drawing out paper, stick by glue to wood, and then drill with diameter 5mm (if using 5mm RGB LED) at the center of each circle. We will have a led cube wood template with 64 holes.
Note: The holes spacing of wood template and LED spacing of cube base printed circuit board is the same. Thus, we can put 3 pins of led into cube base PCB easily.
Make a Led tester with 9V battery, take note that resistor R470 ohm are connected in series between battery and Led.
Step 3: Cube Base PCB
Distance between 2 LEDs in PCB is 20mm, same as wood template holes spacing.
With this distance, I didn't use any cooper wires or extra zinc wires to connect LED together. I just bend the Led pins and then soldered them easily.
Step 4: Shift Register Board
- Schematic:
Schematic above is only for one color so we will have totally 3 sets of shift register board like that.
- PCB:
As shown on shift register board PCBs, we have 3 blocks, each controlling 64 LEDs (R, G, B) -> 8 x 74HC595. These blocks are connected in series so that each time 24 bytes data is shifted out in the following order: BLUE --> GREEN --> RED.
Step 5: Layer Board
This layer circuit can be used in two options:
- Select layers through 74HC595.
- Select layers directly from 8 pins of Arduino Mega 2560.
I used the second option for faster response.
Step 6: Overall Schematic
RGB Led is common anode type, connected in series R100 for every single R, G, B led. Resistor R100 are included on shift register board PCB, located after ULN2803.
Arduino Mega 2560 control 24 x 74HC595 through SPI interface. And cube layer is collected directly from pin 26 ~ 33 of Arduino.
Step 7: Cube Box
I made a box containing 5V power supply, PCB boards, Arduino Mega 2560. Some switches, push buttons, jack 3.5mm, fan ... were mounted at cube's backside. You can refer to the internet how to make an beautiful acrylic cube.
In my design, I added one small fan & audio jack 3.5mm on the back of box to ventilate power PCB board and make it become VU meter as optional.
For VU meter, we can use MSGEQ7 with PCB design as picture, or, we can use FFT transformation to read audio analog data from 3.5mm jack.
Step 8: Main Program
Step 9: Bit Angle Modulation
About B.A.M, you can check my topic: https://www.instructables.com/id/BI-COLORS-MATRIX-...
Or refer to two amazing websites:
http://www.kevindarrah.com/?cat=99.
http://www.batsocks.co.uk/readme/art_bcm_3.htm.
Example with command LED(4, 5, 6, 3, 6, 13), we can see conversion from actual 3D dimension to program coordinates "Byte" & "Bit ", as well as, the mix colors on pictures.
Step 10: Color-wheel and Interactive Program
Refer from Nick Schulze: http://www.hownottoengineer.com/projects/rgb-led-c..., I did some modifications on his color-wheel program to match with my color template as follows:
- From:
array[phase] = {red, green, blue};
- To:
RED[phase] = red; GREEN[phase] = green; BLUE[phase] = blue;
- Get color from color-wheel function
void get_colour(int16_t p, uint8_t *R_colorwheel, uint8_t *G_colorwheel, uint8_t *B_colorwheel){ if (p >= COLOUR_WHEEL_LENGTH) p -= COLOUR_WHEEL_LENGTH; *R_colorwheel = RED[p]; *G_colorwheel = GREEN[p]; *B_colorwheel = BLUE[p]; }
For MPU-6050, you can refer to my previous project: https://www.instructables.com/id/2-Wheel-Self-Bala...
In my demo video, I took three values yaw, pitch, roll from MPU-6050 and input them to color-wheel function to get red, green & blue color for Led. K1, K2, K3 is converted coefficients from yaw, pitch, roll to color-wheel position. Parameter "COLOUR_WHEEL_LENGTH", in my case, is 256.
get_colour(K1*pitch + K2*roll + K3*yaw, &RED, &GREEN, &BLUE); fillCube(RED, GREEN, BLUE);
void fillCube(byte R, byte G, byte B){ for (byte z=0; z<8; z++){ for (byte x=0; x<8; x++){ for (byte y=0; y<8; y++){ LED(z, y, x, R, G, B);}}}}
Step 11: RGB Led Cube Pictures
Some pictures for my cube project.
Step 12: More RGB Led Cube Videos
More videos for my led cube project:
Finally, I would like to say a big thanks to Kevin Darrah, Nick Schulze, SuperTech-IT with the best references about RGB led cube.