Traffic light - Project
Course: IS1300 - Embedded Systems, link
The project was built with a Nucleo L476RG development board and a traffic light shield made by Matthias Becker, KTH. The program is implemented as different tasks by FreeRTOS.
The main functionality
The junction is able to detect cars thorugh toggle switches and sense if a pedestrian want to cross by pressing a pedestrian button. Different software timers were used to keep track of delay times. The remaining times are displayed as bars on the OLED display.
All the LEDs were connected to three shift registers and the bits in the registers were updated with SPI. The brightness of the LEDs can be adjusted with PWM depending on the ADC (analog to digital converter) value from a potentiometer.
The junction is able to detect cars thorugh toggle switches and sense if a pedestrian want to cross by pressing a pedestrian button. Different software timers were used to keep track of delay times. The remaining times are displayed as bars on the OLED display.
All the LEDs were connected to three shift registers and the bits in the registers were updated with SPI. The brightness of the LEDs can be adjusted with PWM depending on the ADC (analog to digital converter) value from a potentiometer.
Tasks
Several tasks are used to handle the program logic. To communicate between tasks, queues were mainly used. By sending items through queues different tasks could be synchronized together and minimizing the usage of global variables. In some scenarios it is unnecessary for tasks to be in the ready state if nothing new has happened. For example when no buttons have been pressed or no timer have been expired. Therefore they were mainly implemented to be in the blocked state until something has been received in the queue.
Several tasks are used to handle the program logic. To communicate between tasks, queues were mainly used. By sending items through queues different tasks could be synchronized together and minimizing the usage of global variables. In some scenarios it is unnecessary for tasks to be in the ready state if nothing new has happened. For example when no buttons have been pressed or no timer have been expired. Therefore they were mainly implemented to be in the blocked state until something has been received in the queue.
Note: The school projects described in this portfolio will not be described in detail to comply with KTH's guidelines against plagiarism.