Arduino based build light system
I’ve been looking at an Arduino for a few years now, but never really had the drive to pick one up, or the project to use it on. But after the recent move from Jenkins to Bamboo, our office build lights needed some rework and I got to thinking this might be the perfect system for an Arduino.
I ordered the Arduino starter kit, Ethernet Shield and strip of 25 WS2801 LED’s from AdaFruit, and surprisingly only about 6 days later my order arrived in Australia.
Most of the complex logic is handled by the WS2801 lights themselves, each one is individually addressable, and so the only real complex part was how to do the build server integration.
After looking into the features of the Ethernet shield, I took the approach of coding a simple web-server into the Arduino that can respond to a basic set of URL requests, changing the state of the lights based on the pattern of the URL.
The initial build consisted of 6-led lights all configured as one set that could either be on or on a rotating pattern with the led’s Green for success or Red for failure.
These were easily addressable by the simple http server, hitting the url
would turn on the lights to the success state.
would show the full red option.
would give the other 2 potential options for build status.
A quick and easy modification to our existing build watch script enabled a quick integration to our build system.
Our build process is a little more complex than a single light (or set of lights) can indicate. We have 3 distinct build stages, and it would be good if the lights could watch each stage and indicate the progress through the workflow, and the current success of each stage.
The upgraded Arduino webserver code has now broken the LED’s down into 3 sets, TOP (S1), MIDDLE (S2) and BOTTOM (S3).
These sets each have the same status options of ‘/success/complete/’ and ‘/failed/building’ etc, but are prefixed by the Section the command applies to.
The webserver does very crude pattern matching, so its even possible to control multiple stages at once like.
How to build your own
I purchased all of my components from Adafruit.com.
- Arduino base kit
- Ethernet shield
- WS2801 LED Strip
- Some wire or cabling, also available but I had some spare cat5
Once you have all the parts, connect the GND and 5+V pins of the WS2801 to the corrosponding pins on the Arduino, and the Data and Clock pins to the 2 and 6 pin (or whatever you want and change the Sketch)
The Arduino Sketch files are available on my GitHub account. The phase 1 configuration is available in the master branch, while the phase 2 (3 section) configuration is available in the 3seg branch.
You’ll also need the Adafruit_WS2801 library and the base Ethernet library.
Then it should be as simple as firing up the Arduino IDE, loading in the sketch and uploading to your device.
Note: You might need to change the IP address, MAC address or Data pins, these are all identified at the top to the Arduino Sketch file.