Christmas tree Lights with the Raspberry Pi

Although Christmas is still a good four months away, you can always prepare for it in advance. The project uses a tiny single board computer known as the RBPi or Raspberry Pi, but you will need some time to collect other material for the project. You will also need time to iron out software bugs, especially if you are a newcomer to the RBPi and Python programming. Additionally, although the project is meant for Christmas, you can as well use it for decorating any other occasion.

The RBPi in the project drives eight AC outlets connected to sets of light. An RGB LED star adds a dynamic range to the light show with its 25-step programming mode. Another advantage the RBPi offers is its audio out can drive the lights in time with music. With a Wi-Fi connection, you can work on the software from a remote location.

The basic ingredients you require for this project are: an RBPi, any model; an SD card containing the Occidentalis operating system; a USB Wi-Fi adapter; and an eight-channel 5V SSR Module Board. You may also use electro-mechanical relays in place of SSRs, but they will produce noticeably audible clicking sounds when switching, while SSRs are noiseless. If you use the SainSmart SSR module board, each of the eight SSRs is rated up to 2A, which will adequately power a string of lights.

Apart from the basic ingredients, you will also require a bunch of extra items: some jumper wires, JST SM Plug and receptacles; four 8ft pieces of wire; eight extension cords, two power distribution blocks; a power strip; suitable enclosure; and speakers. You will also need a few power supplies: for driving the RBPi and the LEDs – 5V, 3A or greater; and for driving the SSR module – 5V, 1A or greater.

For the star, you can use 12mm or suitable RGB LED strands. With the Adafruit WS2801 chip, the RBPi only has to pulse the LED strand once rather than pulse it continuously to keep the LEDs lit up.

It is advisable to test the RBPi and associated components before connecting the wiring. Do this before setting up everything within the enclosure and you have the advantage of easy troubleshooting. Connect the RBPi to a monitor and keyboard, so you can set the system configuration to start software development.

As the default RBPi installation does not have the necessary libraries for driving the WS2801 LEDs, it is necessary to use the Occidentalis operating system from Adafruit. Follow the steps outlined here for configuring the RBPi to get it working as required. Use GPIO 0-7 on the RBPi for driving the SSR module.

As the RBPi drives the GPIO output high, the SSR connected to that pin switches on. This allows the LED associated with the SSR to light up. Write a simple test program to cycle through all the GPIO pins, setting them high for two seconds each.
After testing for proper functioning, connect the lights to respective SSRs through extension cords, using power distribution blocks to keep the wiring neat. Use cheap night-lights to test the animation program first, since this will reduce your eyestrain.