Continuous Integration Traffic Lights Revamp
26 September 2013, by Rich Bradley
The traffic lights I converted to monitor our Continuous Integration builds have been poorly for a bit, but I finally made some time to fix them up.
There were three main issues which needed addressing: a blown lamp holder, an aging relay board and a lack of suitable housing.
Blown Lamp Holder
Quite a while ago, the green bulb blew on the lamp (our builds must have been too stable!). You might think that this would be no big deal: we could replace the bulb and carry on, but for some reason the dying bulb managed to fuse something inside the bulb holder. One leg of the dead bulb was welded into the end of the holder, and there are suspicious burn marks all around the end. After extracting the melted bulb from the holder, we found that it no longer passed current. I phoned several different electrical suppliers, but none of them recognised the component or could source a replacement. It’s a metal tube which surrounds a ceramic core, through which passes the wires for the bulb:
In the end, I bought a standard halogen bulb holder and used some Sugru to fix it in place. Sugru is rated to 180 °C, so it should be able to cope with the heat from the bulb.
Aging Relay Board
I first set up the traffic lights as a build monitor back in 2009. At the time, the best relay board I could find was controlled by a parallel port and cost €24 + shipping from Europe (it’s still on sale, now €26.50). Back then, my PC had a parallel port on the back, but no one has a parallel port any more, so we have been using a parallel port PCI card, which is a bit awkward.
The board itself (see below) has been sitting on the carpet for years, and some of the components are coming loose. 2 of the 8 relays no longer work. While the old board still more or less worked, I decided we would benefit from a more modern replacement.
Since I ordered the old board, hobbyist electronics have become more mainstream (see e.g. the Arduino and Rasberry Pi), and you can now get a USB controlled relay board for just £15 with free shipping from Amazon.
The new board appears to be well made and seems to work well. It arrived promptly and well packaged.
The software support was fairly terrible though. You can download a rar file from the SainSmart website which has a closed source app which can control the board and a few data sheets, but no instructions on how to talk to the board from your own programs or from the command line. It took me a long time to figure out how to use it. In case it helps out anyone in a similar predicament, I have put the source code on the Softwire GitHub account.
The relays on my board are connected only to the common and “normally closed” pins. Although the relays appear to be SPDT kind, and each relay appears to have 3 connections, on my board the “normally open” pin does not appear to work at all. Of course, this can be worked around in software, so it’s not a big deal.
It’s also a bit disappointing that the board needs a separate 5V power supply. Why can’t it draw its power from the USB cable?
Anyway, those minor gripes aside, I was able to rework the traffic lights to use the new relay board, so on to the final change:
Lack of Suitable Housing
When I first set up the traffic lights, I didn’t bother with an enclosure, I just sat the relay board on a piece of polystyrene on the carpet. Our enthusiastic Health & Safety officer (is Softwire becoming a “big” company?) asked whether I could box up the exposed electronics to guard against accidents. (Note that the exposed stuff was only 12V, so hopefully I wasn’t being too irresponsible before!).
I found a nice plastic project box on amazon, and put all the electronics inside there, sealing it up with some more Sugru:
Here’s the final revamped build monitoring traffic light: