Introduction: How to Make a Working Traffic Light With an Auduino Board

Traffic lights are signalling devices commonly used road intersections, pedestrian crossings, and other locations to control flows of traffic. A manually operated gas-lit traffic light was first of its kind and the technology has greatly improved since its introduction in winter 1868.

This instructable will go through how to create your own manually controlled traffic light using an Auduino board, along with some coding.


Apart from an Auduino board, you will need the following hardware to make your own controllable traffic light:

  • 3 LEDs (1 red, yellow, and green LED each)
  • A breadboard
  • 3 220 Ω resistors
  • 14 jumper wires
  • 1 push-button switch
  • 1 high value resistor (preferably a 10,000Ω resistor)

Step 1: Setting Up the Circuit

Before we can program the traffic light, we need to set up circuit in an arrangement with the button, resistors, LEDs, and wires put into place. Start by hooking up your Auduino Board to a breadboard, as seen in image #1.

Start by connecting one pair of red and black wires the parallel power rails, red for the positive rail, and black for the negative rail. Then connect another pair of red and black wires to the Auduino board ports, the red wire should be connected to the 5V slot, and the black wire should be connected to the second GROUND slot. Once you've done this, you may set up the LEDs, button, and resistors, as seen in image #2.

Begin by getting 3 220Ω resistors and set them up in a column arrangement, following with the 3 LEDs, put in this colour order: Red, Yellow, and Green. The negative legs on each LED should be connected on the same row as the resistors perpendicular to them. Place the button legs in the rails that are separated by a divider in the middle of the bread board, along with a resistor. Once you've done this, proceed to connect the wiring to the components that we will need to program in Step 2. Refer to image #3 to finish wiring up your circuitry.

Grab 10 jumper wires and hook up the Red LED row to pin #10, the Yellow LED row to pin #9, and the Green LED row to pin #8. Connect the push-button power and ground wires into it's respective places, as seen in image #3. Finally, connect the top right button leg to pin #12. Refer to all images if you aren't confident that your circuit is correct. Once you've confirmed that your final circuit matches image #3, proceed to step 2.

Step 2: Programming the Circuit

Proceed to open up a programming interface that is compatible with your Arduino board (ie. TinkerCAD, Arduino IDE, etc.), and copy the code shown above. If done correctly, your circuit should have all LEDs off at first. Once you press the button, your green LED will light up. Once more, your yellow LED will light up and your green LED will turn off. Finally, pressing it one more time will light up your red LED, and power off your yellow LED. Pushing this button one more time will turn off all LEDs and finish the loop. Pressing the button again will repeat the traffic light loop.

Step 3: Integrating Morse Code Into the Traffic Light

Once you're satisfied with your code and want to try out something different, you can code out a Morse code output system out of the traffic light LEDs. This code prints out the letter in the Serial Monitor when the LED begins to output the letter in Morse code.

Keep in mind that the "SOS" pattern only uses the Red LED to emit the message, while the "VACATION" pattern uses both the Red and Green LEDs to differentiate dots and dashes. If done correctly, the green LED for the "SOS" pattern should light up once to indicate the cycle has completed, and it will restart momentarily, and the yellow LED for the "VACATION" pattern should light up in place of the green LED as its being used for dashes, however this serves the same purpose as a green LED in the "SOS" pattern. To switch patterns, press and hold the button for five seconds when either the green or yellow LED lights up in the "SOS" or "VACATION" pattern respectively.

Step 4: Abstract


What is a traffic light?

Traffic lights are automatic signalling devices commonly used road intersections, pedestrian crossings, and other locations to control volumes of traffic. A manually operated gas-lit traffic light was first of its kind and the technology has greatly improved ever since its introduction in winter 1868.

Creating the circuitry

The circuitry consists of a basic breadboard, an Arduino board, 3 LEDs, 4 resistors, 1 push button, and numerous wires. Assembling this contraption takes some patience and time as the circuit component placements must be perfect, as placing one component in the incorrect spot can lead to a malfunctioning circuit system and some things may not work properly.


Various methods can include a manual switch that can cycle through the three phases, which can be achieved by using a button or lever switch with numerous "gears." Pressing a button will cycle through the 3 phases one by one in the appropriate order, changing the "position" of a lever on the other hand will change the phase depending on what position it is in (ie, left end of the lever is red, middle is yellow, right end is green). People can also try to make the signal automated by programming the traffic light to change it's light aspect at timed intervals (ie, 30 seconds for green, 5 seconds for yellow, and 60 for red).


In conclusion, recreating a traffic light on a breadboard scale size is possible, and comes with unique limitations and variety in it's function and operation.

Step 5: Conclusion

Once everything is in place, double check for any errors in the code you've copied by typing to ensure everything works. Below is a video of the Morse code sequence integrated into the traffic light circuit in action, along with the letters being printed into the Serial Monitor!

First Time Author Contest

Participated in the
First Time Author Contest