Teaching a Tree to Dance

Christmas Lights for the Musically Un-inclined

     I have always been impressed by the musically-triggered light displays often seen around Christmas time.  When my wife expressed a desire to have our Christmas tree do the same, I was faced with a choice:  I knew pre-made controllers are readily available commercially, so I could buy one, thus supporting someone else's engineering, or I could build one myself and learn while I save.

     The ensuing ordeal turned out to be a lot more fun than I imagined, and once again I found out how much more enjoyable it is to program for fun than for a school assignment.  I made the power hub out of a 4 din outlet box, the kind generally used in construction.  This turned out to be the perfect fit, and housed the relays quite nicely.

     I decided to use Solid State Relays, which are traic-based power switches that use zero crossing to avoid any inductive kick when shutting off quickly. This has the added advantage of silent operation, as it eliminates the need for relay 'clicking' when transitioning.

     This build is powered by a Chinese clone of the Arduino Nano, a miniaturized version of the Arduino Atmega boards.  This one has all the functionality and more pins than the Arduino Uno, but has more pins and costs ~$2. 

     The audio is input through a standard 3.5 mm jack, allowing for almost any source to play music.
This particular cable was originally a 'patch' cable with the male jack on both ends.  I cut roughly in the middle and spliced the wires to connect the three signal wires: a black ground wire, a white left speaker wire and a red right speaker wire.

     Most Arduino boards have analog input ports, which can be used to read voltages delivered to those pins.  In this case I simply connected the audio signal for the right speaker to analog pin 4 of the Arduino, so that the voltage on the line can be monitored.  I also connected the ground wire to the Arduino's ground pin to ensure an accurate reference point. 

Here is a picture of the Arduino mounted in a solder less bread board.
    


     The Cat-5 (Ethernet) cable seen at the bottom of the picture on right is used to provide signals for the 8 channels of lights.  Each one controls a set of lights on the tree, and the Cat-5 cable conveniently provides 8 wires in a sturdy packaging.  This cable is ran into the bottom of the blue power box, which houses the outlets, relays and all the high voltage lines. 

    ***More details to come ***



Source Code available : Christmas Tree Code

Here are a couple videos of it in action :







No comments:

Post a Comment