KHUSHI
KHUSHI
Arduino Uno: The microcontroller used to control the traffic light sequence.
LEDs: Three LEDs for each direction (red, yellow, and green), for a total of six LEDs.
Resistors: Used to limit current to the LEDs.
Breadboard and Wires: For connecting the components.
Push Buttons (Optional): To simulate pedestrian crossings or external triggers.
Power Supply: A 9V battery or USB power source for the Arduino
SYSTEM DESIGN AND WORKFLOW
The system consists of two sets of traffic lights (one for each direction) which follow a sequence:
1. Green Light (Go): Vehicles can move.
2. Yellow Light (Caution): Prepare to stop; the light will soon turn red.
3. Red Light (Stop): No vehicles should move.
Each set of traffic lights is controlled in a fixed sequence with timing intervals.
Traffic Light Sequence:
Direction 1 (North-South)
o Green for 10 seconds.
o Yellow for 2 seconds.
o Red for 10 seconds.
Direction 2 (East-West)
o Green for 10 seconds.
o Yellow for 2 seconds.
o Red for 10 seconds.
The system alternates between these two directions, ensuring that only one direction gets a green light at any time.
O CODE (EXAMPLE)
Below is an example Arduino code for controlling the
two-way traffic light system:
// Pin configuration for the traffic lights
int redNS = 2; // North-South Red
int yellowNS = 3; // North-South Yellow
int greenNS = 4; // North-South Green
int redEW = 5; // East-West Red
int yellowEW = 6; // East-West Yellow
int greenEW = 7; // East-West Green
void setup() {
// Set all traffic light pins as output
pinMode(redNS, OUTPUT);
pinMode(yellowNS, OUTPUT);
pinMode(greenNS, OUTPUT);
pinMode(redEW, OUTPUT);
pinMode(yellowEW, OUTPUT);
pinMode(greenEW, OUTPUT);
}
void loop() {
// North-South Green, East-West Red
digitalWrite(greenNS, HIGH);
digitalWrite(redEW, HIGH);
digitalWrite(yellowNS, LOW);
digitalWrite(yellowEW, LOW);
delay(10000); // Green for 10 seconds
Pedestrian Crossing Button: Adding push buttons for pedestrians to request a crossing signal.
LED Display: Display real-time traffic light status on an LCD or LED display.
Adjustable Timing: The duration for each light (green, yellow, red) can be dynamically adjusted using a
potentiometer
APPLICATIONS
Traffic Control: Can be used for small intersections to manage vehicle flow.
Educational Tool: A learning project to understand the basics of Arduino programming,
traffic management, and electronics.
Prototyping: Can serve as a prototype for larger, more complex traffic systems
CONCLUSION
The Two-Way Traffic Light System using Arduino provides an efficient solution for managing traffic at an
intersection. It introduces the concepts of embedded systems, electronics, and control systems. With further
enhancements, it can be integrated with sensors, time-based logic, and communication systems to create a
smarter traffic management solution
FUTURE IMPROVEMENTS
Sensor Integration: Use of ultrasonic or infrared sensors to detect the presence of cars and adjust
the light sequence dynamically.
Internet of Things (IoT): Incorporating IoT features to remotely control or monitor the traffic light
system.