ARSI UNIVERSITY
COLLEGE OF NATURAL AND COMPUTATIONAL SCIENCE
DEPARTMENT OF COMPUTER SCIENCE
Individual assignment of microprocessor
Prepared by:
NAME: ID:
YAHYE ALI UGR/14442/15
Submitted to: mr.shambel
Submission date: 23 mar 2025
Microprocessor-Based Traffic Light Control System
Introduction
Traffic lights are a crucial component of managing road traffic and ensuring safety
at road intersections. They control the flow of vehicles and pedestrians, reducing
the likelihood of accidents and traffic congestion. In modern systems,
microprocessors are widely used to automate traffic flow and make it more
efficient, replacing traditional mechanical or manually operated systems.
This is a design project on a microprocessor-based traffic light control system to
control the traffic at a four-way intersection. By utilizing a microprocessor, the
system can efficiently control the timing of traffic lights, offering a smooth and fair
distribution of road use in different directions.
Importance of Traffic Light Automation
Reduces Human Dependency: An automated traffic control system, in
contrast to manual systems, does not require continuous monitoring.
Enhances Traffic Efficiency: By imposing a structured light cycle, the traffic
flow is optimized, with minimum congestion.
Increases Road Safety: By giving proper light sequences, accidents are
avoided.
Flexibility: The system is upgradable to include sensors for real-time
monitoring of traffic and adaptive signal control.
System Objectives
The system operates on a set timing cycle to ensure smooth traffic flow. The
primary objectives are:
Successfully managing the traffic flow using a microprocessor.
Implementing timing-based control for east-west and north-south directions.
Simulating real traffic light control using hardware and software modules.
Permitting cycle repetition for continuous operation.
Designing a flexible and modifiable system for future improvements and
upgrades.
Objectives of the System
The system operates on a predefined timing cycle, ensuring smooth traffic
movement. The key objectives include:
Efficiently managing traffic flow using a microprocessor.
Implementing timing-based control for east-west and north-south
directions.
Using hardware and software components to simulate real-world traffic
light control.
Ensuring cycle repetition for continuous operation.
Providing a scalable and modifiable framework for potential future
enhancements.
System Requirements and Operation
The system must function according to the following specifications:
1. East-West Traffic Flow: The traffic from east to west and west to east should be
allowed for 5 seconds while the north-south direction remains stopped (red light
ON).
2. North-South Traffic Flow: The traffic from north to south and south to north
should be allowed for 20 seconds while the east-west direction remains stopped
(red light ON).
3. Cycle Repetition: The process should continuously repeat, ensuring a controlled
and automated traffic system.
To achieve this functionality, the system will be implemented using a
microcontroller, LEDs (as traffic signals), and timing control mechanisms to
simulate the traffic flow.
The system can be further expanded to include:
Pedestrian crossing signals to enhance safety.
Adaptive control using sensors to dynamically adjust the timing based on
traffic density.
Emergency vehicle priority system to allow ambulances and fire trucks to
bypass signals.
Hardware Components
The traffic light control system consists of the following hardware components:
Microcontroller Unit
Microprocessor (e.g., 8051, PIC, or Arduino): The central control unit
that executes the traffic light logic.
Clock Circuit: Generates timing signals for controlling the duration of
each traffic phase.
LED Traffic Lights
Red LED: Indicates STOP.
Yellow LED: Indicates WARNING before switching.
Green LED: Indicates GO.
LEDs are used to simulate the actual traffic lights at an intersection.
Resistors
Used to limit current to the LEDs and prevent damage.
Power Supply
A 5V or 12V power supply is required to power the microcontroller and
LEDs.
Relay Module (Optional)
If controlling real traffic lights, relays can be used to switch high-voltage
lamps instead of LEDs.
System Design and Working Principle
Traffic Light Timing and Sequence
The system follows a predefined sequence:
1. East-West Green (5 seconds) → North-South Red
2. East-West Yellow (2 seconds) → North-South Red
3. East-West Red (20 seconds) → North-South Green
4. East-West Red (2 seconds) → North-South Yellow
5. Cycle repeats
Timing Diagram
Time (Seconds) East-West Light North-South Light
0-5 Green Red
5-7 Yellow Red
7 - 27 Red Green
27 - 29 Red Yellow
29 - 34 Green Red
... (Repeat) ...(Repeat) ...(Repeat)
Software Design and Implementation
The traffic light system is programmed using embedded C or Arduino C to
control LED outputs based on the timing schedule.
Programming Logic
The microcontroller executes the following steps:
Initialize the system and set default traffic light states.
Activate Green light for East-West, Red light for North-South, and wait
for 5 seconds.
Activate Yellow light for East-West for 2 seconds before transition.
Activate Green light for North-South, Red light for East-West, and wait
for 20 seconds.
Activate Yellow light for North-South for 2 seconds before transition.
Repeat the process continuously.
Arduino Code Implementation
void setup() {
pinMode(2, OUTPUT); // East-West Green
pinMode(3, OUTPUT); // East-West Yellow
pinMode(4, OUTPUT); // East-West Red
pinMode(5, OUTPUT); // North-South Green
pinMode(6, OUTPUT); // North-South Yellow
pinMode(7, OUTPUT); // North-South Red
}
void loop() {
// East-West Green, North-South Red (5s)
digitalWrite(2, HIGH); digitalWrite(4, LOW);
digitalWrite(7, HIGH);
delay(5000);
// East-West Yellow (2s)
digitalWrite(2, LOW); digitalWrite(3, HIGH);
delay(2000);
// East-West Red, North-South Green (20s)
digitalWrite(3, LOW); digitalWrite(4, HIGH);
digitalWrite(5, HIGH); digitalWrite(7, LOW);
delay(20000);
// North-South Yellow (2s)
digitalWrite(5, LOW); digitalWrite(6, HIGH);
delay(2000);
digitalWrite(6, LOW);
}
Conclusion
The microprocessor-based traffic light control system presented in this project
offers an efficient and automated approach to managing traffic at a four-way
intersection. By utilizing a microcontroller, the system ensures smooth traffic flow
through predefined timing cycles for east-west and north-south directions. The
system's structured timing, implemented using LEDs and programmed in
embedded C/Arduino, enables continuous operation without manual intervention.
This design enhances road safety by enforcing proper traffic light sequences and
minimizing congestion. Additionally, the system is scalable and can be upgraded
with advanced features such as sensor-based adaptive control, pedestrian crossings,
and emergency vehicle prioritization.