This project is an ESP8266 powered LED holiday tree. It will run some nice holiday colors if there is no network configured, but if you do configure the WiFi, the colors will be shared live with everyone who makes one! This is an extension of TeleToyland, where you can interact with shared robots on the Internet. For this project, the control is shared, but the installation is all over the World! When someone chooses new colors for the tree, all the tress will update in real time. You can try a sample tree live at this project page.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Parts
The following parts were used in this project:
Tree Picture - the PDF is on step 2.
Foam Core backing board - a minimum of 5" x 6"
(23) WS2812b "Neopixel" LEDs - use the 60 LEDs per meter strips - use IP30 non-waterproof since they have adhesive backing built in.
26 gauge silicone wire - Red, Black, and Yellow. Silicone wire is very flexible and will not pull the solder pads off the LED strips. It's my new favorite wire! I chose Yellow for the data wire, but you can use a different color for that. You will want the following lengths:
- Red - (5) 4" pieces, and (1) 2.5" piece.
- Black - (5) 4" pieces, and (1) 2.5" piece.
- Yellow - (1) 4" piece, (2) 3" pieces, and (2) 1" pieces..
A project box. I tried a bunch and it turned out that a 2 port Ethernet Surface Mount Box was just the right size and came with it's own foam tape backing! This one was also good - easier to open, but the obvious orientation had the big holes facing up.
Jumper wires - not required, but make testing and final setup a lot easier.
- (2) red female - one 2", an done 4"
- (2) black female - one 2", an done 4"
- (2) red male - one 3", an done 4"
- (2) black male - one 3", an done 4"
- (1) yellow female - 2"
- (1) yellow male - 2"
DC panel mount power jack. The standard seems to be 5.5mm OD and 2.1mm ID.
Heat Shrink tubing. Sorry - mixing up units here:
- 3mm: (5) 3/8" pieces, (2) 1/2" pieces, (1) 1" piece. 3mm is about 1/8".
- 6mm: (2) 1" pieces. 6mm is about 1/4".
(1) 330 Ohm Resistor. This is used inline with the data wire to reduce erratic flickering - it reduces the ringing and crosstallk on the data transmission line.
(1) 1000 uf Electrolytic Capacitor: This is used across the power wires to reduce voltage spikes that could damage the LEDs.
Wall adapter: 5.5mm x 2.1mm 4.5 volt. A 5v adapter will probably work for this project, but in some cases will make the LEDs flicker erratically - see step 4 for details. I did not have much trouble with 5v adapters.
Optional: An Arduino Uno with a sample LED program for testing like the Adafruit Neopixel Strand Test. You can also use the ESP8266 with a temporary program.
Optional: A USB to 5.5mm x 2.1mm cable. This is also subject to the 5v caution, but again, it seems to work in most cases, and allows a convenient power source from USB batteries etc.
Step 2: Make the Tree Backing and Attach the LEDs
Making the Backing
The first step in construction is making the tree backing for the LEDs.
The attached PDF is the front of the tree with markings for LED placement. Printing on a color laser printer will make it water resistant, which will help prevent smudges later. I also tried printing on an inkjet printer and spraying with polyurethane, which seemed to work. Cut one tree out and glue it to foam core board. I have found that white glue tends to make it a bit bumpy. Brushing on some Mod Podge worked well, as well as spray adhesive. Once the glue is dry, cut the tree out with an x-acto knife. The slot at the bottom should be cut out so you can pass wires through there.
Adding the LEDs
The non-waterproof (IP30) LED strips have an adhesive backing. You can cut the strips with scissors - you will need two strips with three LEDs each, two strips with five LEDs each, and one strip with seven LEDs for a total of 23 LEDs.
You will need to make holes in the tree at the top middle (above the data pins) of the left four strips for the data wires. The last strip does not need one since it's at the end of the strip. You can make the holes before putting the LEDs on, or after. I used a push pin, and later found that a 5/64" drill bit made a more even hole.
Stick the LEDs to the tree in the marked spots. The LEDs have adhesive backing - simply peel and stick. The LED strips have a direction, and they should match the arrows on the diagram for my code sample to work. This orientation minimizes the wires on the back of the tree, making room for the electronics box.
As much as possible, try to line up the LEDs in a row horizontally, as opposed to the edges of the LED strips. The LEDs will be much more visible than the strips.
Step 3: Wire the Tree
With the tree backing and LEDs in place, the next step is to wire them and test them.
Data Wires and Resistor Wiring
For the data wires, use the yellow color. For the first strip, make a connector with the 4" yellow silicone wire. Strip 1/4" of insulation from the end, and trim the ends of the 330ohm resistor leads to 1/4". Twist the yellow wire around one end of the resistor (direction does not matter), and solder in place. The resistor helps reduce LED erratic flickering by reducing the high frequency ringing from the data line. Strip 1/4" off the end of the 2" yellow male jumper and solder that on the other side of the resistor. Use the 1" piece of 3mm heat shrink tubing to cover the resistor and those connections. Strip 1/8" of insulation off the wire, tin it, and solder that yellow assembly to the bottom of the first LED strip.
Tin the solder pads on the LED strips - all three of the bottom pads, and the data pads on the top for the left four strips. The top of the right strip will not have any wires attached. With the wires and pads tinned, you can solder them with a quick touch of the soldering iron.
Now, connect the top of the first strip to the top of the second one. Strip 1/8" off the end of a 3" piece of yellow wire, and tin it. Push it through the hole above the first strip (so the tinned end is by the LED) and bend the solder part 90 degrees. Solder it to the data pad on the top of the first LED strip. Then, thread the other end behind the tree and through the hole over the second LED strip (from back to front), bend it over the data pad, and cut it off to length so it covers the pad. Pull it back through the back, trim 1/8" of insulation, tin it, and push it back through. Soldering that wire can be tricky since there is not much to hold. I used a pair of needle-nose pliers to pin it in pace while I soldered the wire to the pad.
The next data wire connects the bottom of the second LED strip to the bottom of the third LED strip. Use a 1" piece of yellow wire, strip 1/8" of insulation off each end, and tin both ends. Solder that wire between the bottom data pads of LEDs strips 2 & 3. You can loop the wire over or below the red and black wires.
Next, connect the top of strip three and top of strip four just like you did for one and two. Then connect the bottom of strip four and the bottom of strip five with a 1" piece of wire like LED strips two and three.
That should complete the data wiring.
Each of the LED strips needs to be powered, so you will need five 4" red and five 4" black wires. Those will be soldered to the +5 and Gnd pads on the LED strip and then soldered all together. Strip 1/8" of insulation on one end of each wire and tin those (add solder to them). You should now have ten wires soldered - five red, and five black.
A 1000uf electrolytic capacitor should be used with the LED power wires to protect them from power surges. Use a 2.5" piece of red and black wire, and strip 3/8" of insulation off the ends. Trim the capacitor leads to 3/8". Twist the wires around each capacitor lead - be careful to note the polarity. Use black for minus (-), and red for positive (+). Generally, the minus side is marked on these capacitors. Use two 1/2" long pieces of the 3mm heat shrink tubing to cover those connections.
Hooking Them All Together
Make sure to run all the LED wires through the slot at the the bottom of the tree so they are all in the back of the tree!
For the power connectors, use 3" red and black male jumper wires. Strip about 1/2" of insulation off the 10 power wires, the 2 jumper wires, and the 2 capacitor wires. Twist all the red wires (there should be 7) together neatly and solder them all together. Repeat for the black wires. Then use the 1" pieces of 6mm heat shrink tubing to cover them. You can bend the jumper wire so it sticks out on the end.
Testing the LEDs
Now, you should have a 23 LED strand with male power, ground, and data wires. This is a good time to test with an Arduino or ESP8266 with a simple LED test program like the Adafruit Neopixel Strand Test.
Step 4: Project Box and Power Jack
A Box to Hide the Wires
I searched around for a box for the back of tree to hold the wires and mount the power jack, and finally settled on a 2 port Ethernet surface mounting box. This worked really well since it's the right size, the two halves snap together, and are tilted slightly so the tree tilts back a few degrees.
To prepare the box, open it up, and for the "wall" side, snip a lot of the extra plastic away to make room for the wires. See the pictures for details. To mount the wall side of the box to the tree, use the adhesive foam tape that comes with the box. Stick the foam tape to the box, and then put the tree and box on a table and push them together to make a good base for the tree. There is a cover for one of the big square holes if you want, though they will point down and not be obvious. Through the holes you can see the status LED on the ESP8266 board more easily for debugging.
On the outside part of the box, we need a hole for the panel mount DC jack. The best way to do this is use a step drill - it makes a huge difference in making a big hole like this - much safer and easier! Try to drill away from the snaps that hold the box together.
One tip with the Leviton boxes - using a small screwdriver to open them helps a lot.
Wiring the Power Jack
For the DC jack, we need four 4" jumper wires - one red male, one red female, one black male, and one black female. Strip 1/4" of insulation off the ends, twist the two red wires together and two black wires together, and tin them. Tin the DC jack pins. Solder the wires to the jack. Generally, the longer pin is the outside ground black wire. It may be good to check that with an ohmmeter. Solder the wires on the inside of the jack so they will fit through the hole in the box easier. Use two 3/8" pieces of 3mm heat shrink tubing to insulate those connections.
Now, mount the power jack to the box with the nut that comes with the jack. I used needle nosed pliers to tighten the nut, but not too much since the plastic threads on the jack can break.
A Note on Power
I have generally been able to run this project with 5v DC wall adapter or USB battery. But, the ESP8266 is a 3.3v device. The ESP8266 Development Board and Adafruit Huzzah have 3.3 regulators built in, so the 5v supply for those is fine. The LEDs are also driven from the 5v supply. The data wire for the LEDs, though, comes from the ESP8266, and is at 3.3v. The spec for the WS2812b LEDs (Adafruit "Neopixels") says that the data line should be driven at least 70% of the LED voltage to avoid erratic flickering, which would be a maximum LED power voltage of about 4.7 volts. You could add a level shifter inside the box to take the 3.3 data line up to 5v for the LEDs, but it takes up a lot of room. Since the LEDs are already so bright, you can also use 4.5v adapter or a lithium ion battery (3.7v) to run the LEDs and meet the 70% spec. So, I have 4.5v wall adapters to use for ones with issues.
The issue is that the 4.5v adapters generally only come up to 1 amp, where the 5v adapters are easy to find in 2 amp versions. The WS2812b LEDs can draw up to 60ma when fully on, so with the 23 in this project, that would draw 1.38 amps, and the ESP8266 can add another 250ma or so. So, at full white, the ESP8266 can shut down, and I have seen this.
You could also add a voltage regulator in the box to drop the LED voltage to something like 4.5 volts and allow a 5v adapter.
A level shifter or voltage regulator would be the right way to solve this over-current issue, but in the end, I just used a software solution. On the site, when setting the colors, you also set the brightness. If you submit a very bright color set, the server will automatically calculate the current usage and reduce the brightness if necessary. In practice, these LEDs are very bright, so this is almost unnoticeable.
Step 5: Wire and Program the ESP8266
Wiring the ESP8266
The ESP8266 Development Boards come with pins. Also, I really wanted the LEDs to have pins also so they could be tested on an Arduino etc. easily. You could use a female-to-female jumper to connect them, but I decided to add female jumpers to the three relevant pins on the ESP8266 board. In that way, it behaves like and Arduino for connections. This application is intended to be permanent, but I could de-solder those wires if need be.
For the connections, use one red, black, and yellow female jumper wire. Cut them to 2" long, and strip 1/4" of insulation off the ends. Solder the red jumper to the Vin pin, and the black wire to the adjacent Gnd pin. The yellow data wire will use pin D6 for the code sample I include. For the Adafruit ESP8266 Huzzah, I used pin 12. The code says pin 12, but it works on both boards. Tinning the wire and pins first will make the soldering easier. Once those are soldered use three 3/8" pieces of 3mm heat shrink tubing to cover them. Make sure the tubing covers only the one pin to keep it neat.
All the parts should be complete. Connect the power jack jumpers to the LEDs and ESP8266. Connect the yellow data wire from the LEDs to the ESP8266.
There are numerous Instructables on using the ESP8266 Development Board, so I will not repeat them here. One way to get the Arduino board manager is at https://github.com/esp8266/Arduino, and there are instructions there. I have the Board set to "NodeMCU 1.0 (ESP-12E Module)", the CPU Frequency set to "80 Mhz", and the Upload Speed set to "115200".
If you want, you can use the Neopixel StrandTest first to see if it's all working.
With the package manager in the Arduino Environment, I added the Neopixel library from Adafruit and the WifiManager library from tzapu. Both are documented on GitHub. The WifiManager adds the ability to setup your wifi credentials from a phone or PC, so it's a very useful addition for this project since it makes it easily portable! Other wifi projects I have done required the SSID and Password to be hard-coded in the program.
The WifManager is very nice. When it starts up, it looks for a saved SSID and attempts to connect to that network. If it does not find that network, it will put the ESP8266 in AP mode - it's own WiFi network. You can use a smartphone to connect to that WiFi - the SSID in the attached code will be "LED Tree". Then the ESP8266 will show a web page to connect to your local WiFi. On my phone, if I am patient, the phone generally shows the page automatically. If the page does not pop up, it will be at the address 192.168.4.1 - you can type that in a browser window. Sometimes it takes a couple tries to get the config page going - just power cycle the Tree and try again. The How it Works info on the WifiManager site has more info.
If no networks are found or setup, I added code to put up some colors to allow this project to work in stand-alone mode. If you later are near a WiFi network, just power cycle the Tree to start over.
Thanks to tzapu on GitHub for the WiFiManager code! https://github.com/tzapu/WiFiManager
Step 6: Change the Colors
OK, so now we have a nice "Arduino" powered LED toy. It will run some nice holiday colors if there is no network. The cool thing is that the code here lets you change the colors from a web page. This project is connected to TeleToyland, where people can connect to real world devices over the virtual Internet. All the other TeleToyland projects are a shared physical space, but this one is special. All these trees are physical devices that are controlled by the same site. So, when you go to the site and change the colors, all the trees around the world will show them! You get to have a little piece of TeleToyland in your own home.
The URL is http://www.teletoyland.com/Projects/LED_Tree
Enjoy and post comments if you make one!
There are some assembly instructions attached. They were for a group build and assume that some sub-assemblies are already built:
- data wire with resistor
- Capacitor and wires
- Box with holes drilled and power jack pre-wired
- 3" Red and Black male jumpers for the LEDs pre-cut
- ESP8266 board with +5, Gnd and Data line 6 female jumpers
Participated in the
Make it Glow Contest 2016
Participated in the
IoT Builders Contest
Participated in the
Homemade Gifts Contest 2016