RGB tree

How to Solder the tree.

There are two versions of the tree, one for the Raspberry Pi and one for the micro:bit or Codebug. These photos are from the prototype but are pretty close to the final version. The Raspberry Pi version has 6 LEDs, three capacitors, a resistors, a diode and a connector:

rpi_tree_front

The micro:bit / Codebug version has 5 LEDs, two capacitors, a resistor and a piezo sounder in the centre:

mbit_with_piezo

OK, so let’s have a look at how to build your tree.

1) Solder the resistor in place (bend the leads on the resistor before inserting it into the holes):

after-resistors

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:

after-capacitors

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):

rpi-after-diode

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:

connector-front
connector-side

5) micro:bit / Codebug 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:

where-to-solder-piezo-detail

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:

rpi_tree_side mbit_side

 

WARNING: when you connect the tree to your Pi, micro:bit or Codebug 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.

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

This code works but is quite rough: any seasoned Python programmers out there will probably cry into their keyboards – sorry! If you have ideas on how to improve it, please get in touch.

To use the example code, you need the rpi_ws281x library by Jeremy Garff and Richard Hirst. If you’ve ever used the excellent Pimoroni Unicorn HAT or 4tronix’s McRoboFace (and if not, why not?!) or any other Neopixel-style products then you’ve probably got this installed. I hope to provide more instructions soon (again: can you help with this? Please get in touch!) but, for now, the easiest way is probably to use Pimoroni’s excellent installer.

With the power switched off, connect the tree on pins 1 to 16, facing outwards as shown:

on-pi

Using the tree with Codebug

With the power off, use crocodile clips leads to make the following connections:

  • GND on the tree to GND on Codebug
  • 3V on the tree to 3v on Codebug
  • SOUND on the tree to leg zero (0) on Codebug
  • LED on the tree to leg three (3) on Codebug

Below is a screenshot of some sample code… you can download this as a .CBG file to copy straight to your Codebug in the normal way. Note that the colours will be ‘wrong': this is because the red and green components are reversed to that as provided by the Codebug software. By using the blocks that allow you to choose the amount of red, green and blue (as below) you can swap your red/green requirements to fix this problem:

rgb_tree_codebug

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:

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.

rgb_tree_pxt_microbit

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:

micropython

 

 

 

2 thoughts on “RGB tree

  1. Pingback: Volunteer website

  2. Pingback: Microbit Neopixel Christmas Tree | Sean Houlihane

Comments are closed.