This article will discuss an automated liquid filling machine based on the XG5000 PLC software. The PLC system is designed to achieve high-volume precision and consistency in each filling process. The process involves transporting bottles using a conveyor, temporarily stopping the conveyor when the bottle is in the filling area, filling the liquid, and counting the number of filled bottles. The system is also equipped with an automatic mode that allows the process to stop when the desired number of bottles has been reached.
Program Objective

Automatic Filling Machine Steps:
Start Process:
- The system is turned ON.
- The conveyor starts moving empty bottles automatically.
Set Number of Bottles:
- Select automatic mode (Auto Mode).
- Set the number of bottles you want to fill (Set Value) on the system.
Empty Bottle Detection:
The Bottle Sensor will detect every empty bottle carried by the conveyor.
Start Filling:
- When a bottle is detected, the solenoid valve will open automatically.
- The liquid will flow from the storage tank to the empty bottle.
Stop Filling:
- When the bottle is completely filled, the level sensor will be Active.
- The solenoid valve will close, stopping fluid flow.
Continue Process:
- The conveyor will continue to move carrying filled bottles.
- The system will count the number of bottles that have been filled automatically.
Finish:
- The process will stop automatically when the preset number of bottles is reached.
- When the system is running in Manual mode, the process will only stop when the system is turned OFF.
Additional Explanation:
Solenoid valve: Component used to Open and Close fluid flow based on electrical signals.
Level sensor: A device that measures the level of liquid in a bottle.
PLC Program for Liquid Filling Machine

IO Mapping
| S.No. | Comment | Input (I) | Output (Q) | Memory Bits | Memory Word | Timer |
|---|---|---|---|---|---|---|
| 1 | START | P0000 | ||||
| 2 | STOP | P0001 | ||||
| 3 | SENS_BOTTLE | P0002 | ||||
| 4 | SENS_LEVEL | P0003 | ||||
| 5 | RESET_COUNTER | P0004 | ||||
| 6 | SELECTOR_MODE | P0005 | ||||
| 7 | CONVEYOR | P0040 | ||||
| 8 | VALVE_LIQUID | P0041 | ||||
| 9 | PV_COUNTER | D0000 | ||||
| 10 | SV_COUNTER | D0001 | ||||
| 11 | TIMER1 | T000 | ||||
| 12 | SYSTEM_ON | M0000 | ||||
| 13 | IR_CUTOFF | M0001 |
XG5000 Logic Explained

RUNG 1 (SYSTEM ON)
In this Rung, the memory bit SYSTEM_ON (M0000) will be in the HIGH state when the START (P0000) button is Pressed. Because it uses the SET Coil Instruction, the memory bit SYSTEM_ON (M0000) will remain in the HIGH state even though the START (P0000) button has been Released.
RUNG 3
In this Rung, the memory bit SYSTEM_ON (M0000) will be in the LOW state if the STOP (P0001) button is Pressed or the NO contact of the memory bit IR_CUTOFF (M0001) is in the HIGH state. Because it uses the RESET Coil Instruction.
RUNG 7 (AUTO MODE)
In this Rung, the memory bit IR_CUTOFF (M0001) will be in the HIGH state when the NO contacts of the memory bit SYSTEM_ON (M0000) and Selector Switch SELECTOR_MODE (P0005) are in the HIGH state and the value in the memory word PV_COUNTER (D0000) is Equal To SV_COUNTER (D0001).

RUNG 13 (CONVEYOR)
In this Rung, the output CONVEYOR (P0040) will be ON when the NO contact of the memory bit SYSTEM_ON (M0000) is in the HIGH state and the NC contact of the sensor SENS_BOTTLE (P0002) is in the LOW state.
When the NC contact of the sensor SENS_BOTTLE (P0002) is in the HIGH state, the output CONVEYOR (P0040) will be OFF.
When the NO contact of the memory bit SYSTEM_ON (M0000) and the NO contact of the sensor SENS_LEVEL (P0003) are in the HIGH state, the output CONVEYOR (P0040) will return to ON.
RUNG 19 (VALVE LIQUID)
In this Rung, Timer TIMER1 (T000) will start counting up to “1.5” seconds when the NO contact of the memory bit SYSTEM_ON (M0000) and Sensor SENS_BOTTLE (P0002) are in the HIGH state. The output VALVE_LIQUID (P0041) will become OPEN when Timer TIMER1 (T000) has finished counting.
The output VALVE_LIQUID (P0041) will be CLOSED, and Timer TIMER1 (T000) will be OFF again when the NC contact of Sensor SENS_LEVEL (P0003) is in the HIGH state.

RUNG 27 (COUNTER)
In this Rung, because it uses the ADD Instruction, the value in the memory word PV_COUNTER (D0000) will increase (+1) when the NO contact of the memory bit SYSTEM_ON (M0000) and the sensor SENS_LEVEL (P0003) are in the HIGH state.
RUNG 35 (RESET COUNTER)
In this Rung, because the MOV(021) instruction is used, the value in the memory word PV_COUNTER (D0000) will be reset to zero “0” when the RESET_COUNTER (P0004) button is pressed.
Read Next:
- XG5000 PLC Garage Door Opening and Closing Logic
- PLC Programming for Storage and Supply Tank System
- Data Comparison Instructions in Omron PLC Example
- Omron PLC Ladder Logic for 3-Floor Parking System
- PLC Programming Example on Bottle Line Control