A
PROJECT REPORT
On
Traffic Lights
Submitted to
MIT ADT University, Pune
in partial fulfillment of the requirements for the Mini-Project of the course
Processor Architecture Interface PAI (23CSE1007)
Submitted by
Ritisha Bobde - ADT23SOCB0855
Nandini Gupta - ADT23SOCB0635
Priyadarshini Wani - ADT23SOCB0804
Prakash Vislavath - ADT23SOCB0736
Under the Guidance of
PROF. SHRADDHA KASHID
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
MIT SCHOOL OF COMPUTING, MIT ADT UNIVERSITY
RAJBAUG, LONI KALBHOR, PUNE – 412201
Traffic Lights
Department of Computer Science and Engineering,
MIT School of Computing,
MIT Arts, Design and Technology University, Pune
1. Introduction - The project titled Traffic Light Implementation using Arduino Uno
aims to simulate the functionality of a standard traffic light system. Traffic lights are
critical in ensuring road safety and traffic management by regulating the flow of
vehicles and pedestrians. In this project, an Arduino Uno microcontroller is used to
control three LEDs—red, yellow, and green—representing the signals of a traffic light
system. The program is written in C++ using the Arduino IDE and emphasizes a
simple yet effective approach to demonstrate the sequence of operations typically
seen in real-world traffic light systems.
2. Objectives –
To design a functional simulation of a traffic light system using Arduino Uno.
To understand and implement basic LED control using digital pins.
To explore timing control using the delay() function in the Arduino IDE.
To demonstrate sequential operations using microcontroller programming.
3. Components Required –
Arduino Uno R3
1 k ohm Resistor
Red LED
Yellow LED
Green LED
4. Working Principle –
The system operates by sequentially lighting up red, yellow, and green LEDs,
mimicking the standard traffic signal process.
1. Setup Phase: The setup() function initializes the pins associated with the LEDs
as output.
2. Operation: The loop() function handles the continuous execution of the traffic
light sequence:
o The red LED is turned on for 6 seconds to indicate stopping.
Department of Computer Science and Engineering,
MIT School of Computing,
MIT Arts, Design and Technology University, Pune
o The yellow LED lights up for 1 second, signaling vehicles to prepare to
stop or go.
o The green LED is illuminated for 5 seconds, indicating vehicles can
proceed.
The sequence is repeated in a loop, maintaining a consistent traffic
flow pattern.
The timing delays are achieved using the delay() function, providing the necessary
pauses between state changes.
5.Circuit Design
Department of Computer Science and Engineering,
MIT School of Computing,
MIT Arts, Design and Technology University, Pune
6. Code Implementation
The system operates by sequentially controlling three LEDs—red, yellow, and green—to
mimic the operation of a standard traffic light. The process begins in the setup phase, where
the setup() function initializes the digital pins connected to the LEDs. These pins are
configured as outputs using the pinMode() function, enabling the Arduino to control the
LEDs effectively. In the operation phase, the loop() function continuously executes the traffic
light sequence. The red LED lights up for 6 seconds, signaling vehicles to stop, followed by
the yellow LED, which illuminates for 1 second to indicate that vehicles should prepare to
stop or proceed. Next, the green LED turns on for 5 seconds, allowing vehicles to move,
before briefly transitioning back to the yellow LED for 1 second. This sequence repeats in a
continuous loop, ensuring a smooth and predictable traffic light operation. The timing of
each signal is precisely managed using the delay() function, which introduces pauses
between state changes to maintain accurate intervals for each LED state. This simple yet
efficient approach effectively demonstrates the core functionality of a traffic light system.
int led_red=12;
int led_yellow=9;
int led_green=6;
void setup()
Department of Computer Science and Engineering,
MIT School of Computing,
MIT Arts, Design and Technology University, Pune
pinMode(led_red, OUTPUT);
pinMode(led_yellow, OUTPUT);
pinMode(led_green, OUTPUT);
void loop()
digitalWrite(led_red, HIGH);
digitalWrite(led_yellow, LOW);
digitalWrite(led_green, LOW);
delay(6000);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, HIGH);
digitalWrite(led_green, LOW);
delay(1000);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, LOW);
digitalWrite(led_green, HIGH);
delay(5000);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, HIGH);
digitalWrite(led_green, LOW);
delay(1000);
Department of Computer Science and Engineering,
MIT School of Computing,
MIT Arts, Design and Technology University, Pune
7. Testing and Results - During testing, the setup successfully demonstrated the intended
traffic light sequence. Each LED turned on and off at the correct intervals, accurately
reflecting a real-world traffic light system.
1. Red LED: Lights for 6 seconds as intended.
2. Yellow LED: Correctly illuminates for 1 second during transitions.
3. Green LED: Operates for 5 seconds, allowing "traffic" to proceed.
8. Applications and Limitations –
Applications:
1. Education: Demonstrates microcontroller-based projects for beginners.
2. Prototyping: Can be used to design and test traffic management solutions.
3. Traffic System Simulations: Helps visualize traffic light sequences for urban planning.
Limitations:
1. Simplified System: Does not include pedestrian signals or sensors for real-time
adjustments.
2. Fixed Timing: Lacks dynamic adjustments based on traffic density.
3. Hardware Constraints: Relies on basic components; real-world systems require more
advanced hardware like relays and sensors.
9. Conclusion –
This project successfully implements a basic traffic light system using Arduino Uno and LEDs.
It provides a hands-on understanding of microcontroller programming, timing control, and
sequential operations. While the system effectively demonstrates the core principles of
traffic light operation, its simplicity highlights potential areas for enhancement, such as the
inclusion of dynamic controls and sensor integration. Overall, the project serves as a
foundational step towards more advanced traffic management systems.
Department of Computer Science and Engineering,
MIT School of Computing,
MIT Arts, Design and Technology University, Pune
Department of Computer Science and Engineering,
MIT School of Computing,
MIT Arts, Design and Technology University, Pune
Department of Computer Science and Engineering,
MIT School of Computing,
MIT Arts, Design and Technology University, Pune