Feedback loops have been used in selfregulating systems (otherwise known as the routing back of the output of a system to its input) for some years and have become an integral part of modern technology. James Clark Maxwell’s article, On Governors, was one of the earliest attempts to rigorously describe control loops using feedback.^{1}
In the context of control strategies, an openloop control system is the term given to a controller whose action is determined based on predetermined input values without considering feedback.
A closedloop controller, in contrast, incorporates continuous feedback, facilitating realtime adjustments to enhance stability, precision, and robustness and ultimately making it more suitable to help attain the desired control objectives in changing conditions.
The most widespread type of closedloop control system today is the Proportional–Integral–Derivative (PID) controller. The output of a system is continuously measured and adjusted by these types of controllers to match a desired setpoint, that is, a given target condition for the system or process under consideration.
PID controllers are extremely versatile, require little prior knowledge or model of the system, and are relatively costeffective and straightforward to implement. This makes them ideal to implement in various systems: from pneumatics and hydraulics to analog and digital electronics.
For this reason, PID controllers have become extensively used in various industries and research applications, with uses in photonics, manufacturing, material science, sensors, and nanotechnology.
PID control loops are utilized in several aspects of industrial automation and everyday life, with uses ranging from ovens used for cooking food or samples, flow controllers in pipes, the gyroscopes found in selfnavigating cars and smartphones, and even in the management of daily road traffic.
Along with this ubiquitous use, the presence of PID control loops can be noted in more advanced research fields as well: for instance, in closedloop control of MEMSbased (microelectromechanical systems) gyroscopes, in the stabilization of laser cavities and interferometers in photonics and optics, and in the characterization of mechanical resonators in scanning probe microscopy (SPM).
This article presents PID control loops' fundamental principles and functions: outlining their strengths and limitations, analyzing their basic building blocks, and considering their tuning and designing strategies before detailing how they can be easily implemented with Zurich Instruments’ lockin amplifiers.
PID Working Principle and Building Blocks
The principal goal of a PID controller is to produce a control signal that can dynamically minimize the difference between the output and the desired setpoint of a particular system.
It is essential to reflect on the exemplary scheme shown in Figure 1. The output of the system y(t) is looped back and measured against the setpoint r(t) by the comparator as a first step, which generates the timedependent error signal e(t) = r(t)  y(t).
The loop filter then minimizes this error signal and is subsequently used to generate the control signal u(t) that drives the system's output, which initiates closedloop operation. To minimize the error, these steps are continuously executed.
In addition to considering the current error, it is also important to consider both its accumulation over time (represented by the integral) and its future tendency (represented by the derivative at time t), as depicted in Figure 2.
In the most general case, error minimization is accomplished by means of the three primary components of the PID controller loop filter: the integral, proportional, and derivative terms. The complete control function in its most general form can mathematically be written as the sum of the three individual contributions:
where K_{p}, K_{i} and K_{d} are the gain coefficients linked to the proportional, integral, and derivative terms, respectively.
The proportional term is based on the current error between the setpoint and the measured output of the system and is denoted with P. This term applies a correction proportional to the amplitude of the error and helps to take the output of the system back to the setpoint, leading to a reduction of the rise time of the correction signal (as depicted in Figure 3).
The larger the error with a fixed K_{p}, the larger u_{P}(t) – or, in other words, the larger the error, the larger the correction applied by the proportional term.
The P term cannot nullify the error by itself, as it always requires a nonzero error to generate its output. An equilibrium is reached in steadystate system conditions, which includes a steadystate error.
Figure 1. Schematic representation of a general PID control loop in its most general form. Image Credit: Zurich Instruments
Figure 2. Example of error function with the highlighted contributions of the P, I and D terms. Image Credit: Zurich Instruments
The Integral Term
The integral term is denoted with I and applies a correction proportional to the time integral of the error (in other words, the history of the error). For instance, the integral term increases if the error lingers over time, resulting in a more significant correction applied to the system's output.
Unlike the proportional term, the integral term renders it possible for the controller to generate a nonzero control signal  even under a zeroerror condition. This property allows the controller to take the system to the required setpoint. The effect of this is depicted in Figure 4.
The contribution of the accumulated error over time to the control signal is increased by increasing the value of the integral gain coefficient. This means that an integral term with a large gain coefficient will drive the control signal to eliminate the error faster than a smaller integral term if there is a steadystate error.
However, if too much error is accumulated, increasing the integral term too significantly can lead to an oscillating output, which causes the control signal to overshoot and create oscillations around the setpoint. This phenomenon is sometimes known as integral windup.^{2}
Figure 3. Effect of the proportional action. Increasing the K_{p} coefficient reduces the rise time, but the error never approaches zero. Additionally, a toohigh value of the proportional gain might lead to an oscillating output. Image Credit: Zurich Instruments
Figure 4. Effect of the integral action with constant K_{p} = 1. Increasing K_{i}, the response will be faster, leading to larger oscillations and overshoot if the value rises too much (green curve). Image Credit: Zurich Instruments
The Derivative Term
The derivative term is denoted with D and provides control over the error tendency (in other words, its future behavior) with the application of a correction proportional to the time derivative of the error. This facilitates a reduction in the error rate change and consequently helps improve the responsiveness and stability of the control loop.
The goal is to be able to anticipate the changes in the error signal: if the error displays an upward trend, the derivative action tries to compensate without waiting for the error to become significant (proportional action) or for it to remain for some time (integral action).
The derivative action is sometimes omitted in realworld implementations of PIDs due to its high sensitivity to the input signal quality. The derivative of the error tends to become very large when the reference value changes rapidly, as in the case of a very noisy control signal, which causes the PID controller to undergo a rapid change that can result in oscillations or instabilities in the control loop.
Prior lowpass filtering of the error signal is often used as a mitigation strategy to improve stability. However, only limited filtering is possible as lowpass filtering and derivative control neutralize one another.
The derivative action can give a decisive contribution to the controller performance if properly calibrated and the system is sufficiently "tolerant". Figure 5 shows the effect of the derivative term.
The system’s characteristics determine the effect of each term on the system's response.
Therefore, it is possible to adjust the weighting of the K_{p}, K_{i}, and K_{d} gains to finetune the control loop's performance and achieve the preferred accuracy and responsiveness.
Only one or two of the three control terms provided by a PID controller may be required by some applications or simple systems. The unused terms can be set to zero to operate the controller with only a subset of these terms, resulting in a PI, PD, P, or I controller.
For example, it is common to find the use of a PI controller within applications that prioritize stability and steadystate error elimination as opposed to fast response times due to their slow dynamics.
The control of an oven's temperature is a typical example, in which a PI controller is typically utilized to eliminate any steadystate offset and ensure precise temperature regulation, as evidenced by the oven's relatively slow response characteristics.
Figure 5. The purpose of the derivative action is to increase the system's damping; however, too large values of K_{d} might make the system unstable or oscillatory, as described in the text. The curves are obtained keeping the proportional and integral gain constant (K_{p} = 4 and K_{i} = 1 s^{1}). Image Credit: Zurich Instruments
Derivation of An Initial Set of Parameters (Tuning)
One of the critical advantages of PID controllers is that they can be implemented without a detailed model or knowledge of the system. Thanks to heuristic calibration procedures, it is possible to calculate coefficients solely based on simple experimental tests to be carried out directly on the process. The initial tuning of the PID parameters can, nevertheless, be a delicate task.
Several wellestablished methods can be used to derive an initial set of coefficients, many of which involve the measurement of some openloop parameters of the system.
As discussed in this article, openloop is the term given to the behavior of the system without any feedback control, wherein an input signal is applied to the system and the resulting output is just measured but is not fed back to the input.
The input signal may be any other type appropriate for the controlled system, such as a step function, a ramp, or a sine wave. The output of the system is recorded as a function of time. It can be analyzed to determine specific response characteristics of the system, like its natural frequency, time constant, and damping ratio.
The strategy to find initial parameters typically involves three steps:
 The first is to obtain the openloop response of the system and measure some of the characteristic parameters – for instance, the oscillation period of the system output and the process delay.
 The second step is to calculate coarse values of the gain coefficients K_{p}, K_{i} and K_{d} based on the measured parameters.
 The third step is to tune the PID gain coefficients to optimize for speed, noise, or robustness.
The ZieglerNichols method, the CohenCoon method, the relay method, and the TyreusLuyben method are some of the most widespread techniques to achieve coarse tuning.^{3,4,5,6}
Table 1 depicts a practical example of an initial tuning procedure, which was constructed from the ZieglerNichols method.
Table 1. Stepbystep procedure for the Initial tuning of a PID controller, based on the ZieglerNichols method. Source: Zurich Instruments
Set the P,I, and D gain to zero 
↓ 
Increase the proportional (P) gain until the system starts to show consistent and stable oscillation. This value is known as the ultimate gain (K_{u}). 
↓ 
Measure the period of the oscillation (T_{u}). 
↓ 
Depending on the desired type of control loop (P, PI or PID) set the gains to the following values:

K_{p} 
K_{i} 
K_{d} 
P controller 
0.5 K_{u} 
0 
0 
PI controller 
0.45 K_{u} 
0.54 K_{u} / T_{u} 
0 
PID controller 
0.6 K_{u} 
1.2 K_{u} / T_{u} 
0.075 K_{u} T_{u} 

↓ 
Test the response of the system and adjust the gains as necessary. If the response is too slow or sluggish, increase the P or I gain. If the response is too fast or oscillatory, decrease the P or I gain. If there is overshoot or ringing, increase the D gain. 
Principles of PID Controllers
References and Further Reading
 Maxwell James Clerk 1868. On governors, Proc. R. Soc. Lond.16270–283
 Y. Tian and D.P. Atherton. Analysis and Design of Reset Control Systems. Institution of Electrical Engineers, 2004.
 Ziegler, J. G., & Nichols, N. B. (1942). Optimum settings for automatic controllers. Transactions of the ASME, 64(6), 759768.
 Cohen, H., & Coon, G. A. (1953). A linear operator approach to the analysis of closedloop servomechanisms. Journal of the Franklin Institute, 256(6), 489512
 Åström, K. J., & Hägglund, T. (1995). PID controllers: Theory, design, and tuning (2nd ed.). Instrument Society of America.
 Luyben, W. L. (1990). Plantwide control: Some practical considerations. Chemical Engineering Progress, 86(4), 4953.
This information has been sourced, reviewed and adapted from materials provided by Zurich Instruments.
For more information on this source, please visit Zurich Instruments.