we take quality seriously.
That's one of the reasons we use Jenkins for continuous integration of our source code. Jenkins builds our code, runs the tests after each commit, and sends us an email with any test failures.
But we get a ton of emails (I'm sure you understand this problem). It's easy to miss an important build email, leaving the code-base in a broken state for minutes, if not hours.
We had been thinking about creating an indicator to more prominently bring test failures to our attention, and when Daniel told us that he has experience in working with electronics, we teamed up and started working on Operation Stoplight.
The plan was to poll Jenkins via the local network, get the build status in JSON format, parse the status and light up the right lights depending on the status.
Sounds easy ... well, almost.
Apart from the electronics work, we faced a minor hiccup when we tried parsing the data from JSON. The problem was that the JSON data was too big for Arduino's memory so parsing the JSON document was out of question.
To solve that problem, we wrote a trivial Jenkins proxy in Python that'd parse the JSON document and spit out just the information the Arduino board needed, namely the color to light up! So instead of polling Jenkins directly, Arduino would poll the proxy server instead and fetch the color to be displayed.
As for the unit itself we decided to go DIY with that as well. Daniel initially prototyped the Stoplight using cardboard and later he used wood to create the final product. A fresh coat of bright yellow paint made it look like a real traffic light albeit a slightly scaled down version.
Now if there is a build failure, everyone in the office is alerted immediately (including guests!) and looking at the green light soothes our nerves a bit.
➜ Red: When there is a build failure
➜ Amber: When a build is in progress
➜ Green: When then build passed the tests
4 steps to a more efficient Build Stoplight
While working on the Arduino Uno variant of the board we came across some limitations at the onset of the design process of the internal electronics. One of the most important limitations was to function within the recommended 12V input range of the Uno.
The reason for this was to avoid a bulky secondary power regulation assembly for the lights in addition to the power line used by the board. We had to select the appropriate components and build the three colored signals to function within that range. This resulted in a low powered, low cost and low maintenance traffic light.
- LEDs - They are the ideal choice when it comes to high brightness at a low cost, both in terms of current (power) consumption and cost. They also last much longer when compared to heated filament bulbs which are notorious for burnouts. However, to make LEDs usable in such a case I had to build an array of these LEDs - a 4x10 LED array to be precise.
- ULN2003 Driver - This particular Darlington array is a well known solid-state switch when it comes to driving high voltage, high current inductive/non-inductive loads with 5V digital inputs. The 2003 comes with 7 channels of 500 mA, each with its own internal flyback diode which buffers the main Arduino board from the lights and thereby protects it from any back current. For added redundancy we paired two channels for one signal light which gave us 1A current rating and two flyback diodes which was way more than needed. As the 2003 is a solid-state switch, you also get its inherent benefits when compared to electromagnetic relays; such no electromagnetic interference, no mechanical wear and tear etc.
- 7809 Voltage Regulator - You can never go wrong with the 78xx series when it comes to regulated power supplies. All we needed to power the UNL2003 driver assembly and the LED array was one 7809 hooked to the Vin and GND pins of the Arduino board and a couple of 0.1 microfarad electrolytic capacitors to cancel out any residual noise. This provides a clean 1.5A 9V DC to power the LED lights.
- DIY PCB using Toner Transfer Method - After the initial prototyping and testing on a breadboard, I finalized the PCB and used the Toner Transfer Method to make the PCBs for the LED arrays and the driver board. You can find several DIY guides for this and IMHO its the best alternative when you want to quickly make some low cost and good quality PCBs at home. All you need is a copper clad, hand drill and some etching solution.
A few closeup images of the board, the driver assembly and the LED PCBs:
And here are all of the resources and datasheets if you'd like to replicate this idea:
If you've built something similar please leave a comment below and tell us about your project. We're also planning to build another Arduino based project soon, so if you have a cool project idea we'd love to hear from you!