Christmas Lights With The Raspberry Pi 2

 

2015 Christmas Tree Lighting Project from Roger Ngo on Vimeo.

The Christmas tree lighting project FINALLY finished. Watch our tree dance to Taylor Swift – Style.

I decided to do this song after watching her 1989 World Tour in Los Angeles this past summer. The song has been stuck in my head since that album came out. Probably even more so now that I've played this song about a million times working on this project.

On the back end, there is a Raspberry Pi Model B hooked up to an 8channel 5V SSR driving 8 separate AC lights, 7 of which are the LEDs wrapped around the tree and 1 for the tree topper.

Wiring the darn thing was an absolute NIGHTMARE. Juggling eight AC extension cords stretching out to about 15 ft each along with LED wiring creates an absolute mess... especially then the cords are stripped with bare copper showing. Not the safest thing to do, but I made sure wiring did not cross each other. I also had actually gone through about 3 different relays as my first initial 2 were mechanical and clicked when triggered causing a bit of a distraction. The Sainsmart 8CH SSR is pretty much the way to go if music is involved.

On the programming side… I used Python along with the RPI.GPIO library to output signals across the GPIO headers. This allowed the syncing of lights by switching it on and off rapidly to go with the music. The code ended up being 2700 lines of procedural Python code. I had initially started writing my own library to control some of the lighting patterns but quickly gave up on that because the arrangement kept changing. Eventually I decided to just write most of it line by line and tested as I went along.

Very nutty and frustrating but now that I know how to go about this... I probably would do it differently next time around. (More efficiently, of course.)

I'm pretty proud of it all... especially with this being my first Raspberry Pi project. Perhaps something even bigger to come next year?