I always wanted an old traffic signal and finally got one recently.  However, it was very simply wired so that all the lights were fixed on.  What fun is that?  I also wanted to try out an Arduino controller and thought this would be a nice simple project to incorporate it into. 

This Instructable will show you how to wire up an old traffic signal with an Arduino controller to function like a real traffic light.  I used a pretty simple program and controls.  Given the power of the Arduino controller, there are a lot of ways you can customize this.

Step 1: Stuff You Will Need

Obviously you will need an old traffic signal.  I got mine on Craigslist for $40.  It is one of the newer plastic cased ones, but it looks fine from a distance.  I would kind of like an old metal one, but I'll have to upgrade later I guess.

The brains of this thing are going to be an Arduino Uno connected to a relay module. 

Arduino Uno

SainSmart 4-Channel 5V Relay Module
(Note:  This relay is pretty loud.  I can hear it click from across the room.  If anyone has suggestions for something similar that is not as noisy, let me know.)

You will need a power supply (transformer, wall wart, AC/DC adapter) for the Arduino.  I used a 12V 750mA wall wart that I had from some other piece of electronics that had died.  Most 7V to 12 V transformers should work.  You can pick one up at Goodwill for about $2.  Stay away from Radio Shack, they wanted $20-$30 for wall warts!  I am sure someone who knows more about the Arduinos can chime in as to what kind of amperage range you should stay in.  Here's one from Amazon that should work fine:

You will also need some male to female jumpers to connect the Arduino to the relay module (note, I did not have these but wish I did):

Note:  If you do not want to mess with the Arduino, there are a couple ready to go traffic signal controllers available online.  I could have gone this route, but I was really wanting to try out the Arduino:

A lamp or appliance cord with ground wire

Other materials you will need will depend on the starting state of your traffic signal.  I used some 16 ga wire (for the internal line voltage wiring), solder, sheet metal screws (for securing the Arduino and relay module, and attaching ground wires to the frame), wire nuts (for connecting line voltage wires), epoxy (to secure transformer), heat shrink tubing (to insulate transformer connections).


You will need a USB B cable to connect the Arduino to your computer to program it.  If you have a USB printer you should already have one of these.

Wire cutters
Wire strippers
mini flat head screwdriver for relay connections

Other tools you will need will again depend on the initial state of your traffic signal.  I used the following:

Cordless drill (for drilling holes in the case)
Soldering Iron (for wire connections and heat shrink tubing)
Dremel tool with milling bit (cut off some the plastic in the case to make mounting the new components easier)
Eye and hearing protection if you are using power tools.


You will need the Arduino programming software to upload the code to the Arduino:
<p>I have purchased a second traffic light. The first is controlled manually by a latching relay system. Would like to experiment with an arduino micro controller. What made you choose the Arduino board you did choose? Could you get the same functionality from a less expensive board. This will be my first attempt at Arduino from a kit I bought over a year ago. I realize there are many different versions of the board. Just wondering if there is a cheaper solution. </p><p>Thanks,</p><p>TRU</p>
Look above, what should I do with my light
Sorry. Don't understand your question m
<p>I just picked one that I saw many other people using in their instructable projects. I am pretty confident you can make this work with a much simpler project board. This barely uses the available functionality of the Uno.</p>
How should I go about selling this bad boy, so another enthusiast can enjoy it
<p>Nice project and very similar to my own in many respects. Mine is automatic although will also be controlled from the web. I notice on your cct diag you are plugging AC directly into the Arduino - do they rectify AC?</p><p>Many thanks</p><p>D6</p>
<p>Can this be done using a remote type button. I would like to be able to use a sensor somewhat like what is on a garage door opener to switch the light from green to orange to red and back. Grandkids would love it when we come home. What would you suggest?</p>
this might be a solution...Hot ! Thunbird New 12v 4 Channel Wireless Remote Control Receiver Momentary Switch https://www.amazon.com/dp/B00BQ842DG/ref=cm_sw_r_other_awd_04bgxbGQKE213
<p>It has been over a year since looking for information here, and almost 2 years since I started on this project. Overall, I did the research bought a couple parts and handed it off to a very willing buddy to make it happen. Here are images of my final product of manual switching of lights with no controller. If you want more information go here ... </p><p><a href="http://www.diychatroom.com/f18/manual-button-controls-traffic-light-197259/index2/#post3044393" rel="nofollow">http://www.diychatroom.com/f18/manual-button-contr...</a></p><p>Good luck and thanks to those who shared information</p><p>TRU</p>
<p>Anybody help me? I have a traffic light and one of those halloween sensor pads. I want my traffic light to stay green when powered on and switch to yellow when the pad is pressed. Then switch to red when the pad is pressed again. Then green.</p>
<p>I'm not sure what a halloween sensor pad is, but I am guessing it is a momentary switch. If that is what it is you should be able to incorporate it into the arduino.</p><p>Here is a quick tutorial showing how to us a momentary switch with arduino: </p><p>https://www.instructables.com/id/How-to-use-a-Push-Button-Arduino-Tutorial/</p>
anybody know how to wire with 3 momentery switches instead of arduino?
<p>Maybe? Let me know if this is what you are trying to do:</p><p>3 Buttons, push one for green, push another for yellow, push another for red? The other lights go off when you push a different switch?</p>
Yes! Would even be nice to have one more button to turn all lights off. Could use this, or build custom box with custom buttons.<a href="http://www.amazon.com/Mushroom-Emergency-Latching-Button-Station/dp/B008LT328Y/ref=sr_1_97?ie=UTF8&qid=1425523681&sr=8-97&keywords=4+button+amico" rel="nofollow">http://www.amazon.com/Mushroom-Emergency-Latching-Button-Station/dp/B008LT328Y/ref=sr_1_97?ie=UTF8&amp;qid=1425523681&amp;sr=8-97&amp;keywords=4+button+amico</a>
<p>Just to be clear, if you used momentary switches, the lights will only be on while you are holding the button down. If you want each switch to act like an on/off toggle, that is a different configuration.</p>
<p>Hmm... I thought that momentary switches in combination with a relay board would allow for sequence you named originally?</p>
<p>A momentary switch is only on while being held down. The relay is only switched on while is receiving current on the signal side. </p><p>I thought about how to make this work the way you want, but I am not sure how to accomplish it without using a Arduino or other controller. With the Arduino, you should be able to program it to switch on and off the appropriate relays when it received a momentary signal from one of the switches.</p>
<p>Thanks for your time on this. Greatly appreciated. My original venture was this post where I discovered from others the use of relays. </p><p><a href="http://www.diychatroom.com/f18/manual-button-controls-traffic-light-197259/" rel="nofollow">http://www.diychatroom.com/f18/manual-button-controls-traffic-light-197259/</a></p><p>Never went any further than the thread as it was beyond my comprehension. Once I discovered the relay boards I thought it might be a solution. Perhaps it is the &quot;latching relay&quot; that is needed? Anyways, until I find a doable solution this is my current solution, a 4 position rotary switch. </p><p><a href="http://www.amazon.com/gp/product/B009IS73I2/ref=oh_aui_search_detailpage?ie=UTF8&psc=1" rel="nofollow">http://www.amazon.com/gp/product/B009IS73I2/ref=oh_aui_search_detailpage?ie=UTF8&amp;psc=1</a></p><p> Not a bad solution, but a little clunking moving through lights. Again... thanks for your time and wisdom.</p>
<p>I think user &quot;mpoulton&quot; at the linked site figured it out. I did not know about latching relays, but it sounds like they should work with using momentary switches like you are trying to do. I'll quote his text and picture here in case anyone else is trying to figure this out.</p><p>The thing I am not sure about is where to get the three pole, double throw relays. You may want to check in one of the electronics forums on here to see if someone who knows more than me can find you the appropriate part. I think &quot;3PDT latching relay&quot; is what you need to look for, but I am not sure on the exact specs you want. You may want to set it up the switch circuit with all low voltage relays and tie the outputs on them to basic low voltage to high voltage relays to control the line level current going to the lights.</p><p>Just based on what I am comfortable working with and what I am guessing all of the relays will cost is that you, is that you could buy an Arduino or other controller and program it to do the same thing for less money and trouble.</p><p>&quot;The relay setup is not terribly complicated, but you'll need to really <br>understand how it works to do it successfully. There are numerous <br>possible relay configurations that would work. I'd start with three <br>relays, each 3-pole double-throw. Each relay controls one light. The <br>button for each light activates the relay coil, which is wired through <br>one pole of each of the other two relays (normally-closed), and latches <br>because you connect the relay coil to the light also. Then when either <br>of the other two relays are activated, it breaks the coil circuit for <br>the other relay so that it deactivates. This gives you three latching <br>relays, where each one unlatches the others.&quot;</p>
<p>Wonder if this board kit works the same as those relay boards designed for arduino. https://www.parallax.com/product/27114 If so, no need for the board as the video here <a href="https://www.youtube.com/watch?v=0oXl7_hj1o4" rel="nofollow">https://www.youtube.com/watch?v=0oXl7_hj1o4 </a>explains how to &quot;cleverly wire&quot; a two relay board for three lights. If the parallax board is needed, then there is the down side of paying for a board that you have to build. Hmmmm.....?</p>
<p>I looked at that, and it looks like it is just a basic relay board. You can buy an equivalent one already assembled for less money. The one I have linked about has four channels and is only about $10. It would still require an Arduino or other controller to send the appropriate on/off signals. </p>
<p>It's really an interesting prject, here's mine! ;)</p>
<p>Nice Job! Are you using an AC to USB adapter to power the arduino? That's not a bad idea.</p>
<p>Yeah, my arduino was a little broken and I coludn't use any normal power supply's anymore. Thanks for replying by the way, I appriciate it! :)</p><p>This was also my first arduino project so thanks for helping me out.</p>
I AM TRYING TO MAKE A 2 WAY TRAFFIC CONTROLLER using arduin uno R3 <br>this is the pdf link (http://nostarch.s3.amazonaws.com/arduino_project5.pdf) containing circuit layout and the schematics thati have been working with. but the arduino ide came up with a range of errors in the code when i tried to upload it. <br>plz help me write/modify the code for the circuit mentioned in the pdf. <br>thanks. <br>p.s. : i am a beginner and ur help will be greatly appreciated
The one I'm waiting for would allow a timed cycle where the green illuminates for Seconds(x), then the Amber/Yellow for Seconds(y) and finally the red illuminates for Seconds(z) - Maybe even flashes.
You should be able to do that with this setup. If you look at the Arduino coding on step 4, you can change any of the values such as &quot;delay(20000)&quot; to get the timing you want. This tells it to hold whatever it is doing for 20,000 milliseconds or 20 seconds. You can move the code lines around to change the sequence too.
&quot;20,000 milliseconds or 20 seconds.&quot;<br><br>Would 2 min 30 sec be possible as well?<br><br>Ideally, I'd like 2:30 Green; 29 sec amber (flashing with increasing rapidity of possible) and red -until reset - at the 3 min mark. <br><br>And, to build the entire thing in a package small enough to be easily portable (in a briefcase/purse), be battery-powered and fit conveniently upon a small table. <br><br>And, of course I know noting about Ardurno's !!
Hey charlessenf-gm! I may be a bit late, but maybe you'll see this anyway.<br> What you describe should be possible.<br> <br> When it comes to timing and pattern of the lights, there are no real limits.<br> You can have it flash and hold just the amount of time you like.<br> You could even add some random seconds to make it more interesting or even activate switching to green with a button or photocell.<br> <br> When it comes to building it small. You can't really have the traffic light in your briefcase, but if you take the actual light out of the equation (or use a model with LEDs) you could even make something that would fit in a big pocket.<br> <br> I had some fun with a few single-light LED traffic light and the arduino-based digispark at my office. Using the same (but 8-channel) relay module.<br> <a href="http://www.youtube.com/watch?v=zg1S4D_VZ3A" rel="nofollow">http://www.youtube.com/watch?v=zg1S4D_VZ3A</a><br> <br> The micro-controller is about the size of a stamp. The big parts are the 5V power supply and the 8-channel relay module. If you made one controling LEDs and running on a 9V battery, you could probably make it fit a small matchbox.<br> <br> Just send me a message if you want to ask someting. Here, on the youtube-link or my mail: christofer.weber@gmail.com<br> <br> /Weber - Traffic Light technician.
Nice! <br>I just made pretty much the exact same project a few weeks ago. <br>I used 3 solid state relays from sparkfun. <br>https://www.sparkfun.com/products/10636 <br> <br>I made the board for a friend, who's adding it to his traffic light. He's now in the middle of hooking it up with an infrared sensor that many outside lights use these days. That way it will stay off most of the time and will come on automatically when someone walks close to it. <br>
Nice design and compact too.
Great ! <br>I've to do something like that for a friend. <br>But I think I'll use LED lamp and Ampli-OP. <br>By the way, don't you plan to add potentiometers to change the time-settings &quot;on the flow&quot; ? Or a mic to use the traffic signal as a vu-meter ?
Now you are getting way too fancy for me. I figure if I want to change up the timing I can always just re-flash the Arduino. Those are good ideas for mods though.
The one I'm waiting for would allow a timed cycle where the green illuminates for Seconds(x), then the Amber/Yellow for Seconds(y) and finally the red illuminates for Seconds(z) - Maybe even flashes.
Nice idea, one day I was driving along and some workers were replacing old stop lights with new LED ones. I jumped out of my car at the lights, asked if I could have one, threw it in the back and away I went. Hadn't thought of using my arduino for something like this.
Free stuff is the best.
Nice Project. I was thinking of doing something like this for my future office space. Instead of having it cycle, I would have a control unit to change the lights programmed on my computer. That way if I don't want to be disturbed the light is red, yellow is proceed with caution, and green is welcome.
Good idea!
Nice work! <br>You can eliminate the relay noise by using solid state relays. <br> <br>http://www.ebay.com/sch/i.html?_trksid=p2050601.m570.l1313&amp;_nkw=SainSmart+4-Channel+solid+state&amp;_sacat=0&amp;_from=R40 <br> <br>
Sweet. I think maybe I will swap that out and use the current one for another project. The clicking is pretty annoying.
Nice project. I've had a traffic light for years (picked it up at a DOT auction), and got an Arduino and a relay controller (EFX-TEK RC-4 relay board http://www.efx-tek.com/topics/rc-4.html) to do the same thing. I'm kinda stuck on how to mount everything since my light is metal and I want to make sure I don't zap myself with 120V. <br> <br>I'd like to add a switch to go between some different modes, like blink, all on, random, blink in time to music, and maybe add a distance sensor to tell a car when to stop.
As long as you mount everything so nothing is shorting against the case, and you ground the case, you should be fine. Look at how your PC case is put together for an example. <br> <br>Alternatively or additionally, if there is enough room in the case, you could put plastic junction boxes inside it to house the electronics and wire connections.
Where'd you get the stopllight?
Craigslist.org You can find anything there with some patience. The person I bought it from originally bought it at a municipal auction.
Great project. I have found traffic lights on ebay too. <br> <br>I still need to post my project, but I tapped into a &quot;Park-Zone parking aid&quot; with some relays and am using that to control a (retired chicago) traffic light (purchased on ebay) in my garage. <br> <br>Little cooler than a tennis ball hanging from the garage ceiling ;-) <br> <br> <br>
Someone else asked me how to incorporate a range finder for this purpose. I would recommend checking out this Instructable by RuiSantos: https://www.instructables.com/id/Distance-Sensor-with-LEDs-and-buzzer/ <br> <br>It looks like he has a pretty good design for one which could be used as a starting point. A relay module could be inserted into his design instead of the LEDs to control the stop light. <br> <br>You guys are making me want to incorporate this into mine now!

About This Instructable




Bio: Drunk posting ill conceived instructables since 2009.
More by fzumrk:Clean Peanut Butter Jar for Recycling iPod Shuffle Organizer from recycled gift card Traffic Signal / Stop Light Wiring with Arduino Controller 
Add instructable to: