Multifunctional traffic light control system with AT89C52 microcontroller as controller

Publisher:EnchantedDreamLatest update time:2023-06-26 Source: elecfansKeywords:AT89C52 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Multifunctional traffic light control system with AT89C52 microcontroller as controller

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.

Multifunctional traffic light control system with AT89C52 microcontroller as controller

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.

Multifunctional traffic light control system with AT89C52 microcontroller as controller

Figure 3 Working principle of traffic flow detection based on video images

Multifunctional traffic light control system with AT89C52 microcontroller as controller

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.

Multifunctional traffic light control system with AT89C52 microcontroller as controller

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.

Multifunctional traffic light control system with AT89C52 microcontroller as controller

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.

Multifunctional traffic light control system with AT89C52 microcontroller as controller

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.

Multifunctional traffic light control system with AT89C52 microcontroller as controller

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.

Keywords:AT89C52 Reference address:Multifunctional traffic light control system with AT89C52 microcontroller as controller

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?

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号