Projects‎ > ‎

Arduino Light Controller


Project Overview

This project evolved from my desire to have a Christmas light display synchronized to music.  As I had an old Arduino Duemilanove lying around from a previous project (that was never completed), I decided that it would be fun to try and design a controller based off the Arduino hardware.  As I browsed several of the DIY Christmas Lights forums, I discovered that many people tinkered around with the Arduino platform to control Christmas lights, but there were no standard "products" that were used based upon the Arduino platform.  Most people were using the discrete outputs and/or PWM signals directly from the Arduino to trigger solid state relay modules to turn on/off the lights.

So, I set out to design an Arduino shield that could provide dimmable control of AC powered Christmas light strings.  The path I chose involves using two TLC5940 devices which each provide 16 PWM channels via a SPI connection to the Arduino. 

This page documents the project.

Project Requirements

  • 32 channels of light control per shield (8 connections to external solid state relay modules.  For my 2013 show, I used the SSRez as described at http://www.doityourselfchristmas.com/wiki/index.php?title=SSRez).
  • Be commanded using data from the Generic Serial output plugin to Vixen 3
  • Stackable design to allow up to 128 channels to be controlled from a single Arduino.  Note: At this time, this has been tested with two shields on a single Arduino.  The design supports up to 4 boards.  For my display, this may not be used as I've decided to go to a more decentralized design where multiple controllers are scattered throughout the display.
  • Zero cross detection to allow AC dimming

Project Status

PCB Rev B In Production. 

For my 2013 show, I used an early prototype of this design on a protoboard.  This early design did not include the logic to invert the outputs; therefore, the 32 channels were non-dimmable. 

In November 2013, while I was busy hanging lights for my first show, I also managed to find time to design and order some prototype PCBs that included the dimming capability.  In the week after Christmas, I constructed my first PCB.  While I did encounter a few errors in my PCB layout, none of them were fatal flaws that were unable to be worked around.  On December 29, 2013, I connected my first PCB-based prototype to a SSRez and demonstrated the capability to dim the lights as well.

For history sake, here is a list of PCB layout issues encountered with the first (Rev A) PCB layout:

  • Incorrectly laid out power header from Arduino.  This resulted in a couple of issues that had to be worked around:
    •  3.3V being provided to shield instead of 5 V.  Resolution: Cut 3.3V header pin on shield and jumpered the 5V line to the shield power.
    • GND line was connected to RESET line instead of GND.  Resolution.  Cut trace to RESET pin on PCB and used R1 ground side to jumper to ground pin on Arduino header.  Not ideal, but it works.
  • RJ45 connector layout inverted.  This resulted in having to install the RJ45 connectors on the bottom of the shield rather than the top.  In addition, the hole spacing on the connector wasn't quite right and required some effort to force the connectors onto the PCB. 
I'm currently incorporating a few small design changes to the PCBs and plan to have some new boards spun shortly.

Update 1: New PCBs have been generated and the above problems have been resolved.  The current batch of boards works as designed with no required workarounds.

Design Notes

  • The TLC5940 is an open collector current sink device.  This means that when the output is active, it is sinking current (low) but when it is not active, it appears as on open circuit.  After the blank pin is toggled, the TLC5940 sets the output active (low) until the PWM cycle count has been reached.  At that point, the output is put into a high impedance state (open-circuit).  Since this board is designed to connect to a SSRez or compatible solid state relay board, a low output triggers the triac to turn on the light channel.  With a triac controller relay, dimming requires a couple of design considerations:
    • The PWM cycle must be synchronized with the zero cross of the AC signal.  To achieve this, a H11AA1 optocoupler was used.  The output of the H11AA1 triggers an interrupt on the Arduino which then asserts the blank pin (and latch pin if new data has been clocked into the chips) to begin the next PWM cycle.
    • For dimming, each PWM cycle (120 Hz in the United States) must begin with the lights off.  Based upon the desired dimming level, the triac must be turned on part-way through the PWM cycle.  Once a triac is turned on, it will remain on until the next zero cross.  This requires the output of the TLC5940 to be inverted.  In addition, the output must be pulled high (5V) when the TLC5940's output is off (high impedance).

Schematic

Below is a schematic of the board.  You can download a pdf version of the schematic that is easier to read from the attachments section at the bottom of this page.


Bill of Materials

Here is a quick list of parts used.  I acquired most of the parts from Ebay; therefore, I need to go back and get part numbers for a few parts, but this should give you an idea of the parts required for now.

  • TLC5940 (Qty 2)
  • 10K Bussed Resistor Network 9-pin (Qty 4)
  • 74HC14 Hex Inverters (Qty 6)
  • H11AA1 Optocoupler (Qty 1)
  • Arduino stackable header set for Arduino Uno (1 6-pin, 2 8-pin, 1 10-pin)
  • 5520251-4 RJ-45 8/8 Right Angle Jacks (Qty 8)
  • 330 ohm resistors (Qty 2)
  • 2.2 kohm resistors (Qty 2)
  • 0.1 uF ceramic capacitors (Qty 8)
  • 2x8 male pin header (Qty 1)
  • shunt jumper (Qty 1)
  • 2 pin PCB Screw Terminal Block (Qty 1)
  • 6 VAC wall wart
  • 28-pin DIP IC socket (Qty 2 - Optional)
  • 14-pin DIP IC socket (Qty 6 - Optional)
  • 6-pin DIP IC socket (Qty 1 - Optional)

PCB Layout

Arduino Light Controller PCB Rev B

Pictures

Here is a picture of my first assembled controller (top view - Rev A).  Note that this version of the PCB has the RJ-45 jacks mounted on the bottom of the board due to a PCB design error.  Also, I was short a 2-pin terminal block; therefore, I directly soldered a 6 VAC transformer to the board.


And here is a picture of the board mounted to an Arduino Uno ...

Software Features

The Arduino based software has the following features:

  • Run-time configuration settings via serial connection to board
    • Interface Type (currently only supports Vixen Generic Serial Output)
    • Number of shields connected to the board (1-4, default 1)
    • Pin for each latch signal (hardware has jumpers to allow pins 4-7 to be used). 
    • RF Channel Number (for use with RF Wireless Shield)
    • Starting Address (for use with RF Wireless Shield)
    • Zero Cross Delay (adjustable time delay for zero cross circuit in microseconds -- can be used to adjust for phase shift caused by some AC transformers used on the zero cross circuit)

Software Source Code

The software is distributed under the GPL v3 license.  For full license details, see GPL v3 License.

Release 0.3 (Current) - This release added support for configuring RF channel when used with the nRF24L01+ module, zero cross timing delay configuration, increased RF speed to 1 Mbps (from 250 Kbps), and general bug cleanup.

Release 0.2 (Current) - This release resolves some timing issues with the original code that resulted in some flickering while dimming.  This release also includes the initial release of the Arduino RF Bridge code and full support for RF communications with the nRF24L01+ RF module.

Release 0.1.  This release includes support for communications with Vixen using the Generic Serial Output (use "A1" as header).  Multiple shields per Arduino are supported.  If four shields are used on a single Arduino, the ouput rate from Vixen must be set to 50ms or slower.


See attachment section at the bottom of this page.

Warnings

This is a do it yourself project and is documented for informational purposes only.  You are potentially dealing with dangerous electrical current.  If you are not comfortable around electricity, do not attempt to construct and/or use this shield.  No warranty, expressed or implied, is construed with any information, design, or product presented on this site.  I am in no way responsible for any injury and/or property damage encountered based on the information presented on this site.

Files

All files related to the Arduino Light Controller project can be found in the file cabinet.

Recent Files

  • ArduinoLightController-0.3.zip   303k - Nov 9, 2014, 11:10 AM by Keith Woodard (v1)
  • Arduino Light Controller Schematic Rev B.pdf   120k - Aug 5, 2014, 7:02 AM by Keith Woodard (v1)
  • ArduinoLightController-0.1.zip   87k - Aug 5, 2014, 7:02 AM by Keith Woodard (v1)
  • ArduinoLightController-0.2.zip   303k - Aug 5, 2014, 7:02 AM by Keith Woodard (v1)
Showing 4 files from page files.