Arduino Traffic Light Controller
A four-way traffic light control system built on the Arduino Mega 2560, featuring
pedestrian crossing and emergency override modes. This project simulates real-world
intersection logic using a finite state machine (FSM) with non-blocking timing,
demonstrating strong embedded systems desgin.
Demo Video: Watch on YouTube
Project Overview
The system models a real intersection with four traffic light heads (North-South
and East-West), each with red, yellow, and green LEDs. Light phases are controlled
using the millis() function for non-blocking timing, allowing the controller
to remain responsive to inputs at all times.
User Interaction
- Pedestrian Button: Requests a safe crossing phase, indicated by a white LED.
- Emergency Button: Activates a flashing all-red mode to simulate emergency
Features
- Four-way traffic light simulation (12 LEDs total)
- Non-blocking timing using
millis()
- Finite state machine (FSM) for clean logic flow
- Interrupt-driven emergency mode (instant response)
- Software-debounced pedestrian and emergency input
- Modular design for easy hardware or logic expansion
System Logic
Normal Cycle:
- North-South Green → 7 seconds
- North-South Yellow → 3 seconds
- All Red → 1 second
- East-West Green → 7 seconds
- East-West Yellow → 3 seconds
- All Red → 1 second
If User Input Detected:
- If pedestrian button pressed → pedestrian light and all red for 7 seconds (during next all red state)
- If emergency button pressed → flash all-red until button is pressed again
Hardware Used
- Arduino Mega 2560 - Main controller board
- Breadboards - 2 interconnected for four signal heads
- LEDs - 12 for traffic lights + 1 pedestrian signal
- Resistors - 330-470Ω per LED
- Push Buttons - Pedestrian & Emergency modes
- Jumper Wires and USB Cable
← Back to Projects