
The Traffic Light System project introduces one of the most common real-world applications of embedded systems and automation.
In this project, Arduino controls three LEDs that simulate a real traffic signal:
Using digital outputs and timing logic, Arduino automatically switches between different traffic light states, creating a realistic traffic signal sequence.
This project introduces:
By completing this project, you'll understand how microcontrollers can automate tasks and control multiple devices in a specific sequence.
Arduino Uno × 1
Breadboard × 1
Red LED × 1
Yellow LED × 1
Green LED × 1
220Ω Resistor × 3
Jumper Wires × 6
USB Cable × 1
Connect the Arduino GND pin to the negative rail of the breadboard.
This creates a common ground connection for all LEDs.
Insert the Red LED into the breadboard.
Connect:
Pin 8 through a 220Ω resistorInsert the Yellow LED into the breadboard.
Connect:
Pin 9 through a 220Ω resistorInsert the Green LED into the breadboard.
Connect:
Pin 10 through a 220Ω resistorDouble-check all LED polarities and resistor placements before powering the circuit.
Important: Every LED must have its own 220Ω current-limiting resistor to prevent damage.
Inside setup(), Arduino configures Pin 8, Pin 9, and Pin 10 as output pins.
These pins control the Red, Yellow, and Green LEDs.
The Red LED turns ON while the Yellow and Green LEDs remain OFF.
This represents the STOP signal.
The Red and Yellow LEDs turn ON together.
This indicates that the signal is about to change.
The Green LED turns ON while the Red and Yellow LEDs turn OFF.
This represents the GO signal.
The Yellow LED turns ON while the Red and Green LEDs remain OFF.
This warns that the signal is about to switch back to Red.
The sequence continuously repeats inside the loop() function, creating a complete traffic light system.
After uploading the code:
The circuit behaves like a simplified traffic signal.
One LED Does Not Turn ON: Verify the LED polarity and check the resistor connection.
Incorrect Sequence: Ensure each LED is connected to the correct Arduino pin.
All LEDs Stay ON: Check the uploaded code and confirm the pin numbers match your wiring.
Upload Errors: Verify the correct board and COM port are selected in Arduino IDE.
By completing this project, you have learned:
delay()In Day 7, you'll learn how to use a Buzzer with Arduino to generate sounds and simple melodies.