1/20/23, 12:31 PM Arduino Traffic Light Controller
([Link]
Home ([Link] Arduino ([Link]
Arduino Traffic Light Controller
October 8, 2016 By Administrator([Link]
The use of personal vehicles is very common now a days and a result, the number of vehicles on the roads are exponentially
increasing. Roads without any supervision or guidance can lead in to traffic congestions and accidents.
[adsense1]
Traffic Lights or Traffic Signals are signalling devices that are used to control the flow of traffic. Generally, they are positioned at
junctions, intersections, ‘X’ roads, pedestrian crossings etc. and alternate the priority of who has to wait and who has to go.
The traffic lights will provide instructions to the users (drivers and pedestrians) by displaying lights of standard color. The three colors
used in traffic lights are Red, Yellow and Green.
The system must be used to control the traffic lights for smooth and safe movement of traffic. These control systems consists of
electro mechanical controllers with clockwork mechanisms or modern solid state computerised systems with easy setup and
maintenance.
Select the Next Set of Arduino Projects You Want to Learn in Electronicshub: Arduino Projects
([Link]
usp=sf_link)»
In this project, an Arduino based Traffic Light Controller system is designed. It is a simple implementation of traffic lights system but
can be extended to a real time system with programmable timings, pedestrian lighting etc.
[adsense2]
Outline
Circuit Diagram
Components
Component Description
Circuit Design
Working of the Traffic Light Controller Project
Limitations
Applications
Project Images
Project Code
[Link] 1/12
1/20/23, 12:31 PM Arduino Traffic Light Controller
Circuit Diagram
([Link]
Arduino Traffic Light Controller Circuit Diagram
Components
Arduino UNO [Buy Here ([Link]
1KΩ Resistor X 12
Red LEDs X 4
Yellow LEDs X 4
Green LEDs X 4
Connecting wires
Prototyping board
Power adapter
Component Description
Arduino UNO: The main part of the Traffic Light Controller is the controller itself. Arduino UNO will serve the purpose in this project
to handle all the switching of the LEDs and controlling their timings.
LEDs: The LEDs used in the project are basic 5mm LEDs of Red, Yellow and Green colors. The maximum current that can be allowed
through these LEDs (Red, Yellow and Green in particular) is 20mA. (Foe Blue LED, the maximum current can be up to 30mA).
Circuit Design
Since the project is a traffic light controller, the circuit consists of many LEDs (12 as a matter of fact) as we are implementing traffic
lights at a 4 way intersection. The project is a simple representation of traffic light controller and hence no other extra components
are used.
We need three LEDs of Red, Yellow and Green colors at each intersection. The intersection is divided in to four lanes: Lane1, Lane 2
Lane 3 and Lane 4.
All the LEDs are connected to the Arduino UNO’s digital I/O pins through respective current limiting resistors of 1KΩ.
All the connections are made as per the circuit diagram. The complete wiring diagram of the circuit is shown below.
[Link] 2/12
1/20/23, 12:31 PM Arduino Traffic Light Controller
([Link]
Note: In the practical implementation of the project, we did not use the current limiting resistors as the current from each digital I/O
pin of the Arduino UNO is only 20mA. This small current will not burn the LED. But it is advised to use the current limiting resistors of
at least 220 Ω in series with each LED.
Also note that Arduino UNO in this project acts as source of current for all the LED i.e. it provides the necessary current to turn ON
the LED. Hence, a reliable power supply (like a DC adapter) to power the Arduino UNO must be used.
Working of the Traffic Light Controller Project
The real time traffic light controller is a complex piece of equipment which consists of power cabinet, main controller or processor,
relays, control panel with switches or keys, communication ports etc.
In this project, a simple traffic light system for a 4 way intersection is implemented using Arduino UNO. Although it is not the ideal
implementation for real life scenarios, it gives an idea of the process behind the traffic light control system
The aim of the project is to implement a simple traffic light controller using Arduino UNO, where the traffic is controlled in a pre-
defined timing system. The working of the project is very simple and is explained below.
Consider the following gif image showing a loop of traffic light operations. The project is also implemented in the same manner.
[Link] 3/12
1/20/23, 12:31 PM Arduino Traffic Light Controller
([Link]
DIY Project Kit: Density Based Traffic Signal with Remote Override in Emergency
([Link]
variant=35307877383utm_source=project&utm_medium=bodycontent") »
In that, first the Lane 1 gets its Green light turned. Hence, in all the other Lanes, their corresponding Red lights are turned on. After a
time delay of predefined time say 5 seconds, the Green light in the Lane 3 must be turned on and the Green light in the Lane 1 must
be turned off.
As a warning indicator, the Yellow light in Lane 1 is tuned on indicating that the red light is about to light up. Similarly, the yellow light
in the Lane 3 is also turned as an indication that the green light about to be turned on.
The yellow lights in Lanes 1 and 3 are turned for a small duration say 2 seconds after with the red light in the Lane 1 is turned on and
green light in Lane 3 is also turned on.
[Link] 4/12
1/20/23, 12:31 PM Arduino Traffic Light Controller
The green light in Lane 3 is also turned on for a predefined time and the process moves forward to Lane 4 and finally Lane 2.
The system then loops back to ([Link]
Lane 1 where the process mentioned above will be repeated all over again.
Note: The project implemented here doesn’t include the pedestrian crossing and pedestrian signaling in to consideration.
Limitations
The project is not suitable for actual implementation but just a demonstration of the process behind the system.
Real time traffic light controller systems are generally run time programmable i.e. the operator (usually a policeman) can change
the timings of each lane as per the intensity of the traffic in each lane.
There will also be a provision for either manual operation or pre-programmed operation.
Applications
A simple traffic light controller is implemented in this project with a real chance of expansion.
An external memory can be interface with the main controller so that the timings are not fixed during its programming but
rather can be programmed during operation.
An efficient traffic light controller system will include a pedestrian signaling system.
Project Images
Arduino Traffic Light Controller
Project Code
1 int Lane1[] = {13,12,11}; // Lane 1 Red, Yellow and Green
2 int Lane2[] = {10,9,8};// Lane 2 Red, Yellow and Green
3 int Lane3[] = {7,6,5};// Lane 3 Red, Yellow and Green
4 int Lane4[] = {4,3,2};// Lane 4 Red, Yellow and Green
5
6 void setup()
7 {
8 for (int i = 0; i < 3; i++)
9 {
10 pinMode(Lane1[i], OUTPUT);
11 pinMode(Lane2[i], OUTPUT);
[Link] 5/12
1/20/23, 12:31 PM Arduino Traffic Light Controller
12 pinMode(Lane3[i], OUTPUT);
13 pinMode(Lane4[i], OUTPUT);
14 }
15 for (int i = 0; i < 3; i++) ([Link]
16 {
17 digitalWrite(Lane1[i], LOW);
18 digitalWrite(Lane2[i], LOW);
19 digitalWrite(Lane3[i], LOW);
20 digitalWrite(Lane4[i], LOW);
21 }
22
23 }
24
25 void loop()
26 {
27 digitalWrite(Lane1[2], HIGH);
28 digitalWrite(Lane3[0], HIGH);
29 digitalWrite(Lane4[0], HIGH);
30 digitalWrite(Lane2[0], HIGH);
31 delay(7000);
32 digitalWrite(Lane1[2], LOW);
33 digitalWrite(Lane3[0], LOW);
34 digitalWrite(Lane1[1], HIGH);
35 digitalWrite(Lane3[1], HIGH);
36 delay(3000);
37 digitalWrite(Lane1[1], LOW);
38 digitalWrite(Lane3[1], LOW);
39 digitalWrite(Lane1[0], HIGH);
40 digitalWrite(Lane3[2], HIGH);
41 delay(7000);
42 digitalWrite(Lane3[2], LOW);
43 digitalWrite(Lane4[0], LOW);
44 digitalWrite(Lane3[1], HIGH);
45 digitalWrite(Lane4[1], HIGH);
46 delay(3000);
47 digitalWrite(Lane3[1], LOW);
48 digitalWrite(Lane4[1], LOW);
49 digitalWrite(Lane3[0], HIGH);
50 digitalWrite(Lane4[2], HIGH);
51 delay(7000);
52 digitalWrite(Lane4[2], LOW);
53 digitalWrite(Lane2[0], LOW);
54 digitalWrite(Lane4[1], HIGH);
55 digitalWrite(Lane2[1], HIGH);
56 delay(3000);
57 digitalWrite(Lane4[1], LOW);
58 digitalWrite(Lane2[1], LOW);
59 digitalWrite(Lane4[0], HIGH);
60 digitalWrite(Lane2[2], HIGH);
61 delay(7000);
62 digitalWrite(Lane1[0], LOW);
63 digitalWrite(Lane2[2], LOW);
64 digitalWrite(Lane1[1], HIGH);
65 digitalWrite(Lane2[1], HIGH);
66 delay(3000);
67 digitalWrite(Lane2[1], LOW);
68 digitalWrite(Lane1[1], LOW);
69 }
Arduino view raw ([Link]
Traffic Light Controller ([Link] hosted with ❤ by GitHub ([Link]
Related Posts:
Low Beam VS High Beam - What's the Difference? ([Link]
How to Reset Outdoor Motion Sensor Lights ([Link]
Managed Vs Unmanaged Switch ([Link]
[Link] 6/12
1/20/23, 12:31 PM Arduino Traffic Light Controller
RGBIC vs RGB | Differences, When to Use RGBIC and RGB? ([Link]
Access Point Vs. Extender - Which Wifi is Better? ([Link]
Dual-Band Vs Tri-Band - Find The Difference? ([Link]
([Link]
21 Responses
October 11, 2016 at 10:10 am ([Link]
MinThuAung ([Link] says:
Please EH,
show me a arduino program and schematic for density based traffic light system with ir obstacle sensor.
I’m waiting,please.
Reply
July 20, 2017 at 2:49 am ([Link]
Anusha says:
↪
Hi, We will implement the project and update it as early as possible. Stay tuned.
Reply
May 14, 2019 at 3:07 pm ([Link]
syaamil says:
↪
my fyp project is smart traffic light for ambulance. I plan to add RFID sensor to this project. Mean if the traffic light at ambulance path
is RED, RFID sensor will turn the traffic light to the green. can i just use the same coding and add coding for RFID only?
Reply
March 7, 2017 at 11:57 am ([Link]
AbdulRehman says:
Please send me the presentation or PPT file of this project
Reply
April 23, 2018 at 1:19 pm ([Link]
Merlin says:
↪
You can do this yourself relatively quickly 🙂 take a look at something like Fritzing for circuit and Arduino graphics.
Reply
June 15, 2017 at 8:59 am ([Link]
theodil says:
thank you code working but LED light in disorder
Reply
April 23, 2018 at 1:20 pm ([Link]
Merlin says:
↪
[Link] 7/12
1/20/23, 12:31 PM Arduino Traffic Light Controller
Double check your code and([Link]
wiring. Most likely you have some connections switched around.
Reply
December 15, 2017 at 4:41 am ([Link]
Poornima R says:
Please send us the same program to be implemented with the ultrasonic sensor.
Reply
January 4, 2018 at 6:11 pm ([Link]
John says:
This worked great for me – better than the other two examples I tried that I found on the web.
Any thoughts on how to rewire to push more LEDs? I want to be able to drive a total of 16 sets of traffic lights (four intersections). They will
still use the same program, so each intersection will be in sync with the others (essentially, power 4 LEDs everywhere you show one), but I
fear I may overload the I/O pins since they’ll be pushin 80ma each at any given time – 320ma for the whole board (I think I’m under for the
board but over for each pin). Any thoughts other than relays? Are there relays that run off of such low voltage and current?
Reply
April 21, 2018 at 12:36 pm ([Link]
Merlin says:
↪
A relay or similar is the ideal way to control a higher current load without the risk of damaging the Arduino microcontroller. It’s certainly
feasible to trigger a relay with an Arduino digital output pin, but you might also consider using a transistor or similar semiconductor
switch instead.
Reply
January 28, 2018 at 11:19 am ([Link]
Patrick Boyd ([Link] controller/#comment-308056)
[Link]/dialysis/[Link]) says:
I am designing an HO scale layout for trolley, streetcar, rapid transit cars.,It will have subway, street, & elevated tracks. I will need a traffic
controller for street traffic, 4 light for . 10-12 intersections probably four – six N – S with N – S,, E – W with N – S sequencing one intersection
after another, time cycles, Streetcar can interrupt cycle. Pedestrian has on demand cycle.
One and two lane streetcar street level. Two lane Elevated that loops through the subway, up to ground level on ground on elevated.
Would you suggest a light sensor looking up through the rails? Photoresistor, LM393. Can add light sources in the subway, Street lights for
ground level, lighting on elevated trestle so night operation, signals can be used.
Reply
April 25, 2018 at 12:22 pm ([Link]
Merlin says:
↪
My personal preference is neodymium magnets on the underside of the rolling stock to trigger a Hall effect sensor under the track, as
trying something similar with light sensors proved to be too sensitive to false triggering. These days with Arduino, RFID could be a viable
option also. This gives you the added benefit of knowing which train is passing over the sensor, as well as when.
[Link] 8/12
1/20/23, 12:31 PM Arduino Traffic Light Controller
Reply
([Link]
February 20, 2018 at 9:30 pm ([Link]
shahrim says:
Got some problem with the flow of the light…..normally traffic light is green to yellow and then turn to red…but from red to green no need
yellow then green…
Reply
April 23, 2018 at 1:22 pm ([Link]
Merlin says:
↪
If the lights are going from red straight to green and not yellow first, double check your code; it’s possible you missed something out.
You can modify the light progression by adjusting the sequence of digitalWrites in the loop.
Reply
March 11, 2021 at 11:32 am ([Link]
Ad Hardenberg says:
Hello I changed the code where there is no yellow when switching from red to green;
int Lane1[] = {13,12,11}; // Lane 1 Red, Yellow and Green
int Lane2[] = {10,9,8};// Lane 2 Red, Yellow and Green
int Lane3[] = {7,6,5};// Lane 3 Red, Yellow and Green
int Lane4[] = {4,3,2};// Lane 4 Red, Yellow and Green
void setup()
{
for (int i = 0; i < 3; i++)
{
pinMode(Lane1[i], OUTPUT);
pinMode(Lane2[i], OUTPUT);
pinMode(Lane3[i], OUTPUT);
pinMode(Lane4[i], OUTPUT);
}
for (int i = 0; i < 3; i++)
{
digitalWrite(Lane1[i], LOW);
digitalWrite(Lane2[i], LOW);
digitalWrite(Lane3[i], LOW);
digitalWrite(Lane4[i], LOW);
}
void loop()
{
digitalWrite(Lane1[2], HIGH);
digitalWrite(Lane3[0], HIGH);
digitalWrite(Lane4[0], HIGH);
digitalWrite(Lane2[0], HIGH);
delay(7000);
digitalWrite(Lane1[2], LOW);
digitalWrite(Lane3[0], HIGH);
digitalWrite(Lane1[1], HIGH);
delay(3000);
[Link] 9/12
1/20/23, 12:31 PM Arduino Traffic Light Controller
digitalWrite(Lane1[1], LOW);
digitalWrite(Lane3[0], LOW);
digitalWrite(Lane1[0], HIGH);
digitalWrite(Lane3[2], HIGH);([Link]
delay(7000);
digitalWrite(Lane3[2], LOW);
digitalWrite(Lane4[0], HIGH);
digitalWrite(Lane3[1], HIGH);
delay(3000);
digitalWrite(Lane3[1], LOW);
digitalWrite(Lane4[0], LOW);
digitalWrite(Lane3[0], HIGH);
digitalWrite(Lane4[2], HIGH);
delay(7000);
digitalWrite(Lane4[2], LOW);
digitalWrite(Lane2[0], HIGH);
digitalWrite(Lane4[1], HIGH);
delay(3000);
digitalWrite(Lane4[1], LOW);
digitalWrite(Lane2[0], LOW);
digitalWrite(Lane4[0], HIGH);
digitalWrite(Lane2[2], HIGH);
delay(7000);
digitalWrite(Lane1[0], HIGH);
digitalWrite(Lane2[2], LOW);
digitalWrite(Lane2[1], HIGH);
delay(3000);
digitalWrite(Lane2[1], LOW);
digitalWrite(Lane1[0], LOW);
}
Reply
March 11, 2018 at 10:44 am ([Link]
snglp says:
hi,, wt software (c,c++,java) should use to run this program
Reply
September 15, 2018 at 5:15 am ([Link]
sandeep says:
↪
arduino software
Reply
April 3, 2018 at 8:29 am ([Link]
cliford ([Link] says:
do you have a one-lane traffic controller using arduino system?
Reply
April 23, 2018 at 3:21 pm ([Link]
Merlin says:
↪
[Link] 10/12
1/20/23, 12:31 PM Arduino Traffic Light Controller
So you just want a single red, yellow and green LED? You can do that easily by removing three sets of LEDs and resistors and amending
the code in the loop to only change the three remaining pins.
([Link]
Reply
May 16, 2018 at 1:49 am ([Link]
ashok says:
thank you it is really helped me
Reply
January 11, 2021 at 11:35 am ([Link]
acap says:
how to make this project into less power consumption ? can u give an idea
Reply
Leave a Reply
Your email address will not be published. Required fields are marked *
Comment *
(htt
(htt ps:/
ps:/ /ww (htt
/ww (htt w.y ps:/
[Link] p:// out /ww
ceb twit ube. [Link]
([Link]
ook. ter. com stag
com
co /use ram
/ele m/e r/el .co
Name * Getctro h_o ectr
Our Latest m/e
Newletters
nics rg) onic h_o
hub
Get
shu rg/)
Great Content That You Love.
.org
No Ads Or Spams, We Promise.
bor
Email * ) g)
Enter your email Sign Up
Your Privacy Is Important To Us
Website
General ()
Post Comment
Projects ()
Projects ()
Tutorials ()
[Link] 11/12
1/20/23, 12:31 PM Arduino Traffic Light Controller
About Contact
Advertise with us
([Link]
([Link]
([Link]
Affiliate Disclosure([Link]
Disclaimer([Link]
Terms and Conditions([Link]
Privacy Policy([Link]
Copyright © 2022 [Link]
[Link] 12/12