In 2016 I ran a Kickstarter campaign to produce a miniature Christmas Tree with addressable RGB LEDs for the Raspberry Pi and micro:bit. This page gives some details on constructing the tree and then programming it.
How to Solder the tree.
There are two versions of the tree, one for the Raspberry Pi and one for the micro:bit. The Raspberry Pi version has 6 LEDs, three capacitors, a resistors, a diode and a connector:
The micro:bit version has 5 LEDs, two capacitors, a resistor and a piezo sounder in the centre:
How to build your tree.
1) Solder the resistor in place (bend the leads on the resistor before inserting it into the holes):
2) Solder the capacitors, again bending the leads before inserting them into the holes. Note that the Raspberry Pi version has three capacitors whereas the micro:bit version has only two:
3) Raspberry Pi version only: solder the diode in place. IMPORTANT: the diode has a band/stripe at one end… this MUST go towards the left of the tree (it is marked on the PCB):
4) Raspberry Pi version only: solder the connector in place. Solder just one pin first, check the connector is correctly aligned, then solder the remaining pins:
5) micro:bit version only: this is the best time to solder the piezo sounder in place. Of the four holes in the centre, use the middle two:
6) Now the LEDs! First, take a good look at an LED and notice that it has two long leads and two shorter leads. Also notice that, for each LED, the PCB has a hole marked “L”. This next instruction is essential: one of the longer leads MUST go in the hole marked “L” (to be specific, the long wire nearest the middle of LED).
Push the LED down so that it is approximately 5mm above the PCB. Solder just one of the four connections for now. Check the LED is straight and, when you are happy, solder the other three leads.
Here are views of both models that shows the LED leads:
WARNING: when you connect the tree to your Pi or micro:bit and apply power, the LEDs may light immediately at full brightness. These could be very bright and damaging if you look directly at them. Make sure the tree is pointing away and don’t look directly at it when you first apply power.
Generally, when using the tree, be aware that the LEDs are very bright and take steps to avoid damaging your eyes: don’t run them at full brightness.
If you install the software before attaching the tree then you will be able to run it quickly to turn off the LEDs.
Using the Raspberry Pi version.
Update: I have now successfully tested this with a Raspberry Pi 4.
I have put together a simple bit of example Python code with you can download from http://www.pocketmoneytronics.co.uk/downloads/rgb_tree_example.py HOWEVER, please read the notes below.
To use the example code, you need the rpi_ws281x library by Jeremy Garff and Richard Hirst. If you’ve ever used Pimoroni’s Unicorn HAT or 4tronix’s McRoboFace or any other Neopixel-style products then you’ve probably got this installed. If not, the easiest way is probably to use Pimoroni’s excellent installer or to type the following in a terminal window:
sudo pip3 install rpi_ws281x adafruit-circuitpython-neopixel
Due to changes in the library since I first wrote this code, you will need to open the file rgb_tree_example.py and change this line:
from neopixel import *
from rpi_ws281x import *
With the power switched off, connect the tree on pins 1 to 16, facing outwards as shown:
You can then run the code with:
sudo python3 rgb_tree_example.py
Using the tree with the micro:bit
With the power off, use crocodile clips leads to make the following connections:
- GND on the tree to GND on the micro:bit
- 3V on the tree to 3v on the micro:bit
- SOUND on the tree to leg pin (0) on the micro:bit
- LED on the tree to pin two (2) on the micro:bit
The best resources for using the tree with the micropython can be found here:
- Damian Burrin’s excellent video and microbitsandbobs project page.
- Micromonster’s video on The Chrismas Tree Kit
Here is a hex file that you can download to your micro:bit to test the tree. It was written using the PXT editor by adding the ‘Neopixel’ package. You can see a screenshot of the code below. Important: you need to swap the red and green elements otherwise the colours won’t be as you expect.
Here is a screenshot of some micropython which you can download. Again, the red and green components need swapping over to get the colours you expect: