Traffic Light System

by Supernova09 in Circuits > Arduino

208 Views, 1 Favorites, 0 Comments

Traffic Light System

ChatGPT Image Jun 25, 2026, 11_21_27 PM.png
Traffic Light System #arduino #trafficlight #IoT

Traffic lights are used worldwide to control vehicle and pedestrian movement safely. In this project, you will build a simple Arduino-based Traffic Light System using three LEDs (Red, Yellow, and Green).

This project is ideal for beginners learning:

  1. Arduino programming
  2. Digital outputs
  3. LED interfacing
  4. Basic automation concepts
  5. Real-world control systems

What You'll Learn

✅ Connecting LEDs to Arduino

✅ Using resistors correctly

✅ Writing Arduino code

✅ Understanding traffic signal timing

✅ Uploading code and testing circuits

Supplies

Component Quantity

Arduino Uno 1

Breadboard 1

Red LED 1

Yellow LED 1

Green LED 1

220Ω Resistor 3

Jumper Wires 6

USB Cable 1

Understanding Traffic Signals

A typical traffic signal follows this sequence:

GREEN → YELLOW → RED

Signal Meaning

ColorMeaning

Green Go

Yellow Prepare to Stop

Red Stop

Our Arduino will control the LEDs in the same order.

Build the Circuit

Arduino Uno

D8 ---- Red LED ---- 220Ω ---- GND

D9 ---- Yellow LED ---- 220Ω ---- GND

D10 --- Green LED ---- 220Ω ---- GND


Create the Circuit in Tinkercad

Screenshot 2026-06-25 232827.png
  1. Open Tinkercad
  2. Click Circuits
  3. Create New Circuit
  4. Add:
  5. Arduino Uno
  6. Breadboard
  7. 3 LEDs
  8. 3 Resistors (220Ω)
  9. Wire components according to Step 4

Your circuit should resemble a miniature traffic signal.

Arduino Programming

Click Code → Text Mode and paste the following code.


// Traffic Light System

int redLED = 8;
int yellowLED = 9;
int greenLED = 10;

void setup()
{
pinMode(redLED, OUTPUT);
pinMode(yellowLED, OUTPUT);
pinMode(greenLED, OUTPUT);
}

void loop()
{
// GREEN
digitalWrite(greenLED, HIGH);
digitalWrite(yellowLED, LOW);
digitalWrite(redLED, LOW);
delay(5000);

// YELLOW
digitalWrite(greenLED, LOW);
digitalWrite(yellowLED, HIGH);
digitalWrite(redLED, LOW);
delay(2000);

// RED
digitalWrite(greenLED, LOW);
digitalWrite(yellowLED, LOW);
digitalWrite(redLED, HIGH);
delay(5000);
}



Code Explanation

Define Pins


int redLED = 8;
int yellowLED = 9;
int greenLED = 10;

Stores LED pin numbers.

Configure Outputs


pinMode(redLED, OUTPUT);

Sets LED pins as outputs.

Turn Green ON


digitalWrite(greenLED, HIGH);

Vehicle traffic may proceed.

Wait


delay(5000);

Keeps green light active for 5 seconds.

Yellow Signal


digitalWrite(yellowLED, HIGH);

Warning signal before red.

Red Signal


digitalWrite(redLED, HIGH);

Traffic stops.

Start Simulation

Click:

Start Simulation

You should observe:

  1. Green LED ON
  2. Yellow LED ON
  3. Red LED ON
  4. Cycle repeats continuously


Testing Checklist

✔ Green LED glows first

✔ Yellow LED glows second

✔ Red LED glows third

✔ LEDs switch automatically

✔ No LED remains permanently ON

How It Works

ChatGPT Image Jun 25, 2026, 11_27_52 PM.png

Real-World Applications

  1. Road Traffic Control
  2. Railway Crossing Systems
  3. Industrial Warning Systems
  4. Smart City Infrastructure
  5. Parking Management Systems
  6. Vehicle Control Systems


Conclusion

You have successfully built an Arduino Traffic Light System that mimics a real-world traffic signal. This project teaches the fundamentals of Arduino programming, digital outputs, timing control, and automation logic.

Next Project Ideas

  1. Smart Traffic Light with Push Button
  2. Pedestrian Crossing System
  3. Traffic Density-Based Signal
  4. Smart Parking System
  5. IoT Traffic Management System