I built a little gadget to run a traffic signal in the office for a quick status to see how we are doing in our ticket system.
- RepairShopr.com account (free)
- Teleduino account (free)
- Arduino + ethernet shield
- Breadboard, wires, etc
- 3+ port relay board
Step 1: Hack Apart the Traffic Light
When you peel the back off the traffic light, you'll notice something strange.. There is no circuitry that makes the lights blink - which makes it confusing to figure out how to make them stop blinking.
Well.. you'll need new bulbs. They are blinking bulbs.. I had some laying around, I hope you do too
I left the orange wires that are hooked up to the bulbs, but cut off the wire that came up the base of the traffic light.
I ran 4 new leads up that base and to my relay board.
1 side of the AC circuit went to the bottom of all the light bulbs with a crimp connector, the other side of the AC circuit went to the relay board, and from the relay board up to the other side of each light bulb.
Put the traffic signal back together..
Step 2: Wire Up the Relay Board to Arduino
I used GND/PWR 5 on the arduino to go to the VCC/GND on the relay board - this gives it the power it needs to flip the relays.
Next choose which OUTPUT pins on the arduino you want to drive the relay switches, those get hooked up to the IN pins on the end of the relay board, and to the OUTPUT pins on your arduino.
At this point you should be able to turn pins on from the arduino and see the relays activate, they have a red status light so you know if they are "on"
The left-most 2 pins coming out of each relay are the 2 to use, those 2 will be 'closed' when the relay is 'on'
From the AC power, go in to the first pin on each of the first 3 relays you want to use.
On the second pin go out to the traffic light.
When the relay is on it should supply 120v across the relay to the christmas light bulbs in the traffic light.
Step 3: Get the Software Hooked Up
Go get the teleduino library - there are good instructions on this site for that! Put in your key and upload it to your arduino.
Go get the rails app I used to control mine - https://github.com/theinventor/TroyDuino
I put a couple buttons on the page that setup the pins for OUTPUT, then a couple buttons to turn pins on and off.
The magic happens when you hit /poll on the rails app.
You'll see in the controller action it goes to the repairshopr API, looks for ticket statuses - and changes the traffic light based on how the shop is doing!