PID Control for pH

PID control for pH neutralization acid and base dosing

PID Control for pH: Why Neutralization Loops Are More Difficult Than They Look

pH control is used in wastewater neutralization, chemical manufacturing, fermentation, water treatment, food processing and many other processes where acidity or alkalinity must remain inside a defined operating range.

A simple control loop can be represented as:

pH setpoint → pH measurement → PI/PID → Acid or base dosing → Process pH

But pH is not a conventional linear process variable.

The relationship between chemical addition and measured pH can change dramatically across the operating range, which is why a standard PID controller that performs well at one pH value may behave poorly at another.

The main difficulty in pH control is not the PID equation itself. It is the strongly nonlinear chemistry between reagent addition and the resulting pH.

pH Is a Logarithmic Quantity

pH is related to hydrogen-ion activity by:

pH = -log10(aH+)

A change of one pH unit therefore represents an approximately tenfold change in hydrogen-ion activity.

A change from pH 4 to pH 5 is not equivalent to a linear engineering-variable change from 4 units to 5 units.

This is one reason pH behaves very differently from pressure, temperature, level control or many ordinary flow loops.

The Titration Curve Determines Process Gain

Consider adding base gradually to an acidic solution.

Far from the neutralization region, a certain amount of base may produce only a small pH change.

Closer to the equivalence region, the same additional quantity can produce a much larger change in pH.

After passing through that region, process sensitivity can decrease again.

This means:

the same pump-speed change or valve movement does not produce the same ΔpH everywhere on the titration curve.

A proportional gain that feels conservative at pH 3 may be far too aggressive near a steep neutralization region.

One fixed set of PID gains cannot be expected to produce identical behaviour across the entire pH range.

This is a practical example of the limitations of fixed-gain PID control.

Buffer Capacity Matters as Much as the Starting pH

Buffer capacity describes how strongly a solution resists pH change when acid or base is added.

A strongly buffered process may require a large amount of reagent to create a relatively small pH change.

A weakly buffered process may move several pH units after a small addition.

Therefore two wastewater streams can both measure pH 5 while requiring very different quantities of base to reach the same target.

The measured pH value alone does not tell you the neutralization capacity of the liquid.

This is one reason simple feedforward calculations based only on inlet pH can be unreliable.

pH 7 Is Not Automatically the Correct Setpoint

pH 7 is associated with neutral conditions in common aqueous chemistry, but the correct industrial setpoint depends on the process.

A fermentation process may require one operating range.

A precipitation reaction may work best somewhere else.

Wastewater discharge limits depend on the applicable process and regulatory requirements.

Therefore the purpose of pH control is not automatically to drive every process to pH 7.

How Does an Industrial pH Sensor Work?

A common industrial pH measuring system uses a glass measuring electrode and a reference electrode.

The glass membrane develops an electrochemical potential related to hydrogen-ion activity.

The transmitter converts that high-impedance millivolt signal into a usable pH value.

Measurement quality can be affected by:

electrode contamination,

reference-junction condition,

electrode ageing,

moisture and insulation problems,

temperature,

poor installation.

If the transmitter sends a 4-20 mA or another analog signal to the PLC, correct electrical scaling is still only one part of the measurement chain.

Calibration Comes Before PID Tuning

The controller assumes that the pH measurement is correct.

If the actual process is pH 7.0 but the electrode reports 7.4, a perfectly tuned controller will regulate the plant to the wrong chemical condition.

Before changing Kp or integral time, verify:

electrode condition,

cleaning,

buffer calibration,

zero and slope performance,

reference-junction condition.

PID tuning cannot compensate for an incorrectly calibrated pH measurement.

This follows the same principle described in PID troubleshooting: validate the instrument before tuning the controller around its error.

Temperature Compensation Is Often Misunderstood

There are two different temperature effects.

First: the electrochemical response of the glass electrode changes with temperature. The pH transmitter can compensate for this measurement effect.

Second: the actual chemical pH of the process liquid can itself change with temperature.

These are not the same correction.

Automatic temperature compensation helps correct the electrode response, but it does not automatically know the true chemical pH-versus-temperature behaviour of every process solution.

When laboratory and inline measurements are compared, temperature conditions should therefore be considered.

Where necessary, temperature sensors should be included in the process record.

Controller Direction Depends on the Reagent

Adding base generally raises pH.

Adding acid generally lowers pH.

The required controller action therefore depends on which reagent is being manipulated.

Before enabling Auto mode, a small safe Manual output change should confirm:

which actuator is moving,

which reagent is actually being delivered,

and which direction the process pH moves.

Direct or reverse action should be verified from the real process, not selected from memory.

When Both Acid and Base Are Required

Some systems can experience disturbances on both sides of the setpoint.

They may therefore need:

base addition to raise pH

and

acid addition to lower pH.

One controller output can be divided between the two actuators using a split-range strategy.

Conceptually:

a lower output region may command acid,

a centre region may command no reagent,

an upper output region may command base.

The actual ranges depend on the real process gains and actuator sizes. They do not have to be symmetrical.

Avoid Making Acid and Base Fight Each Other

Poor split-range design can cause one reagent to correct the action of the other.

The system may repeatedly add base, overshoot, add acid, overshoot again and continue cycling.

The result is:

unnecessary chemical consumption,

additional salts in the process,

pump and valve wear,

poor pH stability.

A suitable neutral zone or split-range gap can help in appropriate applications.

Good pH control is not only about holding the setpoint. It should also avoid unnecessary acid and base consumption.

Gain Scheduling Can Handle the Nonlinear Titration Curve

Because process gain changes with pH, one useful strategy is to change controller tuning according to the current operating region.

This may be implemented as:

zone-based tuning,

gain scheduling,

or a nonlinear characterization before the PID.

For example, the controller may use:

one gain set in a strongly acidic region,

lower gain through the highly sensitive neutralization region,

a different gain set in the alkaline region.

This is a practical application of the alternatives discussed in PID and other control strategies.

Reagent Concentration Changes Controllability

If the acid or base is extremely concentrated, a very small actuator movement may produce a large process change.

Suppose the minimum stable pump stroke already moves the process from pH 6.7 to pH 7.5.

The problem is not necessarily poor PID tuning.

The dosing system may simply have too much chemical authority for the required control resolution.

A more dilute reagent can provide:

smaller pH change per dose,

a wider usable control range,

smoother final adjustment.

The tradeoff is increased dosing volume.

Mixing Delay Is One of the Most Important pH-Control Problems

Imagine that base enters a neutralization vessel but takes 30 seconds to mix completely.

The pH sensor continues to report a low value during that period.

The controller therefore continues requesting more base.

When the accumulated chemical finally reaches the sensor, pH can overshoot dramatically.

This is not necessarily an indication that proportional gain alone is wrong.

The loop contains significant dead time and process delay.

Increasing controller speed cannot make the chemistry mix faster.

Sensor Location Is Part of the Control Design

A pH sensor placed immediately beside the chemical injection point may see a highly concentrated local pocket of acid or base rather than the average process condition.

That measurement can force the controller to make the wrong correction.

The sensor should generally see a representative, adequately mixed process sample.

But moving it too far downstream increases transport delay.

Sensor placement therefore requires a compromise between:

representative mixing

and

acceptable measurement delay.

Cascade pH-to-Flow Control

Instead of driving a dosing valve directly from the pH PID, the outer pH controller can command a faster reagent-flow loop.

For example:

Outer loop: pH PI → Base-flow setpoint

Inner loop: Flow PID → Dosing valve or pump

The inner flow-control loop can quickly correct pump pressure, valve and hydraulic disturbances.

The slower outer pH loop concentrates on the chemical process.

For cascade control to be effective, the inner loop should respond substantially faster than the outer pH loop.

Feedforward from Process Flow

If incoming process flow is an important disturbance, it can be used for feedforward.

Suppose acidic wastewater increases from 10 m³/h to 20 m³/h.

The likely reagent demand also rises before the outlet pH has had time to move.

A possible structure is:

Influent flow → Estimated base demand

plus:

pH PI → Fine correction

However, influent pH by itself may not be enough to calculate reagent demand accurately because buffer capacity and chemical composition also matter.

This is exactly why feedforward supplements feedback rather than automatically replacing it.

Batch pH Control Behaves Differently from Continuous Neutralization

In a batch vessel, once reagent has been added it cannot simply be removed.

If too much base is added, correcting the overshoot may require acid addition or additional process material.

This makes aggressive integral action particularly risky.

A continuous-flow neutralization system has different dynamics because material continuously enters and leaves the process.

Controller tuning should therefore reflect the actual process type, as discussed in PID tuning for different process types.

PI Is Often a Better Starting Point Than Full PID

P action responds to current pH error.

I action removes a persistent offset.

D action reacts to rapid changes.

But pH measurements can contain:

mixing fluctuations,

electrode noise,

short-term chemical disturbances.

Derivative action may react more strongly to those disturbances than to useful process information.

For many neutralization loops, PI control is therefore a practical starting point.

D should be added only when real process testing demonstrates a useful improvement.

The derivative term also does not literally predict the future; it responds to the rate of change of the measured error or variable.

Output Saturation and Integral Windup

If the base pump is already at 100% output and pH remains too low, the controller has no additional physical authority.

Possible reasons include:

insufficient dosing capacity,

incorrect reagent concentration,

high process flow,

pump failure,

blocked injection equipment.

If the integrator continues accumulating error, integral windup can occur.

When process conditions later improve, the stored integral may drive pH well past the target.

Output limiting and anti-windup are therefore essential topics in PID troubleshooting.

What Can a PLC Do?

A PLC can:

read the pH transmitter,

scale the measurement,

execute the PI/PID calculation,

manage acid/base split-range logic,

control dosing pumps and valves,

handle Auto / Manual operation,

process reagent-tank alarms.

However, chemical dosing limits, equipment interlocks and safe failure behaviour should be designed as part of the wider machine logic rather than relying only on the PID block.

The distinction is covered more generally in PID control with PLCs.

Sensor Failure Needs a Defined Response

If the pH sensor becomes disconnected or produces an invalid measurement, the controller should not blindly continue adding reagent.

The system should evaluate:

measurement quality,

transmitter diagnostics,

engineering limits,

rate-of-change plausibility.

The appropriate failure response depends on the process, but it should be defined intentionally rather than left to uncontrolled PID action.

What Should Be Trended?

A useful SCADA trend can include:

pH SP

pH PV

Controller output

Acid dosing rate

Base dosing rate

Main process flow

Process temperature

Sensor diagnostic status

Auto / Manual mode

If pH starts oscillating, these signals help determine whether the source is:

controller tuning,

influent variation,

mixing delay,

sensor condition,

or dosing-equipment performance.

Common pH-Control Problems

pH cycles widely above and below setpoint: proportional or integral action may be too aggressive for the high-gain neutralization region.

The system repeatedly switches between acid and base: review split-range logic, neutral zone, tuning and reagent strength.

Dosing changes immediately but pH responds late: investigate mixing and transport delay.

Inline and laboratory pH disagree: verify calibration, sample handling and temperature conditions.

pH slowly drifts over several days: electrode ageing, coating or reference-junction contamination may be involved.

The controller is stable in one pH range but unstable in another: process gain may be changing along the titration curve; zone tuning or gain scheduling may help.

The smallest pump output still causes large overshoot: the dosing equipment or reagent concentration may provide too much control authority.

Derivative makes the output noisy: D may be reacting to sensor and mixing fluctuations rather than useful process dynamics.

Typical Applications

Wastewater treatment: neutralization before discharge or downstream processing.

Chemical manufacturing: maintaining reaction conditions and product quality.

Fermentation: maintaining the biochemical process inside a required pH range.

Water treatment: chemical-conditioning and treatment optimization.

Food and beverage processing: recipe and process-condition control.

Each application has different:

chemistry,

buffer capacity,

mixing behaviour,

residence time,

sensor requirements.

pH-Control Commissioning Check

1. Is the pH electrode clean and calibrated?

2. Are the calibration buffers suitable and valid?

3. Are inline and laboratory measurements compared at appropriate temperatures?

4. Is process buffer capacity understood?

5. Is the approximate titration curve or gain region known?

6. Has acid/base control direction been proven in Manual?

7. Is reagent concentration appropriate for controllable dosing?

8. Is mixing adequate between injection and measurement?

9. Are transport delay and sensor response time understood?

10. If split-range control is used, are acid and base being prevented from fighting each other?

11. Are controller gains suitable for the actual pH operating region?

12. Are output limits and anti-windup configured?

13. Can main-process flow be used as feedforward?

14. Is a safe reaction defined for sensor failure?

15. Has the loop been tested at realistic minimum and maximum process loads?

Related PID and pH-Control Topics

PID fundamentals: What Is PID? - P, I and D Components - PID Gain and Tuning - PID Limitations

Process dynamics: PID for Different Process Types - Time Delay and System Dynamics - PID and Other Control Strategies

Measurement and dosing: Analog Signals - Temperature Sensors - PID Flow Control

Control infrastructure: PID with PLCs - PID with SCADA - PID Troubleshooting

Successful pH control depends on much more than Kp, Ki and Kd. The titration curve, buffer capacity, reagent concentration, mixing, transport delay, electrode condition, temperature and dosing-equipment range all determine how the loop behaves.