jesse
Touchdown! Greaser!
Thought this might be interesting to someone -- so decided to post it.
We've had a desire for awhile to use a stoplight to output the status of our continuous integration builds. Basically every time one of our developers commits code - automated systems start kicking off literally thousands of tests to verify that their change didn't break something. All of this is done before code is deployed into production.
For one reason or another it seemed like it'd be cool to have a big stoplight mounted in the office with it indicating the status of our continuous integration environment. The idea is that all code should be deployable -- what better way to encourage that behavior then a big light.
We came in contact with an electrical contractor that had an old stop light they didn't need anymore and gave to us:
Someone decided to place all my incoming packages in the most convient location...
It obviously needed some cleaning up:
Once things were cleaned up my first goal was to basically make sure I could get it lit up and functional. I replaced all the crap wiring inside and just made both lights go solid on:
Now that I had a clean stoplight that lit up and looked good it was time to figure out I was going to put it on the network, build a web server into it, and control the lights via REST like service.
There is a pretty cool project out there called Arduino -- an open-source electronics prototyping platform:
http://arduino.cc/
It seemed as if it'd work quite well for the job.
I settled on:
http://www.adafruit.com/products/418
It features a 16 Mhz processor, 32 kilobytes of flash memory, 14 digital I/O pins, 6 analog pins, and a 10/100 ethernet port. All for only $65.
The stoplight uses 110V AC. The Arduino board require somewhere between 7 to 12 volts. The pins one can turn on/off output 5 volts with a max of 40 ma. This presented a few problems.
It was my goal to build this all completely self contained inside the stoplight. So this meant that I needed to keep things pretty small. I found a 9 volt power supply that I could rip apart and easily mount in the stoplight. It worked out nicely for powering the Arduino.
My plan was to use a few relays for turning the lights on and off. The problem was that 40 ma of power at 5 volts wasn't enough to switch a large enough relay for the lights.
The 9V power supply used to power the Arudino would also provide adequate power for switching the relays. So then I needed some way to switch the 9V power on and off to each relay via the 5 volt pins.
I settled on using a transistor as a switch. A few relays (to switch the 110V AC on and off), a few transistors (to switch the relays on using the Arduino pins), a few resistors (to saturate the transistor), and a few diodes (to protect the transistor when the relay kicks off) and I was in business.
You can get an Arduino "prototype" shield for not much money:
https://www.adafruit.com/products/51
It just "stacks" onto the Arduino main board exposing all it's pins and giving you a nice way to build your own circuit.
A few pictures of the board with the switching components soldered on and ready for the first test:
A picture of the switching board I created stacked onto the Arduino:
The above easily fit inside the stoplight. I wired it up this evening and wrote a basic web server in C and uploaded it to the Arduino board and was able to turn the lights on and off via my web browser. Still working on the code..I'll post it when it's done.
Just kind of a fun project.
We've had a desire for awhile to use a stoplight to output the status of our continuous integration builds. Basically every time one of our developers commits code - automated systems start kicking off literally thousands of tests to verify that their change didn't break something. All of this is done before code is deployed into production.
For one reason or another it seemed like it'd be cool to have a big stoplight mounted in the office with it indicating the status of our continuous integration environment. The idea is that all code should be deployable -- what better way to encourage that behavior then a big light.
We came in contact with an electrical contractor that had an old stop light they didn't need anymore and gave to us:
Someone decided to place all my incoming packages in the most convient location...
It obviously needed some cleaning up:
Once things were cleaned up my first goal was to basically make sure I could get it lit up and functional. I replaced all the crap wiring inside and just made both lights go solid on:
Now that I had a clean stoplight that lit up and looked good it was time to figure out I was going to put it on the network, build a web server into it, and control the lights via REST like service.
There is a pretty cool project out there called Arduino -- an open-source electronics prototyping platform:
http://arduino.cc/
It seemed as if it'd work quite well for the job.
I settled on:
http://www.adafruit.com/products/418
It features a 16 Mhz processor, 32 kilobytes of flash memory, 14 digital I/O pins, 6 analog pins, and a 10/100 ethernet port. All for only $65.
The stoplight uses 110V AC. The Arduino board require somewhere between 7 to 12 volts. The pins one can turn on/off output 5 volts with a max of 40 ma. This presented a few problems.
It was my goal to build this all completely self contained inside the stoplight. So this meant that I needed to keep things pretty small. I found a 9 volt power supply that I could rip apart and easily mount in the stoplight. It worked out nicely for powering the Arduino.
My plan was to use a few relays for turning the lights on and off. The problem was that 40 ma of power at 5 volts wasn't enough to switch a large enough relay for the lights.
The 9V power supply used to power the Arudino would also provide adequate power for switching the relays. So then I needed some way to switch the 9V power on and off to each relay via the 5 volt pins.
I settled on using a transistor as a switch. A few relays (to switch the 110V AC on and off), a few transistors (to switch the relays on using the Arduino pins), a few resistors (to saturate the transistor), and a few diodes (to protect the transistor when the relay kicks off) and I was in business.
You can get an Arduino "prototype" shield for not much money:
https://www.adafruit.com/products/51
It just "stacks" onto the Arduino main board exposing all it's pins and giving you a nice way to build your own circuit.
A few pictures of the board with the switching components soldered on and ready for the first test:
A picture of the switching board I created stacked onto the Arduino:
The above easily fit inside the stoplight. I wired it up this evening and wrote a basic web server in C and uploaded it to the Arduino board and was able to turn the lights on and off via my web browser. Still working on the code..I'll post it when it's done.
Just kind of a fun project.
Last edited: