overpowered raspberry pi XMAS LED tree

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.

Assembly

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:

Software

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

#xmas tree example code
#pwm cycles the brightness
#by Stephan Martin, 2017
#https://www.designer2k2.at

import time,random
import RPi.GPIO as GPIO

#Setup GPIO:
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
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)
    p.start(0)
    pwm_led.append(p)

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

#Cleanup:
GPIO.cleanup()

 

 

e-max.it: your social media marketing partner
Zugriffe: 311