March 13, 2026

Water Filling and Discharging Process Using PLC

Problem Description

In many industries and plants, water storage systems are still operated manually. These manual systems, although simple, present several disadvantages:

Lack of accuracy in maintaining water levels

Time delays due to human intervention

Loss of liquids from overfilling or underfilling

Time-consuming operations that reduce efficiency

Dependence on operators, requiring dedicated personnel for machine operation

Water wastage, which is common in manual systems

Because of these limitations, manual water filling systems are inefficient and unsuitable for modern industrial requirements. Automation using PLCs provides a reliable solution that improves accuracy, reduces wastage, and eliminates the need for constant human supervision.

Problem Diagram: -

 

Problem Solution: -

To overcome the limitations of manual water filling systems, we implement an automated control system using the Siemens S7‑1200 PLC programmed in TIA Portal. The PLC continuously monitors the tank level through sensors and controls solenoid valves to manage filling and discharging cycles.

System Components

Sensors:

High-Level Sensor (TLB2) – Detects when the tank is full.

Low-Level Sensor (TLB1) – Detects when the tank is nearly empty.

Valves:

SOV1 (Feeding Valve) – Controls the water inflow during the filling cycle.

SOV2 (Discharge Valve) – Controls the water outflow during the discharge cycle.

Additional Devices:

Mixer Motor (M) – Operates during discharge to ensure proper mixing.

Buzzer (Q0.4) – Provides an alarm when the tank reaches high level.

START/STOP Push Buttons – Allow manual control of the cycle.

Filling Cycle

When the Low-Level Sensor (TLB1) detects that the water level has dropped below the minimum threshold, the PLC activates SOV1 (Feeding Valve).

Water begins to fill the tank automatically.

Once the High-Level Sensor (TLB2) is triggered, the PLC deactivates SOV1, stopping the filling process.

Discharging Cycle

When the High-Level Sensor (TLB2) detects that the tank is full, the PLC activates SOV2 (Discharge Valve).

Simultaneously, the Mixer Motor (M) is turned ON to mix the water during discharge.

The Buzzer (Q0.4) also activates to alert the operator that the tank has reached high level.

When the Low-Level Sensor (TLB1) is triggered again, the PLC deactivates SOV2 and the mixer, stopping the discharge cycle.

Manual Control

The operator can start the cycle by pressing the START button (I0.0).

The cycle can be stopped at any time by pressing the STOP button (I0.1), which resets all outputs and halts the process.

 

Program: -

Here is PLC program for Water filling and discharging process using S7-1200 PLC.

List of inputs/outputs

Type

Address

Tag/Name

Description

Digital Input

I0.0

START PB

Start push button to initiate cycle

Digital Input

I0.1

STOP PB

Stop push button to halt cycle

Digital Input

I0.2

Level Low

Sensor detects low water level

Digital Input

I0.3

Level High

Sensor detects high water level

Digital Output

Q0.0

Cycle ON

Indicator showing cycle is active

Digital Output

Q0.1

SOV1 (Feed)

Solenoid valve for filling cycle

Digital Output

Q0.2

SOV2 (Discharge)

Solenoid valve for discharge cycle

Digital Output

Q0.3

Mixer (M)

Mixer motor ON during discharge

Digital Output

Q0.4

Buzzer

Alarm buzzer ON at high level

 

Ladder diagram for Water filling and discharging process using S7-1200 PLC.

// Cycle control logic

IF NOT "STOPPB" AND ("STARTPB" OR "Cycle ON") THEN

    "Cycle ON" := TRUE;

ELSE

    "Cycle ON" := FALSE;

END_IF;

 

// SOV 1 Control / Feeding Process ON

IF "Cycle ON" AND NOT "Level High" AND ("Level Low" OR "SOV1 (Feed)") THEN

    "SOV1 (Feed)" := TRUE;

ELSE

    "SOV1 (Feed)" := FALSE;

END_IF;

 

// SOV 2 Control / Discharge Process ON

IF "Cycle ON" AND NOT "Level Low" AND ("Level High" OR "SOV2 (Discharge)") THEN

    "SOV2 (Discharge)" := TRUE;

ELSE

    "SOV2 (Discharge)" := FALSE;

END_IF;

 

// Motor COntrol

IF "SOV2 (Discharge)"  THEN

    "MOTOR" := TRUE;

ELSE

    "MOTOR" := FALSE;

END_IF;

 

// Buzzer Control

IF "Level High" THEN

    "Buzzer" := TRUE;

ELSE

    "Buzzer" := FALSE;

END_IF;

 

Program Description

For this application, we used the Siemens S7‑1200 PLC and TIA Portal software for programming.

Cycle ON Latching A latching circuit is implemented for the Cycle ON (Q0.0) output. The cycle can be started by pressing the START push button (I0.0) and stopped by pressing the STOP push button (I0.1).

System Operation Once the cycle is ON, the PLC continuously monitors the tank level.

If the tank level is low, the feeding process begins automatically.

If the tank level is high, the discharge process starts automatically.

Sensor Logic For simplicity, NO (Normally Open) contacts are used for both sensors in the program. In practice, this can be implemented using relay logic in the field or by selecting appropriate sensor types.

When the tank detects low level, TLB1 (Low Level, I0.3) is activated, and the feeding cycle (SOV1, Q0.1) turns ON.

Here, an NC (Normally Closed) contact of TLB2 (High Level, I0.2) is used so that when the PLC detects high level, it automatically stops the feeding cycle.

When the tank detects high level, TLB2 (High Level, I0.2) is activated, and the discharging cycle (SOV2, Q0.2) turns ON.

During discharge, the Mixer (Q0.3) also runs for mixing purposes.

An NC contact of TLB1 (Low Level, I0.3) ensures that when the PLC detects low level, the discharge cycle stops.

Alarm Function When the tank reaches high level (TLB2, I0.2), the Buzzer (Q0.4) is activated to alert the operator.

Throughout all operations, the Cycle ON (Q0.0) signal must remain active. If the STOP button is pressed, the cycle halts and all outputs reset.


Runtime Test Cases

Inputs

Outputs

Physical Elements

I0.0 = 1

Q0.0 = 1

Cycle ON

I0.2 = 1

Q0.1 = 1

Feeding Cycle ON (SOV1 active)

I0.3 = 1

Q0.2 = 1, Q0.3 = 1, Q0.4 = 1

Discharge Cycle ON (SOV2 active), Mixer ON, Buzzer ON

I0.1 = 1

Q0.0 = 0, Q0.1 = 0, Q0.2 = 0, Q0.3 = 0, Q0.4 = 0

Cycle STOP – all outputs reset

 

 

March 11, 2026

Water tank level control using Schnieder PLC

Objective

Develop HMI Graphical program For Tank Water Level Control in Auto Mode & Manual Mode Using PLC Logic

Automatic System: In Auto mode, the PLC handles the entire cycle. Once the level is below 100%, it turns on the pump and feed valve, showing the level on the screen. It gives alerts at 10% (low) and 90% (high). When the tank reaches the set level, it automatically stops filling and opens the discharge valve to drain everything back to 0%, repeating this cycle until you hit 'Auto Stop.' The main problem here is that the system is totally dependent on sensors. If a sensor fails or glitches, the PLC won't know, which can lead to a dry run or an overflow.

Manual System: Manual mode puts the operator in charge of everything. You can individually control the pump, feed valve, and discharge valve using toggle buttons to fill or drain the tank as needed. There’s a built-in safety interlock so the feed and discharge valves can't open at the same time. The biggest problem with this mode is human error. Since it doesn't stop on its own, if the operator gets distracted and forgets to turn off the pump, the tank will overflow and wastewater.

SCHEMATIC:

HMI

HOME PAGE

 

 

Automatic Control

Manual Control

 

Explanation

Automatic System Solution: To fix the sensor dependency, we should add redundancy and a failsafe. Instead of trusting just one sensor, we can install a secondary physical float switch at the very top of the tank that is hardwired directly to the pumps power line. This way, if the PLC or the main sensor fails, the physical switch will kill the power as a last resort to prevent overflow. We can also program a Watchdog Timer in the PLC where if the pump runs longer than its usual filling time, the system should automatically shut down and trigger an alarm, assuming something is wrong.

Manual System Solution To solve the human error problem, we should implement Smart Manual Control. Even when the operator is in charge, the PLC should keep the high level and dry run sensors active as emergency overrides. This means that if the operator gets distracted and forgets to turn off the pump, the PLC will veto the manual command and force a stop once the tank hits the limit. Additionally, adding a loud buzzer or a flashing light that triggers at 95 percent will give the operator a clear physical warning to take action before any water is wasted.

PLC Program:

 

 

 

Explanation

Automatic Mode Working: In Auto mode, the PLC takes full responsibility for the cycle. Once you hit the Auto Start button, the system checks the water level. If it is below 100 percent, the pump and feed valve turn on immediately. The level is displayed in percentage, with a low-level alert at 10 percent and a high-level alert at 90 percent. As soon as the tank hits the set level, the PLC shuts off the filling and opens the discharge valve to drain the tank. When the level drops to 0 percent, the discharge valve closes and the pump restarts the filling process. This loop continues automatically until someone presses the Auto Stop button.

Manual Mode Working: In Manual mode, the operator has direct control over every part of the system. You can use individual toggle buttons to turn the feed pump, feed valve, or discharge valve on and off whenever you want. The level increases when you turn on the pump and decrease when you open the discharge valve manually. To keep things safe, there is a built-in interlock that prevents the feed valve and discharge valve from opening at the same time, which prevents water from flowing straight through the tank and being wasted.

 

APPLICATION:

Industrial water tanks

Chemical storage tanks

Boiler water level control

Agriculture irrigation system

Residential water automation systems

Smart city water management

 

CONCLUSION:

The PLC-based water tank level control system provides efficient and automatic operation. It reduces water wastage, prevents motor damage, and improves reliability. The use of a counter-based system makes it flexible and suitable for various industrial and domestic applications.

Designed by E Zafar

March 8, 2026

PID Logic: The Brain of Industrial Automation

In the world of industrial automation, precision is not just a goal it’s a necessity. Processes involving temperature, pressure, flow, or speed demand continuous monitoring and adjustment to maintain stability, efficiency, and safety. At the heart of this control lies PID logic (Proportional–Integral–Derivative control), often referred to as the brain of automation.

 

 

PID controllers are everywhere: from chemical plants and oil refineries to HVAC systems and robotics. Their ability to balance speed, accuracy, and stability makes them indispensable in modern industry. This article explores PID logic in detail—its principles, mathematical foundation, applications, challenges, and best practices.

Understanding PID Logic

A PID controller continuously calculates the difference between a setpoint (desired value) and the process variable (actual value). This difference is called the error. The controller then adjusts the output to minimize this error using three terms:

Proportional (P):

Responds to the current error.

Larger error → stronger correction.

Provides immediate response but cannot eliminate steady‑state error alone.

Integral (I):

Responds to the accumulation of past errors.

Adjusts output until the average error is zero.

Eliminates offset but can cause overshoot if not tuned properly.

Derivative (D):

Responds to the rate of change of error.

Predicts future trends and dampens oscillations.

Improves stability but is sensitive to noise.

Together, these three terms create a balanced control strategy that reacts quickly, eliminates long‑term error, and prevents instability.

 

The Mathematical Foundation

The PID controller output is expressed as:

 

 

Where:

  • = error = setpoint – process variable
  • = proportional gain
  • = integral gain
  • = derivative gain

This equation shows how PID combines present, past, and future error information to generate a corrective action.

PID in PLC Programming

In industrial automation, PID logic is implemented inside PLCs (Programmable Logic Controllers) as function blocks. Engineers configure the block with inputs, outputs, and tuning parameters.

Inputs:

Setpoint (SP)

Process Variable (PV)

Output:

Manipulated Variable (MV) → e.g., valve position, motor speed

Tuning Parameters:

gains

 

Real‑World Applications

PID controllers are used across industries wherever precise control is required:

Temperature Control: Furnaces, boilers, and HVAC systems.

Pressure Regulation: Pipelines, compressors, and reactors.

Flow Control: Chemical dosing, water treatment, and fluid transport.

Speed Control: Motors, conveyors, and robotics.

Level Control: Tanks, reservoirs, and distillation columns.

For example, in a chemical plant, PID ensures that the temperature of a reactor remains stable despite external disturbances. In robotics, PID maintains motor speed and position with high accuracy.

 

Challenges in PID Implementation

While PID is powerful, it comes with challenges:

Tuning Difficulty: Incorrect gains can cause oscillations, sluggish response, or instability.

Noise Sensitivity: The derivative term amplifies measurement noise.

Nonlinear Processes: PID assumes linearity, but many industrial processes are nonlinear.

Time Delays: Long delays between input and output can reduce effectiveness.

Best Practices for PID Tuning

Start Simple: Begin with proportional control, then add integral for accuracy, and derivative for stability.

Use Auto‑Tuning: Modern PLCs and controllers offer auto‑tuning features to simplify parameter adjustment.

Apply Filters: Smooth noisy signals before feeding them into the PID block.

Document Settings: Record tuning parameters for future reference and troubleshooting.

Test in Simulation: Validate PID logic in a simulated environment before applying it to live processes.

 

Why PID Matters in Industry

PID logic is more than just mathematics—it’s a philosophy of control. By continuously balancing precision, speed, and stability, PID ensures:

Product Quality: Stable processes lead to consistent output.

Energy Efficiency: Avoids overcorrection and reduces waste.

Safety: Keeps variables within safe operating limits.

Sustainability: Optimizes resource usage and reduces environmental impact.

In essence, PID logic is the invisible hand that keeps industrial systems running smoothly, reliably, and safely.

Conclusion

PID logic truly is the brain of automation. It integrates the past, present, and future of process behaviour into a single control strategy, ensuring that industrial systems remain stable, efficient, and safe.

From chemical plants to robotics, PID is the silent guardian of precision. As industries evolve with digitalization and smart manufacturing, PID remains timeless proving that the fundamentals of control are as relevant today as they were decades ago.