The number of cars is increasing, and the current traffic light mode at traffic lights adopts timing control. Since the traffic flow changes at any time, when no car passes at this time, the opposite car will have to wait until the green light in this direction ends to display red. Only the lights can pass through, and the strain performance in terms of time and space is poor. This not only wastes time, but also causes "traffic jam" for vehicles in the opposite direction. In order to solve the "big traffic jam" phenomenon at urban traffic lights, it is necessary to improve the original traffic light control system at traffic lights.
This article uses the AT89C52 microcontroller as a traffic light control system. The system receives signals through an infrared receiver to realize the automatic release of special vehicles (119, 120, etc.); it collects road conditions signals through the vehicle detection circuit, and after processing by the microcontroller, allocates traffic signals to each lane. The green light time realizes dynamic adjustment of traffic flow, and the LED digital tube displays the traffic countdown; in addition to the basic traffic light function, the system also has manual setting of traffic time, countdown display, forced passage of emergency vehicles, traffic flow detection and adjustment, traffic abnormality identification and processing and other related functions.
1. Overall block diagram design and principle of traffic control system
The traffic light control system uses a microcontroller to directly control the status changes of the signal lights, and the connected LED digital tube can display a countdown to remind drivers. On this basis, this system adds a violation detection circuit and a traffic flow detection circuit to collect data for the microcontroller, and at the same time connects a buzzer. This design uses a single-chip microcomputer as the control core and is connected to form a minimum system. The traffic flow detection module, violation detection module and button setting module generate input, and the signal light status module, LED countdown module and buzzer status module accept the output. The overall block diagram of the system is shown in Figure 1.
Figure 1 Overall block diagram of the system
2. System hardware total circuit composition and working principle
This design uses AT89C52 microcontroller and peripheral devices to form the minimum control system. 12 light-emitting diodes are divided into 4 groups of red, green, and yellow lights to form the signal indicator module. 8 LEDs, two each from east to west and south, form the countdown display module. The traffic flow detection sensor collects traffic flow. Data, photosensitive sensor captures violation signals, several buttons constitute time setting and mode selection buttons and emergency buttons, etc., and a buzzer is used for alarm.
System hardware circuit composition: The single-chip microcomputer is the core, forming a closed-loop control system that integrates traffic flow collection, processing, and automatic control. The system hardware circuit consists of traffic flow detection circuit, microcontroller, violation detection circuit, status light, LED display, buttons, and voice prompter. The specific hardware circuit diagram is shown in Figure 2.
Figure 2 Overall design circuit diagram
Among them, P0 and P2 are used to send two LED digital tubes for display, P1 is used to control the red, green and yellow light-emitting diodes, XTAL1 and XTAL2 are connected to the crystal oscillator clock circuit, the RESET pin is connected to the reset circuit, and P3.3, INT1, is connected to the violation detection circuit And P3.2, that is, INT0, is connected to the emergency stop/east-west time setting key J, P0.6 and P0.7 are connected to the traffic flow detection circuit, P3.6 is connected to the north-south time setting key S, and P3.7 is connected to the automatic mode selection/return key F , P3.4 is connected to the voice prompter. After the system is powered on or manually reset, the system waits for the mode selection setting key to be pressed. There are two modes: traffic light time automatic and traffic light time setting. If the F key is pressed at this time, it is the automatic mode. If the S key is pressed at this time, it is the time setting mode. Press the S key several times and the J key several times to set the traffic light time in both directions. Press F key to confirm. In fact, this process is to set the register that stores the time value and whether the sign needs to be detected and adjusted for traffic flow.
Next, the system must first display the status light and LED digital tube, send the status code value to the display P1 port, send the time value to be displayed to the display P0 port, and use the P2 port to strobe the display conduction of the LED digital tube. At the same time With a cycle of 50ms, use software to time 1s. When 1s is reached, the time value will be decremented by 1 and the LED digital tube will be refreshed.
It takes all the time it takes for the time to reach a state, then the next state must be judged and connected, and the corresponding state code value and time value of the next state must be loaded, and two external interrupts must be turned on, one of which is the violation signal or the stop signal input. Once The signal is valid, the interrupt starts, the interrupt service subroutine is entered, the buzzer is turned on to prohibit all access, and when the F key is pressed, the interrupt ends and returns. The second is the traffic flow detection signal input. If a vehicle is detected passing by, the corresponding interrupt subroutine is entered, the counter storing the traffic flow is increased by 1, and then the interruption is completed and returned.
3. Each control module
3.1. Vehicle detection module
This design uses video images for traffic flow detection. The basic idea is to set a fixed area on each lane in the video picture as a virtual detection line, process the image in this area, and complete the acquisition of vehicle information. The working principle of traffic flow detection The traffic flow detection diagram and traffic flow detection diagram are shown in Figure 3 and Figure 4 respectively.
Figure 3 Working principle of traffic flow detection based on video images
Figure 4 Traffic flow detection map based on video images
3.2. Signal light module
Signal lights are used to display vehicle traffic conditions. For an intersection, the signal conversion sequence at each intersection is: green -> yellow -> red. The minimum time for green light is 20 seconds, and the maximum time is 40 seconds. For red light, The minimum light time is 25 seconds, the maximum time is 45 seconds, and the yellow light time is 5 seconds.
Figure 5 Traffic light operating status
3.3. Time display module
A display circuit is installed directly above the traffic light to display the green light passing time and the red light waiting time, using a digital tube display circuit. Since the time displayed in the east to west and west to east directions is the same, and the time displayed in the south to north and north to south directions is also the same, we only need to consider a four-digit digital tube display circuit, including two digits for the east-west direction and two digits for the north-south direction. The two-digit digital tube can be used for 0 to 99 seconds, which can fully meet the system requirements. The connection method of the digital tube is shown in Figure 6.
Figure 6 Digital tube connection method
3.4. Emergency conversion module
When there are special vehicles (such as 119 and 120) that need to pass urgently, an emergency pass switch is designed in the article. When the special vehicles arrive, all green lights can be automatically turned off to allow the special vehicles to pass. Special vehicles in the design can use infrared generators as transmitters and use real-time interrupts to respond to the traffic requirements of special vehicles. The infrared receiver uses an integrated infrared receiver, which has high sensitivity and strong anti-interference ability. The schematic block diagram of the infrared remote control receiving circuit is shown in Figure 7.
Figure 7 Infrared receiving principle block diagram
3.5. Violation detection circuit and simulation
During red and yellow lights, vehicles are prohibited and in order to detect those vehicles violating the rules, ultrasonic vehicle sensors are used. However, due to limited application conditions, only ordinary photodiodes are used in this system design.
Figure 8 Violation detection circuit
4 Conclusion
The multifunctional traffic light control system based on the single-chip microcomputer makes full use of the functions of the AT89S52 single-chip microcomputer chip to improve the reliability and stability of the system. The system design is simple, practical, simple to operate, and the program is reliable, realizing the control of traffic lights under various circumstances. With normal indication and countdown functions, this system can easily and flexibly adjust the control parameters of the intersection through remote control, so that emergency vehicles can pass smoothly in time. More importantly, this system also completes the control of traffic lights in the process. Fault detection has strong practical application value.
Previous article:AT89S52 microcontroller implements a simple calculator (C language program)
Next article:What are the advantages and disadvantages of the microcontroller at89s52 compared with other microcontrollers?
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- The difference and relationship between embedded Linux and embedded development of 51/430/STM32
- 【DM642】Porting of H.264 source code on DM642
- [2022 Digi-Key Innovation Design Competition] Material Unboxing
- Prize-giving live broadcast: Book a session on "Meeting the test challenges in 5G signal generation" and win Keysight gifts
- Simple stopwatch based on MSP430f149 microcontroller
- A power backup solution for NVR/DVR systems
- Is there any solution to adjust the voltage accurately to 0.1V and start continuously and stably? ??? ? Help! ! ! !
- Learn about the internal structure of ST waterproof pressure sensor in this 32-second video
- 【Qinheng CH582】Evaluation Summary
- Introduction to oscilloscope related terms (Part 2)