This document describes an experiment to build an analog PID controller circuit using op-amps. It includes:
1. An introduction to the basic concepts of proportional, integral and derivative control and how they are implemented using op-amps.
2. Analysis of the circuit diagrams for differential input, derivative, and integrator op-amps used to build the PID controller.
3. Procedures to assemble the circuit, test it using a function generator and oscilloscope, and calculate gains.
4. Results showing the input-output signal relationships for each component, along with calculated gains and pole locations. Square and sine wave responses are shown for the complete PID controller.
5. A conclusion that the
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
PID Control
1. 1
EXPERIMENT 6
ANALOG PID CONTROL
USING OP-AMPS
GROUP MEMBERS
Name UIN Email Id Date
Chen Lin(Group Leader) 669254454 clin208@uic.edu 12/7/2018
We Li 650044178 wli89@uic.edu 12/7/2018
Angie Kampert 667662630 akampe2@uic.edu 12/7/2018
Shriram Vasudevan 651286693 svasud5@uic.edu 12/7/2018
Vijay Anand Velmurugan 678608544 vvelmu2@uic.edu 12/7/2018
2. 2
Contents
1. SUMMARY................................................................................................................................ 3
2. DESCRIPTION OF THE EXPERIMENT......................................................................................... 4
2.1 Basic Concepts..............................................................................................................4
2.2 Analysis of the Circuit...................................................................................................7
3. LIST OF COMPONENTS........................................................................................................... 12
4. Porcedures..............................................................................................................................13
5. Results......................................................................................................................................14
6. Conclusion................................................................................................................................20
3. 3
SUMMARY
The below objectives were accomplished with results describing the different modes of
operation using voltage characteristics.
Understanding the theory of summing, inverting, differential, derivative, and integrator
op-amps.
Build a complete analog PID control circuit.
Test the input–output signal relation of a PID circuit (i.e., P-only, D only, I only, PID
versions of the circuit).
Compare the results and evaluate the reasons for difference between real and
simulated outputs.
Figuring out conclusions.
4. 4
DESCRIPTION OF THE EXPERIMENT
1.Basic Concept
The “pure” derivative has a large gain at high frequency and will amplify the noise in the closed
loop, and hence lead to stability problems. To reduce the gain of the pure derivative at high
frequency, a practical derivative op-amp circuit is modified so that it has a first-order pole in
addition to the derivative, hence reducing the high frequency gain of the transfer function
thereby reducing the problem of noise amplification.
Figure 1. PID control
adding a resistor R1 in series with the capacitor C .Let us derive the transfer function for this
practical derivative circuit. Notice that v+ = GND and v+ = v− at the input terminals of the op-
amp. Since there cannot be current drawn into the op-amp, then i1(t) = i2(t)where i1(t) is the
current on the input side of the op-amp through R1 and C, and i2(t) is the current on the
feedback loop of the op-amp through R2.
1.1 Derivative
A derivative term does not consider the error (meaning it cannot bring it to zero: a pure D
controller cannot bring the system to its setpoint), but the rate of change of error, trying to
bring this rate to zero. It aims at flattening the error trajectory into a horizontal line, damping
the force applied, and so reduces overshoot (error on the other side because too great applied
force). Applying too much impetus when the error is small and is reducing will lead to
overshoot. After overshooting, if the controller were to apply a large correction in the opposite
direction and repeatedly overshoot the desired position, the output would oscillate around the
setpoint in either a constant, growing, or decaying sinusoid. If the amplitude of the oscillations
5. 5
increases with time, the system is unstable. If they decrease, the system is stable. If the
oscillations remain at a constant magnitude, the system is marginally stable.
1.2 Control damping
In the interest of achieving a controlled arrival at the desired position (SP) in a timely and
accurate way, the controlled system needs to be critically damped. A well-tuned position
control system will also apply the necessary currents to the controlled motor so that the arm
pushes and pulls as necessary to resist external forces trying to move it away from the required
position. The setpoint itself may be generated by an external system, such as a PLC or other
computer system, so that it continuously varies depending on the work that the robotic arm is
expected to do. A well-tuned PID control system will enable the arm to meet these changing
requirements to the best of its capabilities.
1.3 Proportional term
Figure 2.Response of PV to step change of SP vs time, for three values of Kp (Ki and Kd held constant)
The proportional term produces an output value that is proportional to the current error value.
The proportional response can be adjusted by multiplying the error by a constant Kp, called the
proportional gain constant.
The proportional term is given by
P out = Kp*e(t)
A high proportional gain results in a large change in the output for a given change in the error. If
the proportional gain is too high, the system can become unstable. In contrast, a small gain
6. 6
results in a small output response to a large input error, and a less responsive or less sensitive
controller. If the proportional gain is too low, the control action may be too small when
responding to system disturbances. Tuning theory and industrial practice indicate that the
proportional term should contribute the bulk of the output change.
1.4 Integral term
Figure 3.Response of PV to step change of SP vs time, for three values of Ki (Kp and Kd held constant)
The contribution from the integral term is proportional to both the magnitude of the error and
the duration of the error. The integral in a PID controller is the sum of the instantaneous error
over time and gives the accumulated offset that should have been corrected previously. The
accumulated error is then multiplied by the integral gain (Ki) and added to the controller output.
The integral term is given by
I out = K i ∫ 0 t e ( τ ) d τ .
1.5 PID controller
A proportional–integral–derivative controller (PID controller or three term controller) is
a control loop feedback mechanism widely used in industrial control systems and a variety of
other applications requiring continuously modulated control. A PID controller continuously
calculates an error value as the difference between a desired setpoint (SP) and a
measured process variable (PV) and applies a correction based on proportional, integral,
and derivative terms (denoted P, I, and D respectively) which give the controller its name.
In practical terms it automatically applies accurate and responsive correction to a control
function. An everyday example is the cruise control on a road vehicle; where external
7. 7
influences such as gradients would cause speed changes, and the driver has the ability to alter
the desired set speed. The PID algorithm restores the actual speed to the desired speed in the
optimum way, without delay or overshoot, by controlling the power output of the vehicle's
engine.
The first theoretical analysis and practical application was in the field of automatic steering
systems for ships, developed from the early 1920s onwards. It was then used for automatic
process control in manufacturing industry, where it was widely implemented in pneumatic, and
then electronic, controllers. Today there is universal use of the PID concept in applications
requiring accurate and optimized automatic control.
2 Analysis of the Circuit
Figure 4.The circuit of the analog PID controller
8. 8
2.1 Differential Input Op-Amp
Figure 5.Differential input amplifier
The desired function is to determine the difference between two signals and possibly multiply the
difference with a gain,
which is used in closed loop control circuits as the summing junction that is find the difference
between a command signal and sensor signal. (Figure 5) shows a differential input op-amp
circuit. In its general form, the input–output relationship can be obtained using the
superposition principle. The output is the sum of the outputs due to the inverting input and the
non-inverting input. The superposition principle can be used in the derivation: (i) connect V2 to
ground and solve for v’o = K1 ⋅ V1, and (ii) connect V1 to ground and solve for v”o = K2 ⋅
V2. Then, add them together to get Vo = v’o + v”o . The output due to input at its non-
inverting terminal is
And the output due to input at its inverting terminal is
9. 9
The total output is
Note that when R1 = R2 = R3 = R4, the input–output relationship is
Similarly, when R1 = R3 = R and R2 = R4 = K ⋅ R,
One of the main usages of differential op-amps is in amplifying noise sensitive signals. As
discussed in Figure 5, single-ended signals are referenced with respect to ground. Any noise
induced on the signal wire coming into the op-amp would be amplified. This is particularly
problematic when the noise signal is comparable to the actual signal magnitude. In such cases,
it is best to transmit the signal voltage in differential-ended format. That is using two wires and
the signal information is the voltage difference between the two wires. If any noise is induced
during the transmission, it would be induced on both lines and the difference between them
would still be unaffected by noise.
2.2 Differentiator Op-Amp
Figure 6. Differentiator amplifier
The desired function of a derivative op amp, shown in Figure 6, was to amplify the
derivative of the input voltage to output voltage with a gain.
10. 10
Figure 6 shows an op-amp circuit for differentiation. Using the ideal op-amp assumptions,
the input–output relationship is derived as follows,
Hence,
In our experiment setting, we modified the derivative op-amp to reduce the noise from
high frequency gain. We added a resistor R1 in series to the capacitor as shown in circuit
diagram. Hence,
2.3 Integrator Op-Amp
Figure 7.Integrator amplifier
11. 11
The Integrator op-amp was designed to amplify the integral of the input voltage over a period
of time with a gain. If we change the locations of the resistor and capacitor in the derivative op-
amp, we obtain an integrating op-amp circuit (Figure 7). The desired function is,
where Vo(0) is the initial voltage. The derivation of the I/O relationship is straightforward,
where the initial voltage values in the integrations have been neglected. In practice, a resistor
was added in parallel with the capacitor, shown in circuit diagram, to reduce the phase lag at
low frequency content and improve the stability of integrator op-amp. Thus, the input-output
of this modified integrator op-amp was obtained as following,
2.4 The Relationship between Input and Output
For the Proportional Controller, the transfer function was
For the modified Differentiator Controller, the transfer function was
For the modified Integrator Controller, the transfer function was
12. 12
Therefore, the complete transfer function for the PID controller in practice was,
LIST OF COMPONENTS
Component Quantity
LM358 Op-Amp IC 5
Resistor 220 Ω 1
Resistor 1 k Ω 8
Resistor 4.7 k Ω 4
Resistor 100 k Ω 4
Resistor 330 k Ω 1
Capacitor 0.22μF 2
Power Supply 1
DMM 1
Breadboard 2
Connector wires 1 set
Oscilloscope 1
Function Generator 1
13. 13
Procedures
1. Assemble the circuit on the breadboard as shown in part 4 Circuit Diagram. Since the circuit
is involved with 5 op-amps, over 15 components and numerous wires, we build the circuit
on 2 breadboards. The PID controller is built in one breadboard. The input comparator and
output amplifier are built in another breadboard. In this way, we can avoid the touching
between components and it is easier for us to check the circuit.
2. Set up the function generator to produce the square wave signal with an amplitude of 6V.
The frequency of the wave functions can be easily adjusted on the function generator.
Connect the function generator signal to Vi (feedback signal). Connect the Vref to the ground.
3. Connect the oscilloscope to the input signal of the proportional op-amp, and the output of
the proportional op-amp. Then, take a picture of the oscilloscope screen.
4. Connect the oscilloscope to the input signal of the derivative op-amp, and the output of the
derivative op-amp. Then, take a picture of the oscilloscope screen.
5. Connect the oscilloscope to the input signal of the integrating op-amp, and the output of
the integrator op-amp. Then, take a picture of the oscilloscope screen.
6. Connect the oscilloscope channel 1 to the input signal of the whole PID controller circuit,
and oscilloscope channel 2 to the output of the summing op-amp (which is the output of
the PID controller circuit). Then, take a picture of the oscilloscope screen.
7. Derive the complete transfer function of the PID controller. Calculate the proportional,
derivative, and integrator gains: KP, KD, KI, and the additional pole location of the modified
derivative term, and pole location and gain of the modified integral term.
14. 14
Results
Differential Input Op-Amp
Figure 8.Non-Inverted Amplifier Assembly
Gain for differential:
Simplifying,
, 꿘ቩ
= =
tΩ
tΩ
= 1
Using resistors of only tΩ, the gain of the proportional controller is 1.
Figure 9 shows the square graphs obtained from oscilloscope and corresponding pure
differential outputs.
15. 15
a. b.
Figure 9. Square graphs obtained from oscilloscope and corresponding pure differential outputs with 1kΩ
resistors.
Fig. 9 demonstrates the amplification of the input error by multiplication of the gain of the
proportional controller, 1.
Derivative Op-Amp
Figure 10. Inverting Amplifier Assembly
Gain for pure derivative:
⩗
Simplifying,
ቩ⩗ o Ω⩗ -1.034e-3s
ቩ Ǥ
16. 16
Gain for modified derivative:
⩗
⩗
Simplifying,
o Ω⩗
o Ω⩗
-1.034e-3s
ቩ -1.034e-3s
Pole for modified derivative:
⩗
o
Ǥ e
-1.034e-3* Ǥ e ǤǤǤǤǤ Ǥ m
ቩ
The pure and modified gains and pole for the derivative op-amp can be seen in Table 1 .
Table 1. Derivative Gains and Pole Results
Pure Derivative Gain, ቩ Ǥ
Modified Derivative Gain, ቩ
Modified pole, s Ǥ e
Figure 11 shows the square graphs of the input-output signal relationships for the derivative
op-amp.
a.
Figure 11. Square graph from the pure derivative output with a 4.7kΩ resistor and .22 i .
The figure demonstrates high input and output voltages at the spike outputs.
17. 17
Integrating Op-Amp
Figure 12. Inverting Amplifier Assembly
Gain for pure integrator:
⩗
Simplifying,
⩗ ǤΩ⩗ m⩗
m
Gain for modified integrator:
⩗
Simplifying,
ǤΩ⩗ m⩗
m⩗
Pole for modified integrator:
⩗
m
18. 18
m
Ǥ m
The resulting pure and modified gains and pole can be seen in Table 2
Table 2. Integrator Gains and Pole Results
Pure Integrator Gain, m
Modified Integrator Gain, Ǥ m
Modified pole, s
Figure 13 shows the square graphs of the input-output signal relationships for the integrating
op-amp.
Figure 13. Square graph from the pure derivative output with a 220Ω resistor and .22 i .
The modified integrator creates a saw teeth wave with some noise contained in the circuit.
PID Controller
Figure 14.The circuit of analog PID controller
19. 19
The proportional–integral–derivative controller utilizes the modified controllers. The values used for the
PID from previous the previous modified circuits can be seen in Table 3 .
Table 3. PID Gain Values
Proportional Gain, 1
Modified Derivative Gain, ቩ ቩ
Modified pole, s Ǥ e
Modified Integrator Gain, Ǥ m
Modified pole, s
Figure 15 shows the square and sine waves for the PID controller.
a. b. c.
Figure 15. The square graphs are shown in a. and b. for the PID controller. The sine wave can be seen in c.
20. 20
Conclusion
In this lab, we built an analog PID controller with op-amps LM358 and several resistors and
capacitors by putting the differential, proportional, derivative and integral op-amps together.
The control signal is thus a sum of three terms: a proportional term that is proportional to the
error, an integral term that is proportional to the integral of the error, and a derivative term
that is proportional to the derivative of the error. A good PID controller should have quick and
stable response. After building and testing the PID controller, we found that there’s some noise
being amplified. We tried to change the capacitors and the op-amps several times and finally
got pretty good output graph.