Introduction: 8x24x8 RED GREEN BLUE LED CUBE
I have previously done an 8x16x8 Led Cube Clock controlled by Arduino Mega 2560 and Real Time Clock Module DS3231 more than 2 years ago and until now it still works fine.
I also conducted the tests using ESP-01 to display time/ weather information on led matrix 13x15 and control an 4x4x4 RGB led cube on previous topic, named “MAXIMIZE THE CAPABILITIES OF ESP-01 ESP8266”. They all work very well.
Today, I would like to share how to use an ESP-01S ESP8266 to control a big size - led cube 8x24x8 in the simplest way of hardware. We can easily perform many beautiful effects with smooth transistion, as well as, display time/ weather information on this led cube without any extra-components because ESP-01S ESP8266 has 1MB Flash Memory, fast CPU speed 80/160 MHz and WIFI connectivity.
Let’s getting started.
Step 1: THINGS WE NEED
MAIN COMPONENTS:
- 001PCS X ESP-01 ESP8266.
- 001PCS X AMS1117 3.3V POWER SUPPLY MODULE.
- 512PCS X RED LED, 5MM.
- 512PCS X GREEN LED, 5MM.
- 512PCS X BLUE LED, 5MM.
- 025PCS X 74HC595 - 8-BIT SHIFT REGISTER DIP-16. (OR POWER LOGIC 8-BIT SHIFT REGISTER TPIC6B595N).
- 024PCS X ULN2803 - TRANSISTOR ARRAY-8 NPN IC DIP-18.
- 008PCS X 2N2222 - TO-92 NPN GENERAL PURPOSE TRANSISTOR. (OR 2N3904)
- 008PCS X P-CHANNEL POWER MOSFET IRF9540. ( OR 8PCS X IRF9Z34N)
- 025PCS X 0.1UF CAPACITORS.
- 200PCS X R100.
- 020PCS X R1K.
- 001PCS X 5X7 DOUBLE SIDED PRINTED PROTOTYPING BOARD.
- 030PCS X XH2.54MM - 8P 20CM WIRE CABLE DOUBLE CONNECTOR.
- 006PCS X XH2.54MM - 4P 20CM WIRE CABLE DOUBLE CONNECTOR.
- 010PCS X MALE 40PIN 2.54MM HEADER SOCKET ROW STRIP PCB CONNECTOR.
- 006PCS X 2PIN 5.08MM PITCH SCREW TERMINAL BLOCK.
- 001PCS X PUSH BUTTON.
- 001PCS X SLIDE SWITCH.
- 001PCS X 220VAC POWER SWITCH.
- CLEAR ACRYLIC SHEET WHICH CONTAINS 1536 LED, RECTANGULAR BOX SIZE LXWXH = 700 X 250 X 250MM.
- WHITE ACRYLIC SHEET WHICH CONTAINS POWER SUPPLY, CONTROL BOARDS, ARDUINO/ ESP8266, POWER SWITCH, RECTANGULAR BOX SIZE LXWXH = 800 X 350 X 100MM.
- POWER SUPPLY 5V, 10A. (I USED A POWER SUPPLY 5V-60A FOR THIS PROJECT)
- ZINC WIRES/ COPPER WIRES.
- TIN LEAD SOLDER WIRES.
- 01METER X 8P RAINBOW RIBBON CABLE.
- 02METER X TWO CORES POWER CABLE.
TOOLS AND EXTRA COMPONENTS IF WE DO ETCHING PCB BY OURSELVES:
- 4PCS X SINGLE SIDED COPPER CLAD BOARD – A4 SIZE.
- CLOTHES IRON (CLOTHES IRON TONER TRANSFER).
- IRON CHLORIDE (FERRIC CHLORIDE), PCB ETCHING.
- PCB CLEANING LIQUID.
- PCB HOOK KNIFE.
- PCB DRILLING MACHINE.
- SUPER STRONG GLUE (I COULDN’T BUY SPECIAL GLUE FOR ACRYLIC SO I USED 502 SUPER STRONG GLUE).
- WOODEN TEMPLATE. (TEMPLATE FOR LED SOLDERING)
- 1 SET OF 9 V BATTERY AND BATTERY CLIP CONNECTOR (TO CHECK THE LED).
- MASK, GLOVE, SMALL FAN FOR PROTECTING OURSELVES DURING SOLDERING.
PROGRAMMING TOOL FOR ESP-01 ESP8266:
- 01PCS X FTDI FT232RL USB TO TTL SERIAL ADAPTER.
- 01PCS X USB CABLE MINI TYPE B TO TYPE A.
Step 2: SCHEMATIC
The overall schematic for 8x24x8 led cube has big size file, you can download it in high resolution HERE.
I divide this overall schematic into 2 blocks to easily visualize:
Block 1: Led modules, include 3 x 512 = 1536 leds which are soldered in 3 separated sets of led cube 8x8x8
- 8x8x8 red led cube module: 512 leds.
- 8x8x8 green led cube module: 512 leds.
- 8x8x8 blue led cube module: 512 leds.
Below schematic only shows one layer (ANODE 0) with 192 leds, all led's anodes in same layer are connected together (to ANODE 0) and their cathodes are separately connected to cathodes scanning module. An 8x24x8 led cube has 8 layers with 1536 leds in total.
Block 2: Control modules, include:
- Anode scanning module: 1pcs x 74HC595 + 8pcs x 2N2222 + 8pcs x IR9540.
- Cathode scanning module: 24pcs x 74HC595 + 24pcs x ULN2803. If we use 24pcs x power logic shift register TPIC6B595N, all ULN2803 would be omitted.
ESP-01S controller module: including mode slide switch, reset button, programming header and AMS1117 power module for converting from 5V to 3.3V.
Attachments
Step 3: PCB DESIGN
I designed the printed circuit boards on EAGLE software. Because I do etching these PCBs myself, I had to design them in such a way that they could be easily fabricated.
- Led cube base PCB:
We need 3 x led cube base PCB for led cube 8x24x8. You can download it in real size high resolution PDF file HERE.
Notes: We can print out this PCB file, stick on the wooden template, and drill at 64 cathode holes with diameter 5mm. Later, after soldering 64 leds on wooden template, we can place and align 64 led's cathode easily on cube base PCB.
- Cathode scanning board PCB
Cathode scanning PCB is divided into 3 groups, each group consists of 8x74HC595 + 8xULN2803 and is used to control 512 leds.
You can download cathode scanning PCB in real size, high resolution PDF file HERE.
- Anode scanning board PCB
It consists of 1x74HC595 + 8xIRF9540 and is used to control 8 layers of led cube.
Anode scanning PCB in real size, high resolution PDF file is posted HERE.
Note: Firstly, the anode scanning PCB is designed base on the schematic below, take note that R002 (R100) was finally removed on my real PCB. In my overall schematic, these resistors R100 also don't exist.
Step 4: PCB ETCHING, DRILLING AND SOLDERING
To make a circuit board at home, I used Clothes Iron Toner Transfer method that simply print the circuit design out on a laser printer, iron it onto the copper, and etch by Ferric Chloride.
You can see some processes that I did with Led cube base PCB.
- Etching
- Ink removing
- Drilling holes
My result for anode and cathode scanning PCBs after soldering all components:
- Anode scanning PCB
- Cathode scanning PCB
- ESP-01 control board: I resued this control board from my previous project "MAXIMIZE THE CAPABILITIES OF ESP-01 ESP8266". It has one 4P male header available for SPI control.
Step 5: LED SOLDERING
Soldering 1536 LEDs is not easy. It take your time and efforts. Be patient, solder it carefully and double check every single LEDs by battery before/ after soldering. To build an 8x24x8 led cube, I soldered 3 separated led cube 8x8x8 with different colors: red, green and blue.
After soldering 64 leds arranged on the wooden template, we have one plane of led cube 8x8x8. The picture below shows 8 x led cube's planes which will form an 8x8x8 led cube later.
Soldering 8 planes to led cube base PCB, doing alignment and connecting 64 leds in same layer by bare copper wires diameter 1.5mm.
At backside, I soldered 8 layers to anode header by bare copper wires.
Just finished one led cube 8x8x8, I did the same with 2 remaning led cubes. Take notes that we should check carefully one more time when we finish every cube. If one led or some leds are damaged, shorted-circuit or open-circuit, it would effect to all other leds in the cube, it causes ghosting or flickering.
Step 6: BOX ASSEMBLY AND CONNECTION
BOX ASSEMBLY:
- Bottom box: dimension LxWxH = 800x350x100mm, it contain: power supply, Arduino/ ESP8266, all PCBs, power switch and made by white acrylic.
- Top box: dimension LxWxH = 700x250x250mm, contain all 1536 leds and it is made by clear acrylic.
- Before placing 3 x led cube 8x8x8 inside the top box, I did alignment and adjustment to ensure the led cube in acceptable symmetric condition.
CONNECTION
- Preparing 5V power supply.
- Preparing anode scanning board.
- Preparing cathode scanning board
- Connecting all together
DONE!!! It's been a monumental effort and it looks so cool!!!
Step 7: PROGRAMMING
Programming code for led cube 8x24x8 is available at my GitHub:
https://github.com/tuenhidiy/ESP-01-LED-CUBE-8x24x...
With below setup(), the timer1 clock runs at 5MHz (80MHz/16=5MHz) or 1/5MHz = 0.2us. When we set timer1_write (1000), this means the interrupt will be called every 1000 x 0.2us = 200us, which gives a multiplex frequency of about 5kHz. To minimize the flickers detected by camera, we can reduce this value to 500 or 100, for example, but in this case, the led cube will be dimmer. That why I selected 1000 and you can see some small flickers in my video which couldn't recognize by human eyes.
void setup () { anodelevel = 0; pinMode(DATA_Pin, OUTPUT); pinMode(CLOCK_Pin, OUTPUT); pinMode(LATCH_Pin, OUTPUT); //pinMode(BLANK_Pin, OUTPUT); timer1_isr_init(); timer1_attachInterrupt(timer1_ISR); timer1_enable(TIM_DIV16, TIM_EDGE, TIM_SINGLE); timer1_write(1000); clearfast(); }
When interrupt happens, the interrupt service routine timer1_ISR will be carried out its mission: shift out 25 bytes at specified anodelevel (layer) to control anodes and cathodes of led cube.
void ICACHE_RAM_ATTR timer1_ISR(void) { digitalWrite(BLANK_Pin, HIGH); // Cathodes scanning for (byte i = 0; i<24; i++) { DIY_shiftOut((cube[anodelevel][i])); } // Layer - Anodes scanning DIY_shiftOut(anode[anodelevel]); delayMicroseconds(5); digitalWrite(LATCH_Pin, HIGH); delayMicroseconds(5); digitalWrite(LATCH_Pin, LOW); delayMicroseconds(5); digitalWrite(BLANK_Pin, LOW); delayMicroseconds(5); anodelevel++; if (anodelevel==8) anodelevel=0; pinMode(BLANK_Pin, OUTPUT); timer1_write(1000); }
In my video, you can see the texts can move in ellipse shape around the cube. I did it based on one Excel template. With this template, we can easily edit to get programming code for any other shapes.
const unsigned char ellipse[38] PROGMEM = { 0xF1,0xF2,0xF3,0xF4,0xD5,0xB6,0x97,0x77,0x56,0x35,0x14,0x13,0x12,0x11,0x10,0x0F,0x0E,0x0D,0x0C, 0x0B,0x0A,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x22,0x41,0x60,0x80,0xA1,0xC2,0xE3,0xE4,0xE5,0xE6 };
For example: the first byte of above ellipse array 0xF1 (B11110001) stores led cube's coordinates(x0,y0) = (7,17) which x0 = B111 and y0 = B10001.
x0 = (ellipse[0]>>5) & 0x07); y0 = (ellipse[0] & 0x1f);
Step 8: FINISH
In the future, I should do a few more things with this led cube.
Update on July 21, 2020: Internet clock with randomized effects, controlled by ESP-01 ESP8266.
Thank for your reading!!!