Skip to content

Traffic light implementation using tivaware on tivac 123gh6pm board.

Notifications You must be signed in to change notification settings

Ahmed-Ashraf-Marzouk/traffic-light-control-system

Repository files navigation

Traffic Light Control System

This repository contains the code for a traffic light control system implemented on a microcontroller. The system controls the operation of two traffic lights and pedestrian signals at an intersection. The traffic lights alternate between green, yellow, and red signals to control the flow of traffic, while the pedestrian signals provide a safe crossing for pedestrians.

Prerequisites

To run this code on the microcontroller, you will need the following:

  • A microcontroller board with sufficient GPIO pins and timer functionality.
  • Code Composer Studio or any other suitable IDE for C programming.
  • The necessary support packages and libraries for the specific microcontroller.

Getting Started

To get started with the code:

  1. Connect the microcontroller board to your computer.
  2. Set up the development environment and install the necessary software and libraries.
  3. Create a new project in your IDE and import the provided source code files.
  4. Configure the GPIO pins and timer settings according to your microcontroller's specifications.
  5. Build the project and flash the code onto the microcontroller.

Code Structure

The code consists of several source files that perform specific functions:

  • Traffic_light.h and Traffic_light.c: Contains the initialization and control functions for the traffic lights and pedestrian signals.
  • Other source files: Implement the initialization and control functions for the various peripherals used, such as GPIO ports and timers.

Operation

Upon running the code, the traffic light control system will be initialized, and the traffic lights and pedestrian signals will start operating according to a predefined sequence. The main function handles the initialization of the system, including setting up the GPIO ports and timers.

The system will continuously operate in a loop, using SysCtlSleep() to put the microcontroller in a low-power sleep mode while waiting for interrupts. The interrupts generated by timers will be used to update the states of the traffic lights and pedestrian signals at regular intervals.

Future Improvements

Although the current code provides basic functionality for controlling traffic lights and pedestrian signals, there are several areas for improvement and expansion:

  • Implement more advanced traffic light control algorithms, such as adaptive signal control based on traffic flow.
  • Integrate sensors and detection systems to optimize traffic light timing based on real-time traffic conditions.
  • Add support for different traffic patterns and intersection configurations.
  • Implement communication protocols to synchronize multiple traffic light systems at nearby intersections.
  • Enhance error handling and fault tolerance mechanisms to ensure the reliability of the system.

Acknowledgements

This project was developed as a demonstration of traffic light control systems on a microcontroller. Special thanks to the creators and contributors of the various libraries and support packages used in this code.

You can find more details about the project in this link: https://drive.google.com/drive/folders/1IMZpMoln80FUyWM5pYABJvTIafjAtgLS

About

Traffic light implementation using tivaware on tivac 123gh6pm board.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages