0% found this document useful (0 votes)
15 views9 pages

Trafficlightcontrol

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views9 pages

Trafficlightcontrol

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

A Report

on

Traffic Light Controller by


Arduino

Presented by:
Omkar Sanjay Chaudhari
Problem:
The traffic lights should provide instructions to the users
(drivers and pedestrians) by displaying lights of standard
colours, using Arduino.

Proposed Solution:
We can use Arduino UNO to solve the problem as mentioned
above. An algorithm can be developed using this
microcontroller along with LEDs of Red, Yellow and Green
colour to demonstrate.

 Arduino UNO:
The Arduino Uno is an open-source microcontroller
board based on the Microchip ATmega328P
microcontroller and developed by Arduino.cc. The board
is equipped with sets of digital and analog input/output
pins that may be interfaced to various expansion boards
(shields) and other circuits. The board has 14 digital I/O
pins (six capable of PWM output), 6 analog I/O pins, and
is programmable with the Arduino IDE (Integrated
Development Environment), via a type B USB cable. It
accepts voltages between 7 and 20 volts.
 Arrangement of Traffic lights:
1. In the solution worked out here the traffic lights are
arranged in 4 different directions i.e. North, South,
East and West respectively.
2. Each traffic light consists of three different LEDs
i.e. Red, Yellow and Green respectively. In total
there are 12 LEDs that are used.
3. The LEDs connected here are in common cathode
configuration i.e. all the cathodes of LEDs are
connected together and then are connected to
ground.
4. The 12 LEDs are connected to the digital I/O pins of
the Arduino UNO Board.
5. The digital pins are declared as the output pins.
6. Here, the algorithm is simulated using ISIS Proteus
Professional.
 Algorithm
1. In this, first the West gets its Green light turned. Hence,
in all the other Lanes, their corresponding Red lights are
turned on.
2. After a time delay of predefined time say 5 seconds, the
Green light in the North must be turned on and the Green
light in the West must be turned off.
3. As a warning indicator, the yellow light in the North is
also turned as an indication that the green light about to
be turned on.
4. The yellow lights in North are turned for a small duration
say 2 seconds after which the red light in the West is
turned on and green light in North is also turned on.
5. The green light in North is also turned on for a
predefined time and the process moves forward to East
and finally South.
6. The system then loops back to Lane 1 where the process
mentioned above will be repeated all over again.
Simulation:
Arduino IDE Program Code:

int sig1[] = {13, 12, 11};


int sig2[] = {8, 9, 10};
int sig3[] = {5, 6, 7};
int sig4[] = {4, 3, 2};
int rDelay = 3000;
int yDelay = 1000;
void setup() {
// Declaring all the LED's as output
for (int i = 0; i < 3; i++) {
pinMode(sig1[i], OUTPUT);
pinMode(sig2[i], OUTPUT);
pinMode(sig3[i], OUTPUT);
pinMode(sig4[i], OUTPUT);
}
}
void loop() {
// Making Green LED at signal 1 and red LED's at other signal
HIGH
digitalWrite(sig1[2], HIGH);
digitalWrite(sig1[0], LOW);
digitalWrite(sig2[0], HIGH);
digitalWrite(sig3[0], HIGH);
digitalWrite(sig4[0], HIGH);
delay(rDelay);
// Making Green LED at signal 1 LOW and making yellow LED at
signal 1 HIGH for 2 seconds
digitalWrite(sig1[1], HIGH);
digitalWrite(sig1[2], LOW);
delay(yDelay);
digitalWrite(sig1[1], LOW);
// Making Green LED at signal 2 and red LED's at other signal
HIGH
digitalWrite(sig1[0], HIGH);
digitalWrite(sig2[2], HIGH);
digitalWrite(sig2[0], LOW);
digitalWrite(sig3[0], HIGH);
digitalWrite(sig4[0], HIGH);
delay(rDelay);
// Making Green LED at signal 2 LOW and making yellow LED at
signal 2 HIGH for 2 seconds
digitalWrite(sig2[1], HIGH);
digitalWrite(sig2[2], LOW);
delay(yDelay);
digitalWrite(sig2[1], LOW);
// Making Green LED at signal 3 and red LED's at other signal
HIGH
digitalWrite(sig1[0], HIGH);
digitalWrite(sig2[0], HIGH);
digitalWrite(sig3[2], HIGH);
digitalWrite(sig3[0], LOW);
digitalWrite(sig4[0], HIGH);
delay(rDelay);
// Making Green LED at signal 3 LOW and making yellow LED at
signal 3 HIGH for 2 seconds
digitalWrite(sig3[1], HIGH);
digitalWrite(sig3[2], LOW);
delay(yDelay);
digitalWrite(sig3[1], LOW);
// Making Green LED at signal 4 and red LED's at other signal
HIGH
digitalWrite(sig1[0], HIGH);
digitalWrite(sig2[0], HIGH);
digitalWrite(sig3[0], HIGH);
digitalWrite(sig4[2], HIGH);
digitalWrite(sig4[0], LOW);
delay(rDelay);
// Making Green LED at signal 4 LOW and making yellow LED at
signal 4 HIGH for 2 seconds
digitalWrite(sig4[1], HIGH);
digitalWrite(sig4[2], LOW);
delay(yDelay);
digitalWrite(sig4[1], LOW);
}
Conclusion:
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.

You might also like