Introduction: Pi-ece on Earth

About: I'm an Engineer, who originally inherited the family business (Thanks Dad (RIP JC Taylor, 1938-2011)) after working in it for 25 years, designing and building scientific instruments. In 2013, I was head-hun…

In time for Christmas, here's my first foray into using a Raspberry Pi to drive anything. Christmas last year was fairly dull, so I decided to brighten things up with a large illuminated tree on the lawn outside our house.

I mounted 500 NeoPixel Leds, in 10 strings of 50, around 12 feet per string, and hung them in a basic tree shape.

Control of the array is from a Raspberry Pi model 1, in an enclosure next to the strings, and connected to the house network by wifi.

Programming of the LEDs is accomplished by a library from Jeremy Garff, and available from GitHub.

A lot of useful information is available from Andrew Oakley's site

Andrew also has a neat library for using animated PNG files on LED displays. He has more patience than me. All my effects are programmed.

Step 1: Gather Ye Festive Materials.

Major Items needed.

This is not an in-expensive project.

LOTS of LEDs, I bought mine off Ebay, they are prewired, and pre-waterproofed, saving a lot of time and effort. I specifically bought 500 pieces of NeoPixel style WS2811 based LEDs. Each led can consume up to 60mA at full brightness which leads to.....

....You CAN'T power this project off an old phone charger, at full out, its drawing nearly 200W from the supply, which is 40A....which is a lot of current and means need a big power supply. Once again, Ebay was my friend, and I got a fine generic switching supply for less than 20 bucks. The wires to our LEDs certainly can't handle 40A, so you need to distribute power to the array. Conveniently, most of the decent LED vendors on Ebay also supply small waterproof connectors, with short tails. We will wire a LOT of these, and for 10 strings, I used 10 pairs of connectors.

Here are some typical vendors



Power supply

I offer no recommendation on any of the links, they are suggestions only.

Step 2: Other Items

Obviously, a Raspberry Pi, I did this with one I've had lying around for ages. The new Pi will do it too, the Pi Zero will also work. All I did was install the latest version of Raspbian Jesse onto a memory card.

I used Wi-Fi to communicate with the computer. Its important to keep outdoor electronics WELL ISOLATED from the house systems. So add a USB Wifi module. Mine has an extension USB socket to lift the wifi away from the power supply.

A ROLL of sash chain. (DIY shed, Home Depot FTW ! or B+Q or whereever) Sash chain is flat chain, very stiff against twisting, used to hang windows.

At least 500, 3" ty-wraps.

A plastic storage box. (try the dollar/pound shop)

A wooden pole

A plywood plate for the top of the pole.

A hanging basket. (try the dollar/pound shop)

20 cheap key rings and karabiners. (try the dollar/pound shop)

Total cost of all items is close to $300. But its worth it.

I can supply a copy of the interface board I designed and built, complete, with connections to your power supply and the LED string for $20

Step 3: The Electronic Hardware Outline

Taking a look at the diagram.

The Pi is connected to an interface board, which converts Pi 3.3V logic to the 5V level that the LED strings need. You only need a SINGLE pin on the Pi to drive the system. I designed a very simple board which plugged straight onto the Pi.

From the interface, we can go straight to the strings, we are only driving the cable from the Pi to the first LED, each LED will buffer the signal to its neighbour down the chain. The update rate of the system is phenomenal: its clocked at 800Khz.

Jeremy's very clever driving library uses the Pi's processor hardware in an ingenious way to generate the required signals for the strings, and provides a neat interface to Python.

The strands are just connected in pairs, with the top joint at the top of the tree.

At the BOTTOM of each pair of strands, you make up an interconnector (second picture) connecting all the wires in the connectors to their mates in the opposite one, but injecting power (orange cable) into the power lines.

Once soldered, each interconnector is thoroughly waterproofed by coating with self-amalgamating rubber tape.

Step 4: The Mechanical Outline

All of the LEDs need mounting firmly. We used lengths of sash chain (see materials), which we used because it is nicely rigid in one plane, so hangs prettily.

Each LED is strapped to the chain with a ty-wrap. Jbo and I managed to bind on 50 LEDs (one string) in about 15 minutes.

The strings are mounted in 2 x 50off strings, all the connections from one chain daisy chain straight into the next.

We tied a ring off on a convenient branch of a tree, and then a rope for the string assembly through that. That provides a convenient way to lift and lower the strings for maintenance or assembly.

We found the easiest thing to do was to buy a whole reel of chain, and suspend one end with a rope from where the LED tree would be built, and start tying off Leds. Two people seems to work best, one pushing ty-wraps through every 4th link, one tying and untwisting the LEDs onto the chain. We didn't snip off the excess ty-wrap, as the tails seem to add a more leafy kind of look to the chain.

It is VERY important to get the direction of the control signals correct. Each of my pixels has a white arrow on the device, the arrow points IN the direction of data flow, so the white wire on the arrow side of the board is the INPUT line.

The strings have keychain rings on both ends, and then small karabiners to clip them to the ground anchor, and a support at the top. At first, we tied the tops all together in a small space, but the top got very confused and difficult to disentangle. I found a cheap hanging basket was an ideal solution for the top, as it gives a neat, and automatic angular spacing for each string. A pair of 50 LED strings can be placed with their ends about 500mm apart, and the power connectors allow about 500mm between each pair. Over all, the bottoms of the LEDS are on roughly a 1200mm/4 foot radius.

Step 5: Electronic Details

Electronically, the design is very simple. All you need is one pin, the hardware PWM pin on the Pi to drive the LEDs, but you need to "buffer" the signal, converting it from 0..3.3V to 0..5V. There are lots of ways to do that, but by far the simplest is to find a device like the 74HCT245 chip. The critical thing here are the three letter HCT. HCT logic has an input range that accepts 3v3 logic and turns it into the 5logic on the output of the chip.

Note: for insane reasons, Pi designers refer to the hardware PWM pin as "Pin 18". In fact, it is PHYSICALLY pin 12 on the Pi. Be aware and careful

Step 6: Rigging the Pi, PSU and Interface

The Pi and interface board are mounted on an aluminium panel. The PSU is mounted behind the panel, and the whole thing is screwed to a wooden post driven into the ground near the tree. A plywood board on the top holds the storage box rain cover so that it hangs straight.

Step 7: Program

Follow the instructions on Jeremy Garff's excellent GitHub link, and everything should happen automagically.

When finished, you can test your leds out with the "" script in the rpi/python/examples directory.

Further work I leave to the reader. In my code, I freely copied and hacked Jeremy's sample code, adding the NumPy library and mapping my 500 LED string into a 50 x 10 matrix.

The program can be seen running in the embedded video below. Every night for the last week, I have been designing new effects, and will try and publish more routines later.My code currently converts the string of 0..499 LEDs into a matrix of 50 rows and 10 columns.

Step 8: Oops

Take care to test each group of LEDs as you build them. On string pair 3 we found a "dead pixel" in position 58 - and the thing with serial LEDs is if they don't pass data on, the string beyond is dead. I carefully removed LED 500, and grafted it into the position of LED 358, soldering all the joints, and using heat shrink tubing to protect the repair.

Make It Glow! Contest

Participated in the
Make It Glow! Contest