Skip to content

A traffic signal control system which automatically detects traffic jam and acts accordingly.

Notifications You must be signed in to change notification settings

AbdurRahmanFahad/Smart-Traffic-Signal-Control-System

 
 

Repository files navigation

CSE 316 Project - 2019

Smart Traffic Signal Control System

A Brief Description

In this Project we have designed a smart traffic signal control system which automatically detects traffic jam and decides which lane should be opened.

If there is no traffic jam in any lane, the system sequentially keeps open one lane one after another. But if there is traffic jam in one or more lanes, the system serves the lane in which traffic jam occured first.

Required Equipments

  • ATmega32 microcontroller
  • Sonar or Ultrasonic Sensor(HC SR04)
  • LED

Video Demonstration

Project Video

How it works?

In this project ATmega32 microcontroller is used for interfacing to various hardware peripherals. The system has to determine whether there is traffic jam in any road. For doing so, we need to install a sonar above each lane of the road at a certain distance apart from the traffic signal. As the position of the sonar above any lane is fixed, if a vehicle comes below the sonar, the distance measured by sonar will be less than the distance between the sonar and the road. That is, the sonar can detect vehicle using this logic.

If the vehicle stands still for a certain period for instance two minutes, we will consider this situation as traffic jam. The sonar informs this incident to the microcontroller connected to it. There is one microcontroller for each lane and also a main controller which is basically another microcontroller that collects information from the microcontrollers connected to it. The main controller then decides which road should be opened. It sends signals to its descendent microcontrollers to turn on the green signal or the red signal. The time duration for which a green signal or red signal will be turned on is also decided by the main controller

When a descendent microcontroller sends the main controller that there is traffic jam in the road corresponding to sender, the main controller then finsishes serving the current road and then serves the jam packed road.

Block Diagram

Context Diagram Example

Algorithm

The algorithm has two context:
       1. Microcontroller responsible for each road.
       2. Main controller microcontroller.

Algorithm for microcontroller responsible for each road(client.c):

  1. Start.
  2. If the signal sent by the main controller is to turn on green signal, turn on green signal
  3. Otherwise, turn on red signal
  4. Use sonar to detect if there is any vehicle below the sonar
  5. If there is any vehicle, start timer
  6. If the timer is greater than certain time duration lets say two minutes, inform main controller that there is traffic jam in your lane
  7. Otherwise, keep the timer on.
    8.Else, clear the timer
  8. Goto (2)
  9. End.


Algorithm for the main controller(server.c):

  1. Start.
  2. Check whether there is traffic jam in any road.
  3. If any road is jam packed, inform the microcontroller corresponding to that road to turn on green signal for a certain predefined period of time.
  4. Otherwise, one by one inform a microcontroller to turn on green signal for certain period while others to turn on red signal.
  5. Goto (2).
  6. End.

Detailed Pin Diagram

diagram

Problems Faced

  1. The ATmega32 has 3 timers. We have used timer1 for the sonar while timer0 for determining the time duration a vehicle remains stand still. That's why we have to use one microcontroller for each lane of any road. This leads to increased number of microcontrollers
  2. The systems performs badly if two or more lanes become jam packed. In that case, the system serves only the jam packed roads while the other roads remains unserved.

Group Members Information

  • Md. Hasin Abrar (1605082)

  • Khandakar Asif Ahmed (1605085)

  • Abdur Rahman Fahad (1605069)

Course Teachers

  1. Tareq Mahmud
    Lecturer, CSE, BUET

  2. Md. Masum Mushfiq
    Lecturer, CSE, BUET

About

A traffic signal control system which automatically detects traffic jam and acts accordingly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Makefile 48.1%
  • HTML 30.9%
  • C 20.8%
  • Shell 0.2%