introduction
This paper presents a PLC -based intelligent traffic light control experimental device. This device not only possesses conventional control functions, such as cyclical start of north-south and east-west red, yellow, and green lights; countdown display; manual adjustment of traffic light duration; and emergency traffic light control, but also automatically adjusts the traffic light duration based on traffic flow on main and secondary roads, and adjusts the lighting time according to time periods. Furthermore, this paper employs an easily implemented automatic cycle switching method based on traffic flow ratio, eliminating the need for complex calculations when adjusting traffic light durations, thus simplifying PLC programming. The designed control system features high reliability and good real-time performance.
1. System Design Concept
The entire system uses a touchscreen as the host computer, a PLC as the main control core, photoelectric switches and sound sensors as vehicle detection components, and traffic lights and digital displays as the main control objects. The overall design concept is shown in Figure 1. In intelligent operating mode, the system can calculate the optimal operating time for the traffic lights in the next cycle based on the traffic flow in each cycle. Based on this, it automatically adjusts the lighting time of the traffic lights through PLC control, and can also adjust the lighting time according to time periods. When special vehicles (such as ambulances and fire trucks) arrive, it can automatically activate the emergency vehicle forced passage mode. In the figure, the touchscreen, as an intelligent control device, can realize remote control and system status display, can switch operating modes, replace traditional button input, and can monitor the operating status of the traffic lights in real time.
Figure 1. Traffic light control system structure diagram
2. System component selection and hardware structure design
The host computer in this device uses an eViewMT4300C touchscreen. The eViewMT4300C touchscreen features a 5.6" 64K TFT color LCD display with a resolution of 320×240 pixels and multiple communication ports. Due to its user-friendly interface, diverse functions, flexible control, convenient programming, and low price, it has been widely used in the industrial control field.
Regarding PLC selection, based on the system's control requirements, four mode selection switches, four east-west and north-south vehicle detection sensors, and four sound sensors for each of the four directions are needed. Since the north-south vehicle detection sensors, east-west vehicle detection sensors, and sound sensors for each of the four directions can share one input point, this system requires a total of seven input points. The output section needs to control traffic lights, countdown timers, and pedestrian crossing lights, etc. Traffic lights require six output points, while pedestrian crossing lights can share output points with them. Since only one digit of the countdown data is displayed, the countdown display for each of the four directions requires 16 output points; therefore, the entire system requires 22 output points. A standard 2HS228021 digital tube is used for displaying one digit of the countdown time. Sound sensors are replaced by sound-activated switches. The hardware wiring diagram of the entire PLC control system is shown in Figure 2.
Figure 2 Hardware wiring diagram of PLC control system
3. System Software Design
The software design of the intelligent traffic light PLC control experimental device consists of two parts: touch screen configuration software design and PLC control program design. The configuration software design mainly focuses on creating the touch screen's user interface to facilitate human-machine interaction. The PLC control program primarily implements the traffic light's cyclic display function and countdown digital display function.
3.1 Touchscreen Configuration Software Design
The touchscreen configuration screen design of this device can be realized using the EV5000 configuration software that is compatible with the eView touchscreen.
The touchscreen display of this system is shown in Figure 3. The main interface of the system is shown in Figure 3(a). The entire screen consists of several parts, including traffic lights, countdown digital display, traffic flow detection display, current system time, and operation menus. By clicking the corresponding menu items, you can enter the "Working Mode Selection Window" and the "System Clock Setting Window" respectively. The "Working Mode Selection Window" provides four mode selection buttons. By clicking different buttons, the system can enter the corresponding working mode. In the "Normal Working Mode", the lighting time of the east-west green light and the north-south green light can be manually set. In the "System Clock Setting Window", the current system time can be manually changed for time correction.
Figure 3 Touchscreen configuration screen design
3.2 PLC Control Program Design
3.2.1 Main Program Design
The system first reads the PLC's time using the READ_RTC instruction, then determines whether the current time is during daylight or nighttime. If it is during daylight, the system automatically enters intelligent operating mode; otherwise, it enters nighttime operating mode. During either intelligent or nighttime operating mode, if the sound sensor detects an emergency vehicle passing by, the system pauses its original operating mode, quickly enters emergency operating mode, and starts timing. After 15 seconds, once the vehicle has passed, the system returns to its original operating mode and continues working. In either operating mode, the operating mode can be manually modified via the touchscreen to enter the corresponding processing stage. The main program design is shown in Figure 4.
Figure 4. Main Program Design Flowchart
3.2.2 Intelligent Working Mode
The program design concept in intelligent working mode is described as follows:
(1) Set the vehicle inspection cycle T0, which can be manually adjusted via the touchscreen;
(2) During a vehicle inspection cycle, the east-west and north-south traffic flow is detected and stored in the MW1000 and MW2000 data variable storage, respectively. MW1000 is the east-west traffic flow during a vehicle inspection cycle, and MW2000 is the north-south traffic flow during a vehicle inspection cycle.
(3) If only the north-south traffic flow MW2000 is 0, then set VW10 to 35s and VW100 to 15s, where VW10 is the duration of the green light for the east-west direction and VW100 is the duration of the green light for the north-south direction. If only the east-west traffic flow MW2000 is 0, then set VW10 to 15s and VW100 to 35s. If the traffic flow in both directions is 0, then set both VW10 and VW100 to 25s.
(4) If both MW1000 and MW2000 are not zero, calculate the ratio of MW1000 and MW2000 and store it in memory MW1500. Then, set the lighting time for the east-west and north-south green lights based on the ratio. The settings are as follows:
(5) Calculate the cycle T1 of the red, yellow and green lights: T1 = VW10 + VW100 + green light flashing time (set to 3s here) + yellow light lighting time (set to 2s here)
(6) In one cycle, the red, green and yellow lights in the east-west direction and the north-south direction are lit in sequence, as shown in Figure 5.
Figure 5. Timing diagram for cycle setting
(7) Within one cycle, the touch screen countdown displays the time when the two green lights are on and flashing, while the digital tube countdown displays the time when the green lights are on and flashing in the last 9 seconds.
3.2.3. Conventional Working Mode
The programming approach for the regular operating mode is similar to that of the intelligent operating mode. The only difference is that the east-west green light illumination time setting value (VW10) and the north-south green light illumination time setting value (VW100) are set by the system and can also be manually modified via the touchscreen.
3.2.4 Nighttime Work Mode
Between 20:00 and 6:00, the system enters nighttime operation mode. During this time, the yellow lights in both directions flash at a 1-second interval to alert vehicles, and the countdown digital display automatically stops working.
3.2.5 Emergency Working Mode
In emergency mode, the system uses sound detection sensors installed on each road to detect the arrival of emergency vehicles, such as ambulances, fire trucks, and police cars. When a sound sensor in any direction detects a signal, the system enters emergency mode. At this time, the red lights in both directions flash at 1-second intervals to indicate that an emergency vehicle needs to pass. Simultaneously, the countdown timer automatically stops. Once the emergency vehicle has passed (set to 15 seconds), the system exits emergency mode and returns to its original operating mode.
4. Development of experimental projects based on this device
The main experimental projects that have been developed and implemented using this traffic light control experimental device include:
① Design and implementation of a conventional traffic light cycle lighting control project;
② Design and implementation of a traffic light cycle control system with countdown display;
③ Design and implementation of a touchscreen-based control system for the cyclic lighting of conventional traffic lights;
④ Design and implementation of a touchscreen-based traffic light cycle control system with countdown display;
⑤ Design and implementation of an experimental project for intelligent traffic light control with vehicle detection;
⑥ Design and implementation of traffic light control projects for intersections with pedestrian crossing lights;
⑦ Design and implementation of traffic light control projects at intersections with pedestrian crossing priority;
⑧ Design and implementation of a nighttime traffic light flashing control system with system time display;
⑨ Design and implementation of traffic light control project for special vehicles passing through;
⑩ Design and implementation of the quiz buzzer experiment project.
Examples of experimental project development cases are shown in Table 1.
Table 1 Examples of experimental project development based on this device
5. Traffic Light Experiment Apparatus and Operating Instructions
The intelligent traffic light PLC experimental device developed in this paper is shown in Figure 6. The entire device uses a piece of plexiglass as a base, on which traffic lanes and pedestrian crossings are drawn according to the actual road conditions. It is equipped with 28 traffic lights, 4 digital tubes, 2 vehicle detection sensors, power supply, PLC, touch screen and other modules.
Figure 6. Physical diagram of the experimental device for PLC control of intelligent traffic lights
After connecting the power supply and turning on the power switch, the touchscreen displays the main interface. Tap the "Menu" item on the interface to bring up a menu window, then tap "Working Mode Selection." The touchscreen will then enter the "Working Mode Selection Window," where you can select various working modes (such as "Intelligent Mode"). After selecting, tap the "Back" button to return to the main interface. Tap the start button on the main interface to enter intelligent working mode. In this mode, the traffic flow sensors are active, and when a vehicle passes, the two vehicle detection data values on the main interface will display the specific number. When the vehicle detection cycle is complete (initially set to 2 minutes), the traffic lights in both directions will change according to the traffic flow in those directions. The time display shows two digits for the touchscreen countdown and one digit for the traffic lights. If "Normal Working Mode" is selected, the traffic lights will cycle according to a fixed period. The working cycle can also be adjusted by tapping the corresponding value input button.
6. Conclusion
This paper presents a novel intelligent control experimental device for traffic lights. The main innovations are: ① It employs a touchscreen and sensor technology to adjust and monitor the traffic light's operating status, providing a user-friendly interface and enabling remote control; ② It can automatically adjust the illumination time of the traffic lights based on traffic flow in each direction; and it can automatically adjust the working mode of the traffic lights based on system time; ③ The device adopts an open three-dimensional structure, simulating real traffic light control methods, allowing students to freely design experimental projects and develop their programming skills in touchscreens, PLCs, and algorithm design.