overpowered raspberry pi XMAS LED tree

festive season! That requires a tree, a LED powered tree driven by a raspberry pi!

XMAS tree pcb layout

The LED´s are directly connected to one row of IO´s  to simplify the routing.

KiCad was used to draw it, the complete project can be found here: Pi Tree KiCad Project

The PCB can be ordered from DirtyPCB: DirtyPCB xmas tree

To give it more festive flair a fancy xmas tree pattern is printed on the silk screen.

LED selection

The raspberry pi can only provide 50mA in total on the 3,3V line, so with the 8 LED´s it should stay safe at 5mA for each LED.

Color should be amber, going close to a candle light color, and they require low voltages, helping with the low voltage from the raspberry pi.

Im using: Cree 5mm Amber where the datasheet shows values down to 5mA and still gives 1 candela.

The resistor is calculated with the 3,3V supply from the raspberry pi, the 2V from the LED and the 5mA:

R = (3,3V-2V)/5mA = 260Ohm, i took 280Ohm to be safe.


first solder the resistors in, then the LED and finally the header!

That way all the parts are getting higher and you can solder them flat.

Depending on the part on your raspberry pi, solder the other to the xmas tree.

Check that the orientation is acordingly:


a simple python script to light all LED "candles":

#xmas tree example code
#pwm cycles the brightness
#by Stephan Martin, 2017

import time,random
import RPi.GPIO as GPIO

#Setup GPIO:
chan_list = [4,17,27,22,5,6,13,26]
GPIO.setup(chan_list , GPIO.OUT)

#Create pwm objects:
pwm_led = []
for led in chan_list:
    p = GPIO.PWM(led,100)

#Cycle leds with PWM state until keyboad interrupt:
    while 1:
        for led in pwm_led:
            led.ChangeDutyCycle(random.randrange(40, 100,1))
except KeyboardInterrupt:




Comments powered by CComment