PID controller (2)

Thread Starter

Pete3512

Joined Dec 12, 2025
1
I can give you a quick introduction to PID control.

P = proportional
I = integral
D = derivative

You can make a controller with P alone, PI, PD, or PID.

Let us use a temperature controller for an oven as an example.
Ttarget is the temperature you wish to attain.
T is the present measured temperature
Terror = Ttarget - T

In a controller, the goal is to bring Terror to zero as quickly and smoothly as possible.
For this we need to develop three parameters or multipliers (i.e. gain):
Kp
Ki
Kd

P controller

V = Kp x Terror

where V represents the voltage (or controlling parameter) applied to the system to reach the target.
Here we can see that we need to increase the voltage when the error is large. We reduce the voltage to zero when the target is reached.

PI controller

V = Kp x Terror + Ki x sum(Terror)

In the P controller, we can imagine that when the target temperature is attained, the temperature will tend to drift away if the controller voltage V is set to zero. We need to maintain a steady voltage to maintain the status quo. That is where the integral term comes into play.

What is the integral?
The integral is the summation over time of repeated error measurements. When we are far away from the target the error is large. When we have reached the target the error will oscillate about zero. Over time the integral will settle to a finite value that represents this DC offset that needs to be applied to the controlling voltage.

PID controller

V = Kp x Terror + Ki x sum(Terror) + Kd x rate_of_change(Terror)

The derivative term introduces the rate of change of the error.
Rate of change is measured as ΔTerror/Δtime

Imagine that this is a heated oven and someone opens the door of the oven.
The temperature falls suddenly. The rate of change is a measurement of how quickly the temperature changed over a given time, for example, 5 seconds.

The derivative term allows the controller to make quick corrections due to perturbations, i.e. rapidly changing conditions.

So that is a PID controller in a nutshell.

Tuning a PID controller involves performing various tests or via trial and error in order to determine the appropriate values for Kp, Ki, and Kd.

Edit:
If your K values are too low, the system will be slow to reach the target or may never reach the target.
If your K values are too high, the system will overshoot the target and may oscillate about the target.
Choosing the right values of K will allow the system to reach the target as quickly as possible and not overshoot or oscillate.
As a beginner to this topic, you've wonderfully explained the working of the PID technology in a very good concise way.
Quite awesome, l like your explanation which gives me a clear understanding of how it works. Years ago, l've come up on a
website that was as similar in terms of a good simplistic view.

Moderator edit: New thread created from this.
 

MrChips

Joined Oct 2, 2009
34,807
Welcome to AAC!

A good way to learn and practice using PID controllers is by experimentation.
A simple experimental setup is to drive a resistor with a PWM DC voltage. Tape a NTC thermistor against the resistor. Now measure the temperature of the resistor and write a program on an MCU to implement a PI controller.
 

MisterBill2

Joined Jan 23, 2018
27,507
My experience has been that in real world linear feedback systems, derivative is VITAL.
Of course there are the two basic feedback system types, which are analog and ON/OFF feedback,
 

MisterBill2

Joined Jan 23, 2018
27,507
The Derivative function is used to reduce the correction magnitude signal as the error magnitude is reduced. The benefit is reduced overshoot, Derivative reduces overshoot in systems where there is inertia, where the rate of change can not instantly be reduced.
 
Top