---
title: "Intelligent Traffic Light Control System using Deep Q-Learning (DQN)"
url: "https://maker.wiznet.io/Hannah/projects/intelligent-traffic-light-control-system-using-deep-reinforcement-learning/"
markdown_url: "https://maker.wiznet.io/Hannah/projects/intelligent-traffic-light-control-system-using-deep-reinforcement-learning/md"
type: "UCC: User Created Content"
author: "Hoang Long"
author_url: "https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Hoang Long"
original_url: "https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025"
published: "2025-12-24"
language: "en"
likes: 0
views: 413
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Intelligent Traffic Light Control System using Deep Q-Learning (DQN)

> An AI-powered traffic management system that optimizes multi-intersection signal timing using Deep Q-Network (DQN) and real-time vehicle detection.

Original author: Hoang Long (source: https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025)

## Article

#### &lt;ENG>

#### Intelligent Traffic Light Control System

AI-Based Multi-Intersection Signal Optimization Using Deep Reinforcement Learning

---

#### Project Overview

The **Intelligent Traffic Light Control System** is an AI-powered traffic management solution that optimizes signal timing across **multiple intersections** using **Deep Reinforcement Learning (DQN)** and **real-time vehicle detection**.

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#problem-statement>

> **Problem Statement**
>
> Traditional fixed-time traffic signals cannot adapt to dynamic traffic conditions, resulting in:
>
> - Long waiting times during peak hours
>
> - Poor coordination between adjacent intersections
>
> - Inefficient green wave progression

Unlike traditional fixed-time traffic lights, this system dynamically adapts to changing traffic conditions and coordinates adjacent intersections to form an efficient **Green Wave**, reducing congestion and waiting time.

**Key Highlights**

- Simulation-based training with real-world deployment

- Centralized GUI for multi-intersection control

- Stable Ethernet-based IoT communication using **WIZnet W5500**

#### **System Diagram**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025?tab=readme-ov-file#system-diagram>

[![Hardware Diagram](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/raw/main/images/hardware.png)](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/blob/main/images/hardware.png)

#### Hardware Components

| Component | Role |
| --- | --- |
| **Raspberry Pi Pico** | Local traffic signal controller |
| **WIZnet W5500 Lite** | Wired Ethernet communication |
| **74HC595** | LED signal expansion |
| **Traffic Light LEDs** | Physical signal output |

#### **Solution**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#our-solution>

A DQN-based adaptive traffic control system that:

- **Learns optimal signal timing** policies through simulation

- **Adapts to real-time traffic conditions** using camera-based vehicle detection

- **Coordinates multiple intersections** for smooth green wave progression

- Deploys on a real-world GUI with hardware integration

[![System Overview](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/raw/main/images/systemoverview.png)](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/blob/main/images/systemoverview.png)

#### **DQN Approaches Comparison**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#-dqn-approaches-comparison>

We developed and compared **two DQN-based approaches** to identify the optimal strategy for traffic signal control:

**1. DQN-GreenWave (Green Wave Approach) ⭐ *Recommended***

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#1-dqn-greenwave-green-wave-approach--recommended>

[![DQN-GreenWave Architecture](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/raw/main/images/DQN.png)](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/blob/main/images/DQN.png)

**2. DQN-Baseline (Baseline Approach)**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#2-dqn-baseline-baseline-approach>

**Differences from DQN-GreenWave**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#differences-from-dqn-greenwave>

- Simpler state representation (no travel time focus)

- Single-output action space (combined discrete actions)

- Reward focuses on **individual intersection optimization**

- No explicit green wave coordination

**Use Case**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#use-case>

- Serves as experimental baseline for performance comparison

- Suitable for isolated intersections without coordination needs

---

**📊 Performance Comparison**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#-performance-comparison>

[![Performance Comparison Chart](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/raw/main/images/comparison_high_en.png)](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/blob/main/images/comparison_high_en.png)

| Metric | DQN-GreenWave | DQN-Baseline | Improvement |
| --- | --- | --- | --- |
| **Average Waiting Time (s)** | 21.28 | 14.07 | ✅ **-33.9%** |
| **Average Speed (m/s)** | 2.87 | 2.36 | ✅ **+17.6%** |
| **Green Wave Efficiency** | 82.5% | 64.3% | ✅ **+18.2%** |

**Testing Scenarios**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#testing-scenarios>

- ✅ **Low Traffic**: Both perform well, GreenWave slightly better

- ✅ **Medium Traffic**: GreenWave shows clear advantage

- ✅ **High Traffic**: GreenWave significantly outperforms baseline

![](https://maker.wiznet.io/upload/ckeditor5/229003372%5F1766573718%2Epng)

#### **Deployment (GUI Application)Real-Time Monitoring**
![Camera Monitoring](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/raw/main/images/cameraview.png)

**Traffic Control Modes**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025?tab=readme-ov-file#4-traffic-control-modes>

**Auto Mode (AI-Controlled)**

- DQN model makes decisions every cycle

- Updates based on real-time vehicle counts

- Adapts to traffic density changes

**Manual Mode**

- Override AI decisions

- Set custom cycle length and green times

- Emergency control for special events

#### **&lt;KOR>**

#### Intelligent Traffic Light Control System

**Deep Q-Network(DQN)** 기반 다중 교차로 신호 최적화 시스템

---

#### Project Overview

**Intelligent Traffic Light Control System**은 **Deep Q-Network(DQN)** 과 **실시간 차량 인식(YOLO)** 을 결합하여 **다중 교차로 신호를 자동으로 최적화**하는 AI 기반 교통 제어 시스템입니다.

DQN은 교통 시뮬레이션에서 신호 제어를 반복적으로 연습하며, 가장 효율적인 신호 타이밍을 스스로 학습하는 AI 알고리즘입니다.

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#problem-statement>

> **문제 제기**
>
> 기존의 고정 시간 신호등은 역동적인 교통 상황에 적응할 수 없어 다음과 같은 문제가 발생합니다.
>
> - 피크 시간대에는 대기 시간이 길어집니다.
>
> - 인접 교차로 간의 조정 부족
>
> - 비효율적인 녹색 물결 진행

기존 고정 신호 방식의 한계를 극복하고,
**실시간 교통 상황에 적응하며 Green Wave(연속 녹색 신호)** 를 형성하는 것이 핵심 목표입니다.

무거운 AI 연산 (DQN + YOLO) -> PC / Jetson Nano / Edge Device 에서 처리 후

Pico + Ethernet(W5500)으로 **결과 명령 수신 **후 제어하여, AI 연산과 하드웨어 제어 분리하여 안정적 통신을 구현했습니다.

#### **하드웨어 시스템 다이어그램**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025?tab=readme-ov-file#system-diagram>

[![하드웨어 다이어그램](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/raw/main/images/hardware.png)](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/blob/main/images/hardware.png)

#### Hardware Components

| Component | Role |
| --- | --- |
| **Raspberry Pi Pico** | 각 교차로 신호 제어 MCU |
| **WIZnet W5500 Lite** | 유선 Ethernet 통신 |
| **74HC595** | 다중 LED 신호 제어 |
| **Traffic Light LEDs** | 실제 신호 출력 |

#### **사용된 솔루션**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#our-solution>

DQN 기반 적응형 교통 제어 시스템은 다음과 같은 특징을 갖습니다.

- 시뮬레이션을 통해 **최적의 신호 타이밍 정책을 학습**합니다.

- 카메라 기반 차량 감지를 사용하여** 실시간 교통 상황에 맞춰 작동**합니다 .

- 원활한 녹색 신호 진행을 위해 **여러 교차로의 좌표 를 조정**합니다 .

- 하드웨어 통합을 통해 실제 GUI에 배포됩니다 .

**Intelligent Traffic Light Control System의 AI 학습 단계와 실제 배포 단계**를
두 개의 Phase로 나누어 보여줍니다.

[![시스템 개요](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/raw/main/images/systemoverview.png)](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/blob/main/images/systemoverview.png)

Phase 1 : AI 학습 단계

- **SUMO(Simulation of Urban Mobility)** 는 실제 도로와 유사한 환경을 만들어주는 교통 시뮬레이터

- DQN은 SUMO 환경에서 **신호를 바꿔보며 결과를 관찰하는 방식**으로 학습

- 대기 시간이 줄어들면 보상을 받고 혼잡이 발생하면 패널티를 받으면서 점점 더 나은 신호 제어 전략을 학습

- 이 단계의 결과로 **가장 성능이 좋은 DQN 모델(Best DQN Model)** 이 생성

PHASE 2: Deployment 학습이 끝난 AI를 실제 시스템에 적용하는 단계

- 카메라 입력을 통해 **YOLO 모델이 차량을 실시간으로 탐지 **->각 방향별 **차량 대수(vehicle counts)** 가 계산

- TomTom API를 통해 **도로 속도, 혼잡 정보, 사고 데이터**를 수집

- Green Wave Engine + DQN Model
  - YOLO에서 받은 **차량 수**
  - TomTom API의 **속도 정보**
  - 학습된 **DQN 모델**

- 세 가지를 결합하여 **신호 주기**, **녹색 시간**, **진행 방향**을 결정

- 결정된 결과값을 W5500을 통해 Pico로 전달

- 주변 교차로(A, B, C, D)가 함께 제어

#### **DQN 접근 방식 비교 (참고)**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#-dqn-approaches-comparison>

본 연구에서는 교통 신호 제어를 위한 최적의 전략을 파악하기 위해 **두 가지 DQN 기반 접근 방식을** 개발하고 비교했습니다.

**1. DQN-GreenWave (그린웨이브 접근법) ⭐ *추천***

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#1-dqn-greenwave-green-wave-approach--recommended>

[![DQN-그린웨이브 아키텍처](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/raw/main/images/DQN.png)](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/blob/main/images/DQN.png)

**2. DQN-기준선 (기준선 접근법)**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#2-dqn-baseline-baseline-approach>

**DQN-GreenWave와의 차이점**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#differences-from-dqn-greenwave>

- 보다 간소화된 상태 표현 (이동 시간에 초점을 맞추지 않음)

- 단일 출력 행동 공간(이산 행동들의 결합)

- **보상은 개별 교차점 최적화** 에 중점을 둡니다.

- 녹색 물결에 대한 명시적인 협력은 없었다.

**사용 사례**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#use-case>

- 성능 비교를 위한 실험 기준선 역할을 합니다.

- 조정이 필요 없는 독립된 교차로에 적합합니다.

---

**📊 성능 비교**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#-performance-comparison>

[![성능 비교 차트](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/raw/main/images/comparison_high_en.png)](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/blob/main/images/comparison_high_en.png)

| 미터법 | DQN-그린웨이브 | DQN-기준선 | 개선 |
| --- | --- | --- | --- |
| **평균 대기 시간(초)** | 21.28 | 14.07 | ✅ **-33.9%** |
| **평균 속도 (m/s)** | 2.87 | 2.36 | ✅ **+17.6%** |
| **그린 웨이브 효율성** | 82.5% | 64.3% | ✅ **+18.2%** |

**테스트 시나리오**

<https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025#testing-scenarios>

- ✅ **교통량이 적을 때** : 두 제품 모두 성능이 우수하며, GreenWave가 약간 더 좋습니다.

- ✅ **중간 규모 교통량** : GreenWave가 확실한 우위를 보입니다

- ✅ **높은 트래픽** : GreenWave는 기준선 대비 훨씬 뛰어난 성능을 보여줍니다.

![](https://maker.wiznet.io/upload/ckeditor5/229003372%5F1766573732%2Epng)

#### **배포 (GUI 애플리케이션)실시간 모니터링**
![카메라 모니터링](https://github.com/HoangLong69/Smart-Traffic-Light-Vip-Pro-Graduation-Thesis-2025/raw/main/images/cameraview.png)

**교통 제어 모드자동 모드(AI 제어)**

- DQN 모델은 매 주기마다 결정을 내립니다.

- 실시간 차량 대수에 따른 업데이트

- 교통 밀도 변화에 적응합니다

**수동 모드**

- AI의 결정을 재정의합니다.

- 사용자 지정 사이클 길이 및 녹색 시간 설정

- 특별 행사 비상 통제

---

Source: https://maker.wiznet.io/Hannah/projects/intelligent-traffic-light-control-system-using-deep-reinforcement-learning/
