Total Control Lighting is a new product from Cool Neon. It's a series of addressable LED lights whose colors you can control to a very high order of precision. Each LED can be set to have red, green, and blue values between 0 (fully off) and 255 (fully on). The LEDs are arranged in series and SPI is used to communicate with each LED. The LEDs function by reading 4 bytes (3 for the RGB values, and one flag byte). On receipt of a subsequent set of 4 bytes the LED switches to the indicated color and moves the previously received bytes down the line to the next LED. There are 4 wires connecting each LED to the next, these wires are arranged as follows:
Cool Neon sells shields and Seeeduinos (an Arduino compatible board) which make connecting the total control lighting strands, as well as external power, a snap. I recommend the Cool Neon Total Control Lighting Developer Shield (discussed and shown below) because in addition to connecting the lighting strands to the Arduino, it includes some buttons, switches, and potentiometers which can help to easily create a lighting control system.
The Arduino has dedicated hardware SPI pins, which allow for fast communication to the total control lighting pixels. The specific group of pins on the Arduino UNO board are:
Note that the mega uses different pins. To find those pins, read the SPI documentation.
For this application, we only need to use pin 13 (the serial clock) and pin 11 (the master out/slave in data line). Connect the Total Control Lighting strand (or T-connector) data line to pin 11 of the Arduino and connect the clock line to pin 13 of the Arduino. There are three modes for powering the Arduino and LED lights. Note: The Total Control Lighting shields handle the connection to the correct pins automatically.
The Total Control Lighting library includes several example sketches, which I recommend looking through to get a sense of how it works. Please feel free to use the examples as a starting point for building your own projects.
First, download the open source TCL library. To install this library, unzip it into the "libraries" directory of yourArduino sketchbook folder. If there is not already a folder named "libraries" then create it. When you next start the Arduino IDE you will have a new TCL library and a couple of new examples using the TCL library. I encourage you to take a look at the examples and try them out using your Total Control Lighting strands to make sure everything is working.
Second, be sure to include the SPI library and the TCL in your sketch using the include directive:
Next, within the
There are a few simple commands you need. First, to initialize the strand, you need to send a
Now, using these simple routines we can start sending data to the LEDs. Let's suppose I want to send the colors red, orange, yellow, green, and blue to a strand of 5 Total Control Lighting LEDs attached to my arduino. I could write the routine:
Of course this routine resends the colors every second, which is not necessary. The colors will remain for as long as the strand has power supplied to it.
Cool Neon is starting to offer a developer shield which includes 4 potentiometers, two momentary buttons, and two two-position switches. The shield is pictured below:
The shield includes a +5V DC power input cable with a 2.1mm jack, compatible with the wall-wart power supplies Cool Neon sells (which will power the Arduino as well as the lights). There is also a female total control lighting output, which can connect directly to the
total control lighting pixel strands. What makes the shield special is it also comes with four potentiometers, two momentary buttons, and two switches which can be configured as inputs to the Arduino.
If you hold the developer shield so that the two-position switches are at the top and the potentiometers are at the bottom (upside-down in terms of the photo above), then going clockwise from upper-left the potentiometers connect to analog input pins 0, 1, 2, and 3. The momentary switches, moving from bottom to top connect to digital pins 4 and 5, and the two-position switches from bottom to top connect to digital pins 6 and 7. When closed, the switches connect the pin to ground, so you should configure them to use the internal pull-up resistors. The total control library configures the inputs correctly if you issue the command:
There are also defined aliases for each input device:
So, for example to read the state of button 1 I would issue the command:
It would return
Let's try something a little more realistic. Imagine it's the holidays and you are nostalgic for the blinking christmas lights your mom used to buy. You remember that they drove you crazy when you were little, but now that you've been away from home for years you want them again. However, you notice that they are more expensive than you recall. You decide to program a little blinking light magic on your Total Control Lighting strands. You decide you will stick to some basic colors: red, orange, yellow, green, and blue and that you will have the lights blink for random on and off times of 700-1300 milliseconds and in random colors. You pick a strand of 50 LEDs and start cracking.
Your code starts with some basic definitions:
Next we need to initiate the SPI interface, store the RGB byte values for each color, and set up our initial colors and durations until the lights blink off.
Notice, I used a subroutine to update the colors on the LEDs, since I will need to do this every loop. The subroutine is defined here:
Each loop involves checking the current time and seeing if it is time for the LEDs to change color and then selecting a color for the LED. If it is already on, then we change the LED to black. If it is off, we randomly select a color for the LED to change to. That is done in this loop:
And there you have it... you can enjoy the blinking lights that drove you crazy as a child. Christmas is saved with Total Control Lighting.
I am working on projects using these lights now and have some projects that I am working on listed below.