This month, HackerBox Hackers are constructing intelligent, three-dimensional, illuminated structures. This Instructable contains information for working with HackerBox #0030, which you can pick up here while supplies last. Also, if you would like to receive a HackerBox like this right in your mailbox each month, please subscribe at HackerBoxes.com and join the revolution!
Topics and Learning Objectives for HackerBox 0030:
- Configure the ESP8266 NodeMCU for use with the Arduino IDE
- Assemble structures from full-color RGB LED strips
- Control RGB LED strips using the ESP8266 NodeMCU
- Extend NodeMCU operations over Wi-Fi wireless networks
- Construct an 8x8x8 LED Cube
- Experiment with reprogramming an 8051-based microcontroller
HackerBoxes is the monthly subscription box service for DIY electronics and computer technology. We are hobbyists, makers, and experimenters. We are the dreamers of dreams. HACK THE PLANET!
Step 1: HackerBox 0030: Box Contents
- HackerBoxes #0030 Collectable Reference Card
- NodeMCU V3 Module with ESP8266 and 32M Flash
- Reel of 60 WS2812B RGB LEDs 2 meters
- 8x8x8 LED Kit with 8051-Based MCU and 512 LEDs
- USB Serial Module with CH340G and Jumper Wires
- Stranded Hookup Wire 3 meters, 22 gauge
- Exclusive HackerBoxes Decal
- Exclusive Dark Side LED Decal
Some other things that will be helpful:
- Soldering iron, solder, and basic soldering tools
- Computer for running software tools
- Cardboard or wood for LED assembly jig
Most importantly, you will need a sense of adventure, DIY spirit, and hacker curiosity. Hardcore DIY electronics is not a trivial pursuit, and HackerBoxes are not watered down. The goal is progress, not perfection. When you persist and enjoy the adventure, a great deal of satisfaction can be derived from learning new technology and hopefully getting some projects working. We suggest taking each step slowly, minding the details, and don't be afraid to ask for help.
That there is a wealth of information for current, and prospective, members in the HackerBox FAQ.
Step 2: NodeMCU and Arduino IDE
NodeMCU is an open source IoT platform. It includes firmware which runs on the ESP8266 Wi-Fi SoC from Espressif Systems.
To start, make sure you have the Arduino IDE installed (www.arduino.cc).
Next, you will need drivers for the appropriate Serial-USB chip on the NodeMCU module you are using. Currently many NodeMCU modules include the CH340 Serial-USB chip. The manufacturer of the CH340 chips (WCH.cn) has drivers available for all popular operating systems. Check out the Google translation page for their site. Some of those drivers are also mirrored on the WeMos site.
Finally, follow the instructions here for installing ESP8266 board support into the Arduino IDE.
When configuring the IDE, select "ESP-12E Module" as the board. Select the appropriate port that appears when you attach the NodeMCU to your computer.
As usual, start with the Blink example to test compiling and uploading to the NodeMCU. There is a blue LED on the board on the pin defined as "LED_BUILTIN" so the example sketch should work without modification. Change the number of milliseconds passed (twice) to the delay() function to alter the blink rate of the LED. Verify that the changes are reflected in operation after successful upload.
Step 3: RGB LED Strip
These flexible RGB LED strips are an easy way to add complex lighting effects to any project. Each LED has an integrated driver that allows you to control the color and brightness of each LED independently. The combined LED/driver IC on these strips is the extremely compact WS2812B (datasheet). If you look into a WS2812 "pixel" with a magnifier, you can actually see the integrated driver with bonding wires connecting it to tiny internal green, red, and blue LEDs.
To control the chain of WS2812 LEDs from the NodeMCU, the FastLED library is quite a powerful option.
The Library comes with some nice example sketches that you can try out. Be sure to change these defines:
#define LED_PIN D1
#define COLOR_ORDER GRB
#define CHIPSET WS2812
POWER SUPPLY NOTE Each WS2812 can draw around 60mA, so be sure to provide a stout enough 5V supply for the maximum number of LEDs that you will have illuminated at any given time.
Step 4: Lightforms
Step 5: Lightform Fireplace
If you have some parchment paper and a thin box (or a picture frame from a thrift shop or dollar store), you can put together this fireplace project in a couple of hours.
The RGB LED strip is cut down to ten six LED strips and wired together in a serpentine structure. A few sheets of parchment paper act as a diffuser. The NodeMCU module can be hot-glued onto the back with the USB port exposed for programming and connecting power.
Check out the attached example sketch fireplace.ino which makes use of the FastLED library.
Step 6: Wi-Fi Controlled Fireplace
The Wi-Fi capabilities of the ESP8266 can be leveraged to adjust the flame in the fireplace from any browser.
The FastLED Brightness method can be used to adjust the "heat level" of the fire:
Here is an example where the 8266 connects to an existing network and provides a simple web server interface.
Here is an example of connecting to the 8266 in access point mode.
Here is yet another well documented example.
Step 7: Contents of 8x8x8 LED Cube Kit
- ONE PCB
- ONE Reusable Plastic Parts Box
- TWO 4.7 KOhm Resistors (yellow violet red)
- EIGHT 470 Ohm Resistors (yellow violet brown)
- ONE 10 KOhm Eight Resistor Array
- ONE STC12C5A60S2 (with code)
- ONE 40-Pin DIP Socket
- EIGHT 74HC573 Octal Latches
- EIGHT 20-Pin DIP Sockets
- ONE ULN2803 Transistor Array
- ONE 18-Pin DIP Socket
- TWO 10uF 25V Electrolytic Capacitors
- TWO 22pF Ceramics Capacitors
- ONE 12MHz Crystal Oscillator
- ONE Barrel Power Socket
- ONE 4-Pin Serial Header
- ONE Power Switch
- ONE Cable with USB to 5V Barrel
- Red Hookup Wire
- 550 LEDs
Step 8: Assemble the 8x8x8 LED Cube Kit
Before assembling the 8x8x8 LED Cube Kit, at least skim over this quick outline. Much more detail is provided in the video linked in this step (same here).
A 15mm x 15mm jig for aligning the LEDs can be easily formed out of cardboard (as shown in the image above), using a wooden board (as shown in the video), or even 3-D printed (Thingverse), whichever approach you prefer.
1. SOLDER EVERYTHING BUT THE LEDs
TEN axial resistors. Note that there are two different values and they must be put into the correct positions. However, they can be placed in either orientation as they are not polarized.
ONE 10K Resistor Network. Note the dot nearest pin 1. Match this to the silkscreen on the PCB.
TWO electrolytic capacitors. Note the negative terminal indicator on the cylindrical housing of the capacitor. Insert this side away from the positive (+) indication on the PCB silkscreen.
ONE Power Switch
ONE 5V DC Power Jack
ONE 4-Pin Serial Header
ONE12MHz Crystal (not polarized)
TWO 22pF Ceramic Capacitors (not polarized)
TEN DIP Sockets. Observe the half-circle indicator on the PCB silkscreen and the matching shape on one end of each socket.
2. CUT THE SINGLE PIN HEADERS AND SOLDER INTO PLACE
Remove the black plastic prior to inserting each of the 72 single pin sockets.
3. INSERT TEN INTEGRATED CIRCUIT CHIPS
Observe the half-circle indicator on each chip and the matching shape on one end of each socket as well as the PCB silkscreen beneath.
4. TEST THE FIRST EIGHT LEDs
Into each of the single socket holes labeled C1-C8, insert the short cathode lead of a loose LED while inserting the long anode lead into the single socket hole just next to it. After all eight are in place, power the PCB to make sure these first eight LEDs do their thing.
5. FORM AND SOLDER 64 LEDS INTO 8x8 SHEETS (EIGHT TIMES)
First, create an "assembly jig" from cardboard or wood. Make an 8x8 grid of holes with spacings of 15mm in both directions (just like on the PCB). The holes should be just over 3mm so that the LEDs can be easily slipped out. Keep the positive anode (longer) LED leads all connecting together and the negative cathode (shorter) LED leads all connecting together. When each 8x8 sheet is completed, test out the whole sheet using a 5V supply and a 300-2000 Ohm resistor. It will be a lot easier to replace a bad LED at this point than it will be later.
6. INSERT THE LED SHEETS INTO THE SINGLE PIN SOCKETS
Place the positive anode (longer pin) terminals of each LED sheet into each of the eight socket rows, but not into the socket row labeled C1-C8.
7. WIRE CATHODE "LAYERS"
Solder one or two of the cathode "layers" of each column together with scrap "wire" removed from the LED leads. These joints will add structural integrity and maintain the proper 15mm spacing to keep the cube looking nice, neat, and cubicle. Use some hookup wire to connect each layer for the LED cube to one of single pin sockets labeled C1-C8.
8. ENJOY SOOTHING AND SUPER TRIPPY LIGHTING EFFECTS IN 3-D
FWIW, There is another version of assembly instructions HERE.
Step 9: STC12C5A60S2 Microcontroller
Step 10: Hacking the 8x8x8 Cube LED Kit
The included microcontroller comes preprogrammed, so this section is completely optional, but it is certainly still worth a closer look.
To start, read over this Theory of Operation for the 8x8x8 LED Cube Kit.
This repo has the source code and details for reprogramming the 8051-based STC12C5A60S2 MCU.
The link on both of those pages for the ISP (in-system programming) software is out-dated. The STC site has their programmer, or you can check out the open source stcgal.
Step 11: HACK THE PLANET
If you have enjoyed this Instrucable and would like to have a box of electronics and computer tech projects like this delivered right to your mailbox each month, please join the HackerBox revolution by SUBSCRIBING HERE.
Reach out and share your success in the comments below or on the HackerBoxes Facebook Page. Certainly let us know if you have any questions or need some help with anything. Thank you for being part of HackerBoxes. Please keep your suggestions and feedback coming. HackerBoxes are YOUR boxes. Let's make something great!