Automatic Traffic Light Controller using Arduino: Traffic light Control System project

traffic light controller using Arduino

4 Way automatic Traffic light controller using Arduino Project

Traffic signal is one of those elements that, for every commuter, seem to be part of everyday life. Wherever there are more number of cars, there will probably be one of these systems are present. Traffic light controller.

Nowadays traffic lights are quite complex within and have various kinds of sensors, timers, and also traffic monitoring systems that helps to control the traffic.

Having personal vehicles is very common today and a result, vehicles on the roads are exponentially increasing in numbers. Roads without any traffic lights or guidance can lead in to traffic congestion or could lead to accidents.

The traffic light system provides instructions to the users (drivers and pedestrians) by displaying lights of standard colour on four cross streets.

The colours used in traffic lights are Red, Yellow and Green for stop, slow and go respectively. The system is programmed to control the traffic lights for smooth and safe movement of vehicle traffic. The system consists of electro mechanical controllers with modern solid state computerized systems which has easy setup and maintenance.

This project is an Arduino board based Traffic Light system.

A simple system but can be extended to a real-time system with programmable timings, pedestrian lighting etc.

Project requirement:

  • 4 Green LED
  • 4 Red LED
  • 4 Yellow LED
  • Connecting wires
  • Breadboard
  • Arduino Board

Note: In practical, we did not have to use the current limiting resistors as the current from each digital I/O pin of the Arduino UNO is limited to 20mA only. Hence no resistor required for LED connection.

 

Circuit Diagram for traffic light :

(circuits.io)Connect All the LEDs as per the circuit diagram shown below for traffic light controller.

Traffic light controller : Circuit Diagram
Circuit-diagram-traffic-light-control

 

 

Note: In practical, we did not have to use the current limiting resistors as the current from each digital I/O pin of the Arduino UNO is limited to 20mA only. Hence no resistor required for LED connection.

 

Working :

In this project, a simple traffic light system for a 4 way intersection is implemented using Arduino UNO development board. Although it is not the practical implementation for real life scenarios, it gives a general idea of the process behind the traffic light control system

Simple traffic light controller is made using Arduino UNO, where the traffic is controlled in based on programmed timings.

For better understand let’s consider time delays as below

Green – 20 Sec.

Yellow – 5 Sec.

Red – 75 Sec.

Each lane gets time duration of 25 seconds including the yellow light time to move.

The yellow light turns ON for short duration after green light, indicating vehicles to slow down before the red light appears to avoid sudden stoppage.

Vehicles in every lane have to wait for 75 Sec. during red signal.

Lane 1Lane 2Lane 3Lane 4
Lane 1 Green20G25R50R75R
5Y5R30R55R
Lane 2 Green75R20G25R50R
55R5Y5R30R
Lane 3 Green50R75R20G25R
30R55R5Y5R
Lane 4 Green25R50R75R20G
5R30R55R5Y

 

 

Code for automatic traffic control system

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], LOW);

digitalWrite(Lane1[1], HIGH);

digitalWrite(Lane3[1], HIGH);

delay(3000);

digitalWrite(Lane1[1], LOW);

digitalWrite(Lane3[1], LOW);

digitalWrite(Lane1[0], HIGH);

digitalWrite(Lane3[2], HIGH);

delay(7000);

digitalWrite(Lane3[2], LOW);

digitalWrite(Lane4[0], LOW);

digitalWrite(Lane3[1], HIGH);

digitalWrite(Lane4[1], HIGH);

delay(3000);

digitalWrite(Lane3[1], LOW);

digitalWrite(Lane4[1], LOW);

digitalWrite(Lane3[0], HIGH);

digitalWrite(Lane4[2], HIGH);

delay(7000);

digitalWrite(Lane4[2], LOW);

digitalWrite(Lane2[0], LOW);

digitalWrite(Lane4[1], HIGH);

digitalWrite(Lane2[1], HIGH);

delay(3000);

digitalWrite(Lane4[1], LOW);

digitalWrite(Lane2[1], LOW);

digitalWrite(Lane4[0], HIGH);

digitalWrite(Lane2[2], HIGH);

delay(7000);

digitalWrite(Lane1[0], LOW);

digitalWrite(Lane2[2], LOW);

digitalWrite(Lane1[1], HIGH);

digitalWrite(Lane2[1], HIGH);

delay(3000);

digitalWrite(Lane2[1], LOW);

digitalWrite(Lane1[1], LOW);

}

 

  • Simulated Result using circuit.io for Traffic light controller using arduino
Simulation diagram of Arduino based automatic traffic control system
Simulation-diagram-traffic-light-control

 

Simulation diagram of 4 way automatic traffic light controller using arduino Traffic light Control system project
Simulation-Result 2 traffic-light-control

Practical Implementation Result :

4 way automatic traffic light controller using arduino project
Practical-result-traffic-light-control

 

See also:

Home automation Project with Raspberry Pi and Arduino

How to Design IoT Dashboard using Node-RED: Step-by-Step Tutorial

Tinkercad Arduino Simulation Tutorial: Simulate IoT Circuits Online for Beginners

 

Let us know what you think of Traffic Light Controller using Arduino in the comment section below.

 

Ready to Explore More? Let’s Build Smarter Together!

Subscribe to Our YouTube Channel » for IoT video Tutorials.
Start Learning IoT Basics Now » and What is IoT? – Introduction to IoT for Beginners on IoTDunia.com!

and Check out Top IoT Applications in Real World – Smart Use Cases 2025IoT career guide 2025Best Projects on IoT for Beginners

Have questions? Drop them in the comments!

Start small, stay curious, and make your world smarter—one device at a time.

IoTDunia
IoTDunia is working towards a vision of empowering the youth by providing them with great professional opportunities with Internet of Things to build world class ecosystem.