Urban roads are intricately distributed, and traffic lights are a crucial command system for urban traffic. Traffic lights, as an effective means of controlling traffic flow and improving road capacity, have a significant effect on reducing traffic accidents. Programmable Logic Controllers (PLCs) , as industrial computers, play a vital role in industrial automation. They are characterized by their miniaturization, low price, and high reliability, and are widely used in various industries.
This paper presents a PLC -based intelligent traffic light control system for intersections, outlining the electrical control of traffic lights with countdown displays at intersections, as well as the software and hardware design methods for this system. Experiments demonstrate that the system is simple and economical to implement, effectively managing traffic and improving the capacity of intersections.
1. System Introduction
After the system is powered on, the traffic control signal control system is controlled by two buttons. Pressing the start button initiates normal operation, following the working sequence shown in Figure 1 in a cyclical manner. The north-south green light flashes for 25 seconds and then flashes for 3 seconds; the yellow light flashes for 2 seconds, followed by the north-south red light flashing for 30 seconds. The east-west direction follows the same sequence. During normal operation, two-digit countdown displays simultaneously show the remaining time values of the corresponding indicator lights in both the north-south and east-west directions. The system primarily implements two functions: digital display control of traffic lights at intersections and intelligent adjustment of display time.
Figure 1. Normal working sequence of traffic lights at an intersection
2. Hardware System Design
2.1 Component Selection
The FX series PLCs boast unparalleled speed, advanced functional logic options, and positioning control. The FX2N series is the most advanced series in Mitsubishi's FX family of PLCs, featuring high-speed processing and the ability to expand with numerous special function modules to meet individual needs; the FX2N offers a variety of application options from 16 to 256 input/output channels. This example uses the FX2N-80MR-D basic unit, with 40 input points and 40 relay output points. It employs a 25.4cm seven-segment display with a common cathode and a rated voltage of 12V and a rated current of 25mA (per segment). Power is supplied directly from a DC 12V/25mA power supply. A 200mm diameter circular LED dot matrix is used; the left red, green, and yellow LEDs have a rated voltage of DC 12V, a rated current of 4.2A, and a rated power of 50W, and are directly powered from a DC 12V/4.2A power supply. The control signals are described in Table 1. When SB2 is pressed, the contact opens, stopping operation. When SB3 is pressed, the seven-segment display shows "00". When SB4, SB5, and SB6 are pressed respectively, the seven-segment digital tube increments by 1 during the green, yellow, and red phases, and the lighting time is increased by 1 second. This is used to adjust the working time of each indicator light according to the traffic volume.
Table 1. Explanation of Traffic Light Control Signals at Intersections
2.2 PLC Control System I/O Allocation Table
The I/O allocation table based on the FX2N-80MR-D is shown in Table 2 according to the control requirements.
Table 2 Input/Output Allocation of Programmable Controllers
2.3 PLC Control System Hardware Wiring Diagram
Based on the traffic light design system control signal description (see Table 1) and the programmable controller input/output allocation table (see Table 2), design the electrical control diagram of the control system, as shown in Figure 2.
Figure 2 Electrical control diagram of traffic light PLC control system
3. Software System Design
Load the initialization data, press the start button, and the system begins operation. If the system does not require data adjustment, it will operate according to the preset data; if data adjustment is required, press the stop button to clear the original data and then adjust the digital display data in real time. The program design flowchart is shown in Figure 3.
Figure 3 Flowchart of the program
3.1 Programming
(1) When SB1 is pressed, the main switch of the traffic light closes X000, the M0 coil is energized, the M0 contact closes, and a self-locking is formed. As shown in Figure 4.
Figure 4. Trapezoidal diagram of traffic light switch.
(2) Ladder diagram for segment selection of the countdown on the east-west digital tube of the traffic light. The ladder diagram for segment selection of the countdown on the east-west digital tube of the traffic light is shown in Figure 5. K1M10 is the unit digit selection of the digital tube, and K1M14 is the tens digit selection of the digital tube. M8013 is a 1s pulse. When the M50 coil is energized, the M50 rising edge contact closes, the data in the D4 memory is converted into BCD code and transmitted to M10 to M17, and the data in the D4 memory is decremented by 1 every second. SEGD converts the BCD code in M10 to M17 into the numbers displayed on the seven-segment digital tube.
Figure 5. Trapezoidal diagram of the east-west direction seven-segment digital display of traffic lights.
(3) Ladder diagram for segment selection of the countdown digital tube in the north-south direction of the traffic light. The ladder diagram for segment selection of the countdown digital tube in the north-south direction of the traffic light is shown in Figure 6. Among them, K1M20 is the unit digit selection of the digital tube, and K1M24 is the tens digit selection of the digital tube. M8013 is a 1s pulse. When the M51 coil is energized, the M51 rising edge contact closes, the data in the D5 memory is converted into BCD code and transmitted to M20 to M27, and the data in the D5 memory is decremented by 1 every second. SEGD converts the BCD code in M20 to M27 into the numbers displayed on the seven-segment digital tube.
Figure 6. Trapezoidal diagram of the seven-segment digital display for the north-south direction of the traffic light.
(4) Ladder diagram for adjusting traffic light timing during the stop phase The ladder diagram for adjusting traffic light timing during the stop phase is shown in Figure 7. D1, D2, and D3 are the times stored during the green, yellow, and red phases, respectively. When the M0 coil is energized, the normally closed contact of M0 opens. The value in the data storage can only be adjusted when the M0 coil is de-energized. When the M0 coil is de-energized, pressing SB3 will reset the data in the D1, D2, and D3 data storage to 0. Pressing SB4, SB5, and SB6 will increment the data in the D1, D2, and D3 data storage by 1.
Figure 7. Trapezoidal diagram showing the traffic light adjustment time during the stopping phase.
(5) When the traffic lights are operating normally in the east-west direction, the working state loop ladder diagram is shown in Figures 8 to 10. Y001 is the east-west green light, Y002 is the east-west yellow light, and Y003 is the east-west red light. Because the FX2N series timer is based on a maximum of 100ms, and the seven-segment display count starts from 1, the data must be processed before being transmitted to the timer. The MUL instruction multiplies the data of D1, D2, and D3 by 10 and puts them into D10, D20, and D30 respectively. The ADD instruction adds 10 to the data in D10, D20, and D30 and puts them into D41, D42, and D43. This ensures that the seven-segment display can count down to "0".
Figure 8 shows the green light display for east-west traffic lights.
Figure 9 shows the yellow traffic light for east-west traffic.
Figure 10 shows the red traffic light in the east-west direction.
(6) The working state loop diagram of the north-south red, green and yellow traffic lights when they are in normal operation is shown in Figures 11 to 13. Y004 is the north-south red light, Y005 is the north-south green light, and Y006 is the north-south yellow light, which is the same as the east-west traffic lights.
Figure 11 shows the red traffic light in the north-south direction.
Figure 12 shows the green light display for north-south traffic directions.
Figure 13 shows the yellow traffic light in the north-south direction.
4. Conclusion
To control traffic lights using a PLC, its features should be fully utilized: (1) high reliability; (2) abundant I/O interface modules; (3) modular structure; (4) simple and easy-to-learn programming; (5) simple installation and convenient maintenance. The main difficulties and key points in the design process are programming ideas, application of some function instructions, ladder diagram design, system program input and debugging methods.