Traffic Light System Using Arduino | Beginner Arduino Project
Traffic Light System Using Arduino
A Traffic Light System Using Arduino is one of the best beginner-friendly Arduino projects to understand LEDs, timing control, digital output pins, and basic automation. In this project, we will create a simple traffic signal using red, yellow, and green LEDs controlled by an Arduino board.

What is a Traffic Light System?
A traffic light system controls vehicle movement using colored lights. Usually, a traffic signal has three lights:
- Red LED: Stop
- Yellow LED: Get ready or wait
- Green LED: Go
In this Arduino project, we will control these three LEDs automatically using programmed delay timing.
Components Required
| Component | Quantity |
|---|---|
| Arduino UNO | 1 |
| Red LED | 1 |
| Yellow LED | 1 |
| Green LED | 1 |
| 220Ω Resistors | 3 |
| Breadboard | 1 |
| Jumper Wires | As required |
| USB Cable | 1 |
Circuit Connections
Connect the LEDs to Arduino digital pins using 220Ω resistors. The resistor protects the LED from excess current.
| LED | Arduino Pin | Connection |
|---|---|---|
| Red LED | Pin 8 | Positive leg through resistor |
| Yellow LED | Pin 9 | Positive leg through resistor |
| Green LED | Pin 10 | Positive leg through resistor |
| All LED negative legs | GND | Common ground |
Arduino Code for Traffic Light System
// Traffic Light System Using Arduino
// DiySmartLab.com
int redLED = 8;
int yellowLED = 9;
int greenLED = 10;
void setup() {
pinMode(redLED, OUTPUT);
pinMode(yellowLED, OUTPUT);
pinMode(greenLED, OUTPUT);
}
void loop() {
// Red light ON
digitalWrite(redLED, HIGH);
digitalWrite(yellowLED, LOW);
digitalWrite(greenLED, LOW);
delay(5000);
// Yellow light ON
digitalWrite(redLED, LOW);
digitalWrite(yellowLED, HIGH);
digitalWrite(greenLED, LOW);
delay(2000);
// Green light ON
digitalWrite(redLED, LOW);
digitalWrite(yellowLED, LOW);
digitalWrite(greenLED, HIGH);
delay(5000);
// Yellow light ON before red
digitalWrite(redLED, LOW);
digitalWrite(yellowLED, HIGH);
digitalWrite(greenLED, LOW);
delay(2000);
}
How the Traffic Light System Works
The Arduino turns the LEDs ON and OFF one by one according to the code. First, the red LED turns ON for 5 seconds, then the yellow LED turns ON for 2 seconds, then the green LED turns ON for 5 seconds. After that, the yellow LED turns ON again before repeating the cycle.
Working Sequence
- Red LED ON: Vehicles stop.
- Yellow LED ON: Vehicles get ready.
- Green LED ON: Vehicles move.
- Yellow LED ON again: Signal prepares to stop traffic.
- The cycle repeats continuously.
Why Use 220Ω Resistors?
LEDs need current limiting resistors. Without resistors, too much current can flow through the LED and damage it. A 220Ω resistor is commonly used with LEDs in Arduino projects.
Applications of This Project
- Beginner Arduino learning project
- Traffic signal model for school projects
- Basic LED automation practice
- Digital output pin learning
- Mini road traffic control demonstration
Common Mistakes to Avoid
- Do not connect LEDs directly without resistors.
- Check LED polarity before connecting.
- Make sure all LED negative legs are connected to GND.
- Select the correct board and port in Arduino IDE.
- Check jumper wire connections carefully.
Project Upgrade Ideas
After completing this basic traffic light project, you can improve it by adding:
- Pedestrian crossing button
- Buzzer alert system
- Seven segment countdown display
- Four-way traffic light control
- Automatic night mode using LDR sensor
SEO Keywords
Traffic Light System Using Arduino, Arduino traffic light project, Arduino LED traffic signal, traffic signal using Arduino UNO, beginner Arduino project, Arduino LED project, simple Arduino project
Conclusion
The Traffic Light System Using Arduino is a simple and useful project for beginners. It helps you understand how Arduino controls LEDs using digital output pins and delay functions. This project is perfect for students, hobbyists, and anyone starting with Arduino electronics.
Frequently Asked Questions
Can I use any Arduino board for this project?
Yes, you can use Arduino UNO, Nano, or Mega for this traffic light project.
Why are resistors used with LEDs?
Resistors limit the current flowing through LEDs and protect them from damage.
Can I change the traffic light timing?
Yes, you can change the delay values in the Arduino code according to your requirement.
Is this project suitable for beginners?
Yes, this is one of the easiest Arduino projects for beginners.
Can I make a real traffic signal with Arduino?
This project is for learning and demonstration. For real traffic control systems, professional safety standards and industrial controllers are required.