Abstract: This article mainly introduces how to use PLC to realize the setting, display, alarm, and automatic control of multi-segment liquid levels. Keywords: PLC, liquid level monitoring. In many production fields, it is often necessary to monitor the liquid level in containers such as storage tanks, reservoirs, and pools. In the past, traditional relay contact control was often used, which used many hard-wired electrical components, resulting in poor reliability and low automation. Currently, many enterprises have adopted advanced controllers to transform traditional contact control, greatly improving the reliability and automation of the control system and providing more reliable production assurance for enterprises. This article introduces a method for monitoring liquid levels using a programmable logic controller (PLC). Its circuit structure is simple, the investment is low (existing facilities can be modified), the monitoring system not only has a high degree of automation, but also has online modification function, which is highly flexible and suitable for multi-segment liquid level monitoring. 1. Control Requirements The control system can divide the liquid level into multiple segments according to production needs and display each segment separately. When the liquid level reaches the minimum limit, the feed pump automatically starts to add liquid. When the liquid level reaches the set value, an audible and visual alarm is triggered, and the pump stops. The operator can cancel the audible alarm signal with a confirmation button, and the flashing light will turn to a flat light. The system has both manual and automatic control modes and includes a testing function. 2. PLC Selection Currently, the domestic market offers various series of PLCs imported from the United States, Germany, Japan, and other countries. Many domestic manufacturers also assemble and develop dozens of PLCs. Therefore, PLC series standards vary, functions differ, and prices vary significantly. Under these circumstances, the selection of a PLC should focus on its performance-price ratio, choosing a PLC with high reliability, comparable functions, suitable load capacity, and affordability. This article takes a four-segment liquid level control object as an example. Based on the analysis and comparison of various factors and the requirements of the number of input and output points of the monitoring system, the C20P PLC from OMRON Corporation of Japan is selected. 3. System Hardware Configuration To achieve manual/automatic control of the liquid level, 12 input ports and 8 output ports are required. A C20P 20-point I/O unit PLC is selected, with input opto-isolation and output relay isolation, providing strong load capacity. Liquid level detection uses a reed switch sensor. Manual/automatic switching, run/test switching, and liquid level setting are achieved using a two-position knob. Manual pump start, stop, confirmation, and test use normally open buttons. Outputs include an electronic audible alarm, 24V DC indicator lights, and relays. See Figure 1 for the system hardware configuration diagram. To save on the number of input ports and investment, the system's run/test function switching utilizes optimized I/O module wiring, allowing one input node in the PLC input module to function as two input nodes, completing the I/O functions of the PLC in both operating modes. See Figure 2 for optimized I/O module wiring. 4. System Software Design 4.1 Control Program Flowchart Figure 3 System Flowchart 4.2 Programming Instructions ① This system is a two-position liquid level control system. The liquid level can be set and displayed in four segments. The pump automatically starts at the lowest liquid level and automatically stops when the liquid level reaches the set value. ② It uses IL/ILC branch commands, allowing manual/automatic function selection via knob 0008. When knob 0008 is closed, the automatic indicator light illuminates, and the system executes the program within the IL/ILC branch to complete automatic monitoring. When knob 0008 is open, the manual indicator light illuminates, and the system executes the program outside the branch, allowing manual pump start and stop via knobs 0010 and 0011. ③ The liquid level is set in four segments (lowest, lower, higher, and highest) via knobs 0004 to 0007. The system prioritizes the lowest setting over the highest; that is, when multiple setting knobs are closed simultaneously, the lowest liquid level setting takes priority. ④ When using a reed switch to detect the liquid level, the contact closes and the indicator light illuminates when the liquid level reaches the detection point; the contact opens when the liquid level leaves the detection point. To ensure that the indicator light for the corresponding measurement segment does not immediately turn off and is not affected by liquid level fluctuations, each segment's indicator light is controlled using the KEEP hold command. The indicator light only turns off when the liquid level rises or falls to the adjacent segment. ⑤ When the liquid level reaches the detection point, the liquid level indicator light flashes. The flashing factor uses an internal flashing index of 1902, flashing with a 1-second cycle. If the liquid level reaches the set value, the pump automatically stops, and an electronic audible alarm is set. The alarm sound is designed to sound for 3 seconds, stop for 2 seconds, cycle for 30 seconds, and then automatically stop. Alternatively, the alarm can be stopped by pressing the 0009 confirmation button within 30 seconds, and the indicator light will illuminate normally. The electronic audible alarm and pump start/stop also consider the impact of liquid level fluctuations, and the design uses a combination of the KEEP hold command and the DIFU differential command. ⑥ When starting the machine for the first time, if the liquid level is lower or higher than the minimum liquid level, you need to manually start the pump first, and then switch to automatic operation; or enter the test mode first, press the minimum liquid level test button to start the feed pump, and then enter the automatic operation mode. 4.3 PLC ladder diagram Figure 4 PLC ladder diagram References: 1. OMRON Programmable Controller Operation Manual 2. Yang Weishi. Using PLC to realize water level monitoring. Automation Instrumentation. 2001 (3) Author: Jin Yanping, male, born in 1963, Bachelor, Associate Professor, Engineer, engaged in teaching and practice of electrical courses.