CruiseControl Build Status
IT shops who have a continuous build environment often like to have a hardware device to show the current state of the build. The most common approach seems to be an X-10 controller and lava lamps. Pragmatic Automation has a how to guide for this.
What I really want is a USB based system, which is both controlled and automated via USB. This would make it easy to work with any most any hardware, and doesn't require a power outlet.
I found an Antec Multicolor External LED Light Tube as Circuit City. The tube could change to any of seven different colors and could also respond to sound. This seem perfect for the project. I figured I'd just have to write a small USB driver to control the different colors and I'd be all set.
The tube was priced right at $19.95, but after I got it home I found out it was only an analogue device. It simply uses a USB port to draw power from. A small box allows you to select a color, or put it in audio mode. So, this device by itself wasn't going to work. What I needed now was a USB controller. I found the k8055 USB interface kit for $80 assembled.
I disassembled the cable going to the tube, and found it had a red, green, blue, and power wire. These I connected directly to the digital outputs on the k8055. I was hoping that the lamp's LEDs would have build in load resistors, and these are always required when connecting an LED to a power source. I also had hoped that the optical relays inside the k8055 would be able to handle the current of the LEDs, without requiring another relay device. I got lucky on both accounts.
Shortly after wiring up the tube, I was able to control the lights by setting the bit register of the k8055 with the included software. I would have preferred to connect each LED to it's own analogue output, but the k8055 only had two built in, and they would have required a transistor to control the LED's current. As it was, I could create 7 colors and black on the tube.
One of the functions of the LED controller was apparently to balance the current to each of the lights. The three LEDs in the tube all have different brightnesses. So, without an analogue control I'm not able to create a white color because the green is too strong. Also, the yellow looks very much like the green, because the red isn't as bright.
For the build status, I really only needed three colors, one for 'currently building', one for 'last build passed', and one for 'last build failed'. I selected the blue, green, and red respectively to indicate these statuses. So, not being able to produce a nice purple, yellow, white, or orange was OK.
The next step was getting the project to respond to Cruise Control. We already have an in house version of cctray, but our version uses Tibco to send the build status over multicast. The k8055 includes a C dll interface, and I simply had to make the right declarations in C# to control it.
Lastly, I added a timer to shut the light off, after it had been green for an hour. This is so it's not on all night and on weekends.