January 2017

A Lasercut Neo-Pixel Tree

I noticed Rich Hawkes project on Hackaday for a WS2812 LED Tree and then reading comments further found a lasercut tree on Hackaday.io. The 7 rings were a little pricey but I found this 93 LED 5-ring set that would work nicely. The ring set comes as one piece that you can cut apart with snips. I liked the earlier author's use of a 2-piece lasercut tree. So I ordered some green acrylic and put it on my project queue.

Over the holidays, when the green acrylic had arrived, I set out to design the tree. In retrospect, I should have used one of the parametric CAD programs (like FreeCAD). But I plugged ahead with my favorite Groovy scripting language and cranked out an SVG scaled in millimeters. In the program, I measured the ring diameters and parametrically designed the pieces. You'll find the resulting SVG and DXF output in the repo as well. I plan to rework the design in FreeCAD.

I lasercut the two pieces, slid them together and the rings fit nicely. The 5-rings (and top pixel) are all WS2812s and each piece has data in, data out, 5v, and ground. I took a couple servo cables and cut them up to use as flexible wire to connect the rings together. It's a bit tricky to solder them all together in a chain. I measured the wire lengths and did the solder flat on a table with the wire carefully looping through each successive ring. I thought about using solvent to put the two acrylic pieces together -- and then just hot-melt glued the rings to the tree instead which made it all very sturdy.

Having accidentally fried my share of WS2812's before, I made a little module to insert between the tree and the controller which put a 1000uF cap across the power leads and put a 300 Ohm resistor in series across the data line. This was motivated by the nice Best Practices tutorial on NeoPixels on Adafruit. I clipped a bit of Perma-Proto board and then cut the row into two parts to facilitate placement of the resistor. It was nice and compact -- someone should make modules like this for every NeoPixel strand.

With WS2812's one can use almost any kind of controller. I chose a Pi Zero and used Jeremy Garff's rpi_ws281x library which uses the onboard DMA controller to reliably drive WS2812's. It is important to make sure you blacklist the onboard audio module as the site details -- it won't work until you do as the audio uses the same PWM that the WS2812 driver is using. I'm hoping Jeremy might extend his library to support WS2822's -- the new independently addressable LED chips. The WS2822's make all sorts of structures possible since you need only share the data, power, and ground lines -- not require a chain. They also aren't impacted by bad LEDs. But it'll take a little while for those to become common.

Here is my current tree.py python program that drives the tree. It's based on Tony's example over on learn.adafruit.com. I start it on boot by running the following as root (where tree starts tree.py):

cd /etc/init.d
ln -s /home/pi/tree tree
update-rc.d tree defaults

You can imagine making all sorts of modes -- including displaying the time on some of the rings. The Pi makes remote deployment of new code easy. And cron is great for turning on and off the display (or different displays) at different times by inserting lines like the following into /etc/crontab:

00 7	* * *	root	/etc/init.d/tree start
00 22	* * *	root	/etc/init.d/tree stop
30 7	* * 1-5	root	/etc/init.d/tree stop
30 16	* * 1-5	root	/etc/init.d/tree start

The Pi Zero doesn't have the current limiting fuse that other Pis have -- so you can just power it with a high-amperage USB supply (maybe 2.5 amps) and take the LED power straight off the pins.

I was surprised how well it came together. It's really pretty fun to watch. If you look straight down on the tree all the pixels line up (see photo above). Check out the video below.