You can access the source code files via this link.
In this project, we will explore how build a road intersection management system using STM32 microcontroller
The Road intersection management refers to the systematic approach and strategies employed to effectively control and regulate traffic flow at intersections where multiple roads intersect. It involves implementing various techniques, technologies, and traffic control measures to ensure safe and efficient movement of vehicles, pedestrians, and other road users.
The primary objectives of road intersection management include optimizing traffic flow, minimizing congestion, reducing delays, enhancing safety, and improving overall transportation efficiency. This involves coordinating the movement of vehicles through the use of traffic signals, signage, lane markings, and other control devices.
The road intersection, depicted in Figure 1, and the control interface is shown in Figure 2
This road intersection is controlled by four traffic lights. The designations of the lamps and buttons are as follows:
- Ri, Ji, and Vi: lamps used to control traffic in the straight and right directions.
- RGi, JGi, and VGi: lamps used to control traffic in the left direction. It should be noted that a lit Red lamp means a vehicle must stop. A lit Yellow lamp indicates that a vehicle should prepare (to stop or proceed with caution), and a lit Green lamp means a vehicle has the right of way. The Display 7SEG is used to display a cycle of 0..10 s for transitioning between stages.
All inputs/outputs are digital. We will guide you through the design and development of a simplified model of this system based on partitioning into multiple functions.
Step One:Open CubeMX & Create New Project Choose The Target MCU STM32F103C6 & Double-Click Its Name
- Go To The Clock Configuration & Set The System Clock To 8MHz
- Configure The GPIO Pins [PB15, PB0, PB1] and [PB3..PB5] as Output Pin for (the Full-size Traffic Light number 1) (R1, J1, V1) and (RG1, JG1, BG1);
- Configure The GPIO Pins [PB6..PB8] and [PB9..PB11] as Output Pin for (the Full-size Traffic Light number 2) (R2, J2, V2) and (RG2, JG2, BG1);
- Configure The GPIO Pins [PB12..PB14] and [PC13..PB15] as Output Pin for( the Mini Traffic Light number 1 and 2)(R3, J3, V3) and (R4, J4, V4).
- Configure The GPIO Pins [PA1..PA6] for the 7SEG display
- Generate The Initialization Code & Open The Project In CubeIDE
- Follow the flowchart of the main program
- Write The Application Layer Code
- Open Proteus & Create New Project and click next
- Click on Pick Device
- Search for STM32F103C6 & 7SEG-COM-ANODE & TRAFFIC LIGHT
- Click on Terminal Mode then choose (DYNAMIC&POWER &GROUND)
- finally make the circuit below and start the simulation
If you have any questions or suggestions don't hesitate to leave a comment below
Comments