Coding Can Christmas

Christmas Lights + Music

During the Christmas season, one of the family traditions we had was driving around the neighborhood looking at various Christmas Light Displays. I still remember my Dad driving us up to this house that was covered in lights, probably 10s of thousands of lights. However, these lights didn't simply stay on. They danced to music that came through the car radio.

Mesmerized, I knew I had to try to make such a display. I looked online, and the commercial kits to do this cost a fortune. So, I decided instead to try to build this myself. At that time, I was reading several electronics books which explained circuitry, relays, and basic programming. So, in Freshman year of High School, I designed a circuit, wrote the software, and put it all together. My parents were not very technical, so most of this project was me trying to teach myself. After a lot of trial-and-error, reading, and a melted extension cord, I got a 16-channel display working in my Freshman year in High School (2017... note, no AI). Every year since (into college as well), I kept adding to it.

Architecture

  • A master controller made up of an Arduino and a Raspberry Pi 3.
  • Two (later three) distribution boxes.
    • Each distribution box had a shift register that multiplexes the data stream into 8 outputs.
    • Each of these outputs fed a relay (later a solid-state transistor/triac)

system

It originally supported 16 channels, but I expanded it to 24. The architecture above I intentionally designed to be modular. It could scale up in channels of multiples of 8 with ease.

The Pi

On the Raspberry Pi, I loaded the light show data. This contained the sequences for the songs. I created these sequences using Vixen, open-source sequencing software. The Raspberry Pi also hosts a web-server allowing for remote operation and control software that streams the lighting data to the Arduino.

The Arduino

The Arduino takes in the lighting data stream from the Raspberry Pi and "shifts-out" the data down the "data line" to the shift registers. I later added sensors that detect rain to shut off the display automatically.

The shift registers + relays

After the data arrives at the shift register, the register demodulates it on 8 output pins. These pins are used to drive relays. The first design used these relays directly to control the AC power to the lights. However, after the first year, the relays wore out, as they would switch sometimes 20 times a second. So, in the last two years, I switched to solid-state relays that can handle rapid switching. One limitation of the current design is that the channels are either on or off. I began looking to see how to get dimming to work, but I found it would require specialized timing to track the zero-crossing of the AC signal. This then would mean I cannot use the shift registers (and therefore losing scalability). I decided to leave the dimming for a future addition.

Overall learning and lessons

From this project, I came across various issues:

  • How do I pair together a relatively compute-rich resource (RPi) with a compute-constrained resource (an Arduino) that has advanced hardware capabilities? For this, I built a synchronous serial protocol between the RPi with the Arduino for data communication.

  • Wire gauge. Using 16 gauge wire over 50 feet pulling 12 amps leads to a melted cord!

  • Modularity. How can I scale up the display easily? For this, I split the system into the master controller and the distribution boxes (the shift register and relays). The distribution boxes are daisy chained with another, allowing me to scale up easily.

  • Network firewall / security. The Raspberry Pi hosted a webserver allowing me to control the display. I set up a domain name, port forwarding, and access control to securely support remote control of the display.

In total:

The latest version now has 24 channels, a robust website control, 6 or 7 different songs, and solid-state relays for longevity. Overall, a very fun project!!