This project implements a traffic light controller for a four-way intersection with pedestrian crossings, designed as part of the EEE 3261 – Microcontroller & Embedded Systems course at the University of Rwanda. The system ensures efficient traffic flow and pedestrian safety using AVR microcontroller I/O operations, timers, and interrupts
# 🚦 Four-Way Traffic Light Controller with Pedestrian Crossings (AVR)
## 📘 Background
Traffic light controllers are **critical embedded systems** that manage traffic flow and ensure pedestrian safety at intersections.
This project focuses on **designing and implementing** a four-way traffic light controller with pedestrian crossings using **AVR microcontrollers**, applying key concepts such as **I/O operations, timers, and interrupts**.
This work was completed as a **class assignment** under the supervision of
**Prof. Kizito NKURIKIYEYEZU**
for the **EEE 3261 – Microcontroller and Embedded Systems** module
in the **Electrical Power Engineering Department**
at the **University of Rwanda**.
---
## 🧰 Hardware Setup
### 🔧 Components Used
| Component | Function |
|------------|-----------|
| **ATmega16/32** | Main microcontroller |
| **LEDs (12 total)** | Traffic lights for four directions (N, E, S, W) |
| **Pedestrian LEDs (4 pairs)** | Walk/Don’t Walk indicators |
| **Push Buttons (4)** | Pedestrian crossing request inputs |
| **Buzzer** | Audible pedestrian warning |
| **7-Segment Display** | Countdown timer display |
### 🧩 Port Configuration
- **North LEDs:** PB0–PB2 (R, Y, G)
- **East LEDs:** PB3–PB5 (R, Y, G)
- **South LEDs:** PC0–PC2 (R, Y, G)
- **West LEDs:** PC3–PC5 (R, Y, G)
- **Pedestrian LEDs:** PD0–PD3
- **Buttons:** PD4–PD7 (with pull-ups)
- **Buzzer:** PA0
- **7-Segment Display:** PA1–PA7
---
## ⚙️ System Features
### 1. Basic Traffic Light Control
- Standard **Green → Yellow → Red** sequence
- **North/South** and **East/West** directions operate as synchronized pairs
- Timing parameters:
- Green: 20s
- Yellow: 5s
- All-Red: 2s
### 2. Pedestrian Crossing System
- Pedestrians press buttons to request crossing
- System completes the current vehicle phase before activating pedestrian mode
- **Countdown timer** displays remaining crossing time
- **Buzzer** activates during crossing phase
- **Crossing time:** 10 seconds (final 3 seconds have faster b …