
ARDUINO BASED TRAFFIC SIGNAL MODEL
Overview
In this project, I made a model traffic signal for cars approaching a one way road. I used three different LED's in order to indicate which set of traffic should flow. The red LED's signal cars to stop, the green LED's signal cars to go, and the yellow LED's signal that the light is about to change. If the signal is red for one side of the traffic, then the signal is green for the other side. This helps to maintain order and prevent any crashes or accidents from occurring.
My model traffic signal is manually controlled, with a button or a switch for each side of the traffic signal. This particular one-way road is used mainly for vehicles traveling from the west to the east, or in the eastward direction. This is why the signal is green as default for the traffic coming from the west direction. If by chance there are any vehicles coming from the east direction, then the east switch must be pressed to indicate this. When this east switch is pressed, then the light will change from red to green for the traffic traveling from the east direction to the west direction for 10 seconds. After the 10 seconds are up, then the signals will automatically change back to how they were before, where they were green for vehicles traveling from the west and red for vehicles traveling from the east. If any other vehicles come from the east, intending to travel to the west, then the east switch must be pushed again, restarting the whole process.
Materials/Hardware
The materials/hardware required for this manually-operated traffic signal are:
Two red LEDs (LED1 and LED2)
Two yellow LEDs (LED3 and LED4)
Two green LEDs (LED5 and LED6)
Six 560 Ω resistors (R1 to R6)
Two 10 kΩ resistor (R7 and R8)
Two 100 nF capacitors (C1 and C2)
Two push buttons (S1 and S2)
One medium-sized breadboard
One Arduino and USB cable
Various connecting wires
Below are some pictures of all the wiring and connections between the LED's, the switches, and the Arduino board.
Arduino Code
The Arduino code that I used for my model traffic signal was custom. I made many changes to this code from the original one given on the website that I used to base my project off of.
Supplements
Along with the model traffic signal, I also made a simple Alice video which depicts how my model traffic signal works. It is embedded in the website whose link is below.
This Alice video shows the basic concept of how the cars approach the signal that I created using Arduino. The cars traveling from the west (in this case the left hand side of the video) are allowed to pass, since they are the ones with the default green light. But, when a vehicle (the ambulance) comes from the east side (in this case the right hand side of the video), then the button must be pushed to change the light. After the button is pushed (in this case by the cop car), then the light changes from green to red for the vehicles traveling from west to east and in turn changes from red to green for the vehicles traveling from east to west. After the 10 seconds are up, the lights again go back to default.
Sources
I based my project off of the project explained on the website http://nostarch.s3.amazonaws.com/arduino_project5.pdf, but I made many changes to my personal project.
For more information, please visit: https://sites.google.com/site/yashagarwal159/projects/arduino-traffic-signal


