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.
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.
To get started with the code:
- Connect the microcontroller board to your computer.
- Set up the development environment and install the necessary software and libraries.
- Create a new project in your IDE and import the provided source code files.
- Configure the GPIO pins and timer settings according to your microcontroller's specifications.
- Build the project and flash the code onto the microcontroller.
The code consists of several source files that perform specific functions:
Traffic_light.h
andTraffic_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.
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.
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.
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