Because I wanted to start on the software early, I built a little mock-up device at first that did nothing more than connect three different color LEDs to GPIO pins on the Raspberry Pi:
I went with the "traffic light" color scheme because it matches the three different states used by Jenkins.
After wrapping up the code, I found the right hardware for this on Amazon:
I bought this since a life-size or real traffic light (yes, they are available on ebay every once in a while) would have been a little over the top price- and sizewise. It comes with two "car" sides (showing red, yellow and green) and two "pedestrian" sides (with only red and green). It has a switch with three positions on the bottom, and a pushbutton on the top. It originally runs off three AA batteries.
After opening it up I didn't really bother much with the original functionality and pretty much instantly ripped out the original board. What was unexpected though was the small tungsten light bulbs I found on the inside since I was really expecting LEDs. The good news at this point was that the removal of the original board freed enough space for a bare Raspberry Pi + WiFi to be fit inside.
After drilling up the holes and installing 5mm ultra-bright LEDs I hooked up another ULN2064 to amplify the GPIO outputs since the 30mA current necessary to drive the LEDs appeared a little bit too much for Raspberry Pi to me. I also drilled holes into the bottom and ran a power supply cable through the foot.
Here's a few pictures of it in action:
|First experiments with regular LEDs that turned out to be too dark|
|Ultra-bright indicating broken build|
|Ultra-bright indicating good build|
The code for this little hack is still available on Github.
1 An extreme feedback device is a tool often used in agile programming. Its purpose is to show the integrity of a software project. The idea is to detect software errors as soon as possible and to make them visible and obvious to everyone involved. It usually involves a continuous integration server like Jenkins.↩