SlideShare a Scribd company logo
1 of 6
Download to read offline
FINAL PROJECT: ANALOG PID CONTROL USING OP-AMPS
Objectives
1. Understanding the theory of summing, inverting, differential, derivative, and integra-
tor op-amps.
2. Build a complete analog PID control circuit.
3. Test the input–output signal relation of a PID circuit (i.e., P-only, D only, I only, PD,
PI, PID versions of the circuit).
Components
Item Quantity Part No. Supplier
3 23966 Jameco Electronics (www.jameco.com)
8 29663 Jameco Electronics (www.jameco.com)
4 107633 Jameco Electronics (www.jameco.com)
4 29997 Jameco Electronics (www.jameco.com)
1 - - - Jameco Electronics (www.jameco.com)
2 25540 Jameco Electronics (www.jameco.com)
2 198791 Jameco Electronics (www.jameco.com)
1 20722 Jameco Electronics (www.jameco.com)
LM358 Op-Amp IC
Resistor 1 kΩ
Resistor 4.7 kΩ
Resistor 100 kΩ
Resistor 330 kΩ , 220 Ω , 2.0 MΩ
Capacitor 0.22 µF
Battery 9 V
Breadboard
Set of connection wires 1 set 20079 Jameco Electronics (www.jameco.com)
Theory
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. In order 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. This is done by
LABORATORY EXPERIMENTS
100 kΩ 100 kΩ
100 kΩ
100 kΩ
1 kΩ1 kΩ
1 kΩ
1 kΩ
1 kΩ
4.7 kΩ
1 kΩ
4.7 kΩ
1 kΩ
1 kΩ
Vi
Vref
Vo
–
–
–
–
–
+
+
+
+
+
–9 V
+9 V
–9 V
–9 V
+9 V
–9 V
+9 V
–9 V
+9 V
+9 V
R4 = 220 Ω , 2.0 MΩ
R3 = 330 kΩ
R1 = 4.7 kΩ
R2 = 4.7 kΩ
C = 0.22 μF
C = 0.22 μF
FIGURE 11.18: Analog PID control circuit.
adding a resistor R1 in series with the capacitor C (Figures 11.18, 11.19, 11.20, and 11.21).
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) (11.87)
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. It is easy to show that
Vi(t) = R1 ⋅ i1(t) +
1
C ∫
t
0
i1(𝜏)d𝜏 (11.88)
Vi(s) = R1 ⋅ i1(s) +
1
C
1
s
i1(s) (11.89)
i1(s) =
Cs
R1Cs + 1
Vi(s) (11.90)
MECHATRONICS
FIGURE 11.19: Analog PID control circuit lab setup.
Similarly,
i2(t) =
0 − Vo(t)
R2
(11.91)
i2(s) =
−Vo(s)
R2
(11.92)
FIGURE 11.20: Picture of the analog PID control circuit based on op-amps on a breadboard.
LABORATORY EXPERIMENTS
i1(s) = i2(s) (11.93)
Cs
R1Cs + 1
Vi(s) =
−Vo(s)
R2
(11.94)
Vo(s)
Vi(s)
= −
R2Cs
R1Cs + 1
(11.95)
which shows that the new transfer function is a modified version of the differentiator. It not
only has a zero at the origin s = 0, but also has a pole at s = −1∕(R1C). This added pole
eliminates the high noise amplification problem of the “pure” differentiator.
In practice, an integral op-amp circuit typically includes a parallel resistor with the
capacitor (R4 in Figure 11.18). The reason for this is that a “pure” integrator adds a −90
degree phase (phase lag) to the loop at all frequencies. If we could reduce that phase lag at
least at lower frequencies, it would improve the stability of the closed loop system. Hence,
a pure integrator may be modified with a resistor R4 in parallel with the capacitor in the
feedback path to accomplish this. Let us show the new transfer function by derivation. Let
i1(t) be the current across R1, i2(t) be the current across R2, and i3(t) be the current across
C. From the same op-amp relations, it follows that
i1(t) = i2(t) + i3(t) (11.96)
i1(s) = i2(s) + i3(s) (11.97)
It is straightforward to show the relationships between currents, voltages, and resistors/
capacitor,
Vi(t)
R3
=
0 − Vo(t)
R4
+ C
d(0 − Vo(t))
dt
(11.98)
Vi(s)
R3
=
−Vo(s)
R4
+ Cs(−Vo(s)) (11.99)
MECHATRONICS
Vo(s)
Vi(s)
= −
R4
R3
1
(R4Cs + 1)
(11.100)
Vo(s)
Vi(s)
= −
1
RCs + 1
; for R3 = R4 = R (11.101)
which shows that the addition of R4 in parallel with the C capacitor on the feedback path
changes the “pure integrtor” (which has a pole at s = 0.0) into a first-order filter with a
pole at s = −1∕(R4C), where R and C parameters should be chosen such that the pole at
s = − 1
R4C
≈ 0.0 is close to the origin in order to approximate the integrator function.
The textbook PID controller transfer function is
u(s) =
(
Kp +
Ki
s
+ Kds
)
⋅ e(s) (11.102)
u(t) = Kp ⋅ e(t) + Ki ⋅
∫
e(𝜏)d𝜏 + Kd ⋅
de(t)
dt
(11.103)
where e(s) is the Laplace transform of the error signal, s(s) is the PID controller output.
Procedure
1. Assemble the circuit on the breadboard as shown in Figure 11.18. Take care not to
connect the 9-V batteries until the entire circuit has been assembled.
2. 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.
Experiment with both pure-derivative and pure integral, and modified derivative and
modified integral, versions of the circuit. That is, remove R4 from the integrator
circuit to implement a pure integrator, and remove R1 from the derivative circuit to
implement a pure derivative function.
For the measurements to be taken below, remove R1 from the derivative circuit
and remove R4 from the integrator circuit. There are ten (10) results to capture.
3. Set up the function generator to produce two different wave forms with an amplitude
of 6 V: square wave and sine wave. The frequency of the wave functions can be easily
adjusted on the function generator, for example to 1.0 Hz. Connect the function
generator signal to Vi (feedback signal). Connect the Vref signal to the ground voltage
level.
4. Connect the oscilloscope channel 1 to the input signal from the function generator,
and oscilloscope channel 2 to the output of the differential op-amp, and sketch (or
take a picture of the oscilloscope screen) the input and output waveforms.
5. Connect the oscilloscope channel 1 to the input signal of the proportional op-amp
(output of the differential op-amp), and oscilloscope channel 2 to the output of the
proportional op-amp, and sketch (or take a digital picture of the oscilloscope screen)
the input and output waveforms.
6. Connect the oscilloscope channel 1 to the input signal of the derivative op-amp
(output of the differential op-amp), and oscilloscope channel 2 to the output of the
derivative op-amp, and sketch (or take a digital picture of the oscilloscope screen)
the input and output waveforms.
7. Connect the oscilloscope channel 1 to the input signal of the integrating op-amp
(output of the differential op-amp), and oscilloscope channel 2 to the output of the
LABORATORY EXPERIMENTS
integrator op-amp, and sketch (or take a digital picture of the oscilloscope screen) the
input and output waveforms.
8. Connect the oscilloscope channel 1 to the input signal of the op-amp (output of the
differential op-amp), and oscilloscope channel 2 to the output of the summing op-amp
(which is the output of the PID controller circuit), sketch (or take a digital picture
of the oscilloscope screen) the input and output waveforms. Confirm that the output
voltage of the summing op-amp is the sum of the voltages from the P-I-D sections of
the circuits (voltage outputs from P, I, and D circuits) multiplied with −1.
9. (Optional) Repeat the above 10-result test with the modified derivative (R1 is in the
circuit) and the modified integral term (R4 is in the circuit). Note that the values of the
added R1 and R4’s affect the performance of the PID controller and must be selected
properly for the intended performance.
10. (Optional) Repeat the above 10-result test with the modified derivative (R1 is in the
circuit) and the modified integral term (R4 is in the circuit). Except that in this case,
select a poor value for R4 on purpose so that the circuit is not a good approximation
to the integral function circuit.
11. (Optional) Closed loop control test: build a mathematical model of the PID circuit
(using MATLAB® or Simulink®) and simulate for the same circuit parameters and
input signal conditions, and compare your simulation results with the experiments.
Comment on the causes of the differences between simulation and experimental
results.
12. (Optional) Build a second-order system, that is double integrator (mass-force anal-
ogy), circuit to “simulate” the plant dynamics. Simply connect two integrators in
series. Then connect the output of the PID controller circuit to the input of the
double-integrator (plant), and the output of the double integrator into the negative
port of the PID’s comparator circuit at the input (Figures 2.35 and 2.36 in the text-
book). Using a potentiometer, generate the desired (commanded) output voltage.
Simulate the whole system in MATLAB® or Simulink®. Test the same simulated
conditions on the actual circuit and compare the closed loop system response results
(simulation results and hardware test results). Digital implementation of the PID con-
troller in real-time is given by Equations 2.42–2.44 in the textbook. If the sampling
period T is fast relative to the bandwidth of the system, the digital implementation
should give almost identical results to the analog implementation. The difference
between digital and analog implementation can be tested in simulation only using
MATLAB®/Simulink® without any hardware involvement, in that we should be able
to confirm a selection of a sampling period that is fast enough that the difference
between analog and digital implementation of the PID controller is insignificant. In
the simulation, we can also include the quantization errors due to finite word-length
(finite resolution) of the ADC and DAC converters. Equations 2.42 and 2.44 do not
include the effect of the quantization errors introduced by DAC and ADC.

More Related Content

What's hot

90981041 control-system-lab-manual
90981041 control-system-lab-manual90981041 control-system-lab-manual
90981041 control-system-lab-manualGopinath.B.L Naidu
 
Ee443 phase locked loop - presentation - schwappach and brandy
Ee443   phase locked loop - presentation - schwappach and brandyEe443   phase locked loop - presentation - schwappach and brandy
Ee443 phase locked loop - presentation - schwappach and brandyLoren Schwappach
 
Ec 261 ec 1 lab manual
Ec 261 ec 1 lab manualEc 261 ec 1 lab manual
Ec 261 ec 1 lab manualvikas558
 
A Novel Topology of Multilevel Inverter with Reduced Number of Switches and D...
A Novel Topology of Multilevel Inverter with Reduced Number of Switches and D...A Novel Topology of Multilevel Inverter with Reduced Number of Switches and D...
A Novel Topology of Multilevel Inverter with Reduced Number of Switches and D...IAES-IJPEDS
 
RF Module Design - [Chapter 7] Voltage-Controlled Oscillator
RF Module Design - [Chapter 7] Voltage-Controlled OscillatorRF Module Design - [Chapter 7] Voltage-Controlled Oscillator
RF Module Design - [Chapter 7] Voltage-Controlled OscillatorSimen Li
 
Push pull class b amplifier
Push pull class b amplifierPush pull class b amplifier
Push pull class b amplifierRAGHAVI S
 
Lecture Notes: EEEC6440315 Communication Systems - Analogue Modulation
Lecture Notes:  EEEC6440315 Communication Systems - Analogue ModulationLecture Notes:  EEEC6440315 Communication Systems - Analogue Modulation
Lecture Notes: EEEC6440315 Communication Systems - Analogue ModulationAIMST University
 
RF Module Design - [Chapter 8] Phase-Locked Loops
RF Module Design - [Chapter 8] Phase-Locked LoopsRF Module Design - [Chapter 8] Phase-Locked Loops
RF Module Design - [Chapter 8] Phase-Locked LoopsSimen Li
 
Lect2 up310 (100328)
Lect2 up310 (100328)Lect2 up310 (100328)
Lect2 up310 (100328)aicdesign
 
Unit 3 testing of logic circuits
Unit 3 testing of logic circuitsUnit 3 testing of logic circuits
Unit 3 testing of logic circuitsswagatkarve
 
RF Circuit Design - [Ch3-1] Microwave Network
RF Circuit Design - [Ch3-1] Microwave NetworkRF Circuit Design - [Ch3-1] Microwave Network
RF Circuit Design - [Ch3-1] Microwave NetworkSimen Li
 
Journal On LDO From IJEETC
Journal On LDO From IJEETCJournal On LDO From IJEETC
Journal On LDO From IJEETCSadanand Patil
 

What's hot (20)

90981041 control-system-lab-manual
90981041 control-system-lab-manual90981041 control-system-lab-manual
90981041 control-system-lab-manual
 
Ee443 phase locked loop - presentation - schwappach and brandy
Ee443   phase locked loop - presentation - schwappach and brandyEe443   phase locked loop - presentation - schwappach and brandy
Ee443 phase locked loop - presentation - schwappach and brandy
 
Pll Basic Linkedin2
Pll Basic Linkedin2Pll Basic Linkedin2
Pll Basic Linkedin2
 
Ec 261 ec 1 lab manual
Ec 261 ec 1 lab manualEc 261 ec 1 lab manual
Ec 261 ec 1 lab manual
 
Comparators
ComparatorsComparators
Comparators
 
A Novel Topology of Multilevel Inverter with Reduced Number of Switches and D...
A Novel Topology of Multilevel Inverter with Reduced Number of Switches and D...A Novel Topology of Multilevel Inverter with Reduced Number of Switches and D...
A Novel Topology of Multilevel Inverter with Reduced Number of Switches and D...
 
Phase locked loop
Phase locked loopPhase locked loop
Phase locked loop
 
5
55
5
 
RF Module Design - [Chapter 7] Voltage-Controlled Oscillator
RF Module Design - [Chapter 7] Voltage-Controlled OscillatorRF Module Design - [Chapter 7] Voltage-Controlled Oscillator
RF Module Design - [Chapter 7] Voltage-Controlled Oscillator
 
Push pull class b amplifier
Push pull class b amplifierPush pull class b amplifier
Push pull class b amplifier
 
555 timer tutorial
555 timer tutorial555 timer tutorial
555 timer tutorial
 
Lecture Notes: EEEC6440315 Communication Systems - Analogue Modulation
Lecture Notes:  EEEC6440315 Communication Systems - Analogue ModulationLecture Notes:  EEEC6440315 Communication Systems - Analogue Modulation
Lecture Notes: EEEC6440315 Communication Systems - Analogue Modulation
 
RF Module Design - [Chapter 8] Phase-Locked Loops
RF Module Design - [Chapter 8] Phase-Locked LoopsRF Module Design - [Chapter 8] Phase-Locked Loops
RF Module Design - [Chapter 8] Phase-Locked Loops
 
Lect2 up310 (100328)
Lect2 up310 (100328)Lect2 up310 (100328)
Lect2 up310 (100328)
 
A04220106
A04220106A04220106
A04220106
 
Unit 3 testing of logic circuits
Unit 3 testing of logic circuitsUnit 3 testing of logic circuits
Unit 3 testing of logic circuits
 
ArvindP3
ArvindP3ArvindP3
ArvindP3
 
RF Circuit Design - [Ch3-1] Microwave Network
RF Circuit Design - [Ch3-1] Microwave NetworkRF Circuit Design - [Ch3-1] Microwave Network
RF Circuit Design - [Ch3-1] Microwave Network
 
OPAL-RT - PSIM & eHS Interface
OPAL-RT - PSIM & eHS InterfaceOPAL-RT - PSIM & eHS Interface
OPAL-RT - PSIM & eHS Interface
 
Journal On LDO From IJEETC
Journal On LDO From IJEETCJournal On LDO From IJEETC
Journal On LDO From IJEETC
 

Similar to Final Project

Design and Implementation of Schmitt Trigger using Operational Amplifier
Design and Implementation of Schmitt Trigger using Operational AmplifierDesign and Implementation of Schmitt Trigger using Operational Amplifier
Design and Implementation of Schmitt Trigger using Operational AmplifierIJERA Editor
 
November 21, 20131How a Diode WorksA diode is an electrica.docx
November 21, 20131How a Diode WorksA diode is an electrica.docxNovember 21, 20131How a Diode WorksA diode is an electrica.docx
November 21, 20131How a Diode WorksA diode is an electrica.docxhenrymartin15260
 
A New Proposal for OFCC-based Instrumentation Amplifier
A New Proposal for OFCC-based Instrumentation AmplifierA New Proposal for OFCC-based Instrumentation Amplifier
A New Proposal for OFCC-based Instrumentation AmplifierYayah Zakaria
 
A New Proposal for OFCC-based Instrumentation Amplifier
A New Proposal for OFCC-based Instrumentation AmplifierA New Proposal for OFCC-based Instrumentation Amplifier
A New Proposal for OFCC-based Instrumentation AmplifierIJECEIAES
 
Analog and Digital Electronics Lab Manual
Analog and Digital Electronics Lab ManualAnalog and Digital Electronics Lab Manual
Analog and Digital Electronics Lab ManualChirag Shetty
 
PWM Buck Converter using Average Model
PWM Buck Converter using Average ModelPWM Buck Converter using Average Model
PWM Buck Converter using Average ModelTsuyoshi Horigome
 
Lab 7 diode with operational amplifiers by kehali b. haileselassie and kou
Lab 7  diode with operational amplifiers by kehali b. haileselassie and kouLab 7  diode with operational amplifiers by kehali b. haileselassie and kou
Lab 7 diode with operational amplifiers by kehali b. haileselassie and koukehali Haileselassie
 
Distance Algorithm for Transmission Line with Mid-Point Connected STATCOM
Distance Algorithm for Transmission Line with Mid-Point Connected STATCOMDistance Algorithm for Transmission Line with Mid-Point Connected STATCOM
Distance Algorithm for Transmission Line with Mid-Point Connected STATCOMIRJET Journal
 
PWM Step-down Converter(NJM2309)
PWM Step-down Converter(NJM2309)PWM Step-down Converter(NJM2309)
PWM Step-down Converter(NJM2309)Tsuyoshi Horigome
 
Ec6412 linear-integrated-circuit-laboratory
Ec6412 linear-integrated-circuit-laboratoryEc6412 linear-integrated-circuit-laboratory
Ec6412 linear-integrated-circuit-laboratoryPRADEEPJ30
 
101495802 ee2258-lm-1
101495802 ee2258-lm-1101495802 ee2258-lm-1
101495802 ee2258-lm-1homeworkping7
 
computer architecture notes
computer architecture notes computer architecture notes
computer architecture notes tatendakapuya
 
Design and implementation of cyclo converter for high frequency applications
Design and implementation of cyclo converter for high frequency applicationsDesign and implementation of cyclo converter for high frequency applications
Design and implementation of cyclo converter for high frequency applicationscuashok07
 
Assignment 1 Description Marks out of Wtg() Due date .docx
Assignment 1  Description Marks out of Wtg() Due date .docxAssignment 1  Description Marks out of Wtg() Due date .docx
Assignment 1 Description Marks out of Wtg() Due date .docxfredharris32
 
Tutorial simulations-elec 380
Tutorial simulations-elec 380Tutorial simulations-elec 380
Tutorial simulations-elec 380Moez Ansary
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentIJERD Editor
 

Similar to Final Project (20)

Design and Implementation of Schmitt Trigger using Operational Amplifier
Design and Implementation of Schmitt Trigger using Operational AmplifierDesign and Implementation of Schmitt Trigger using Operational Amplifier
Design and Implementation of Schmitt Trigger using Operational Amplifier
 
November 21, 20131How a Diode WorksA diode is an electrica.docx
November 21, 20131How a Diode WorksA diode is an electrica.docxNovember 21, 20131How a Diode WorksA diode is an electrica.docx
November 21, 20131How a Diode WorksA diode is an electrica.docx
 
A New Proposal for OFCC-based Instrumentation Amplifier
A New Proposal for OFCC-based Instrumentation AmplifierA New Proposal for OFCC-based Instrumentation Amplifier
A New Proposal for OFCC-based Instrumentation Amplifier
 
A New Proposal for OFCC-based Instrumentation Amplifier
A New Proposal for OFCC-based Instrumentation AmplifierA New Proposal for OFCC-based Instrumentation Amplifier
A New Proposal for OFCC-based Instrumentation Amplifier
 
Analog and Digital Electronics Lab Manual
Analog and Digital Electronics Lab ManualAnalog and Digital Electronics Lab Manual
Analog and Digital Electronics Lab Manual
 
PWM Buck Converter using Average Model
PWM Buck Converter using Average ModelPWM Buck Converter using Average Model
PWM Buck Converter using Average Model
 
Lab 7 diode with operational amplifiers by kehali b. haileselassie and kou
Lab 7  diode with operational amplifiers by kehali b. haileselassie and kouLab 7  diode with operational amplifiers by kehali b. haileselassie and kou
Lab 7 diode with operational amplifiers by kehali b. haileselassie and kou
 
Distance Algorithm for Transmission Line with Mid-Point Connected STATCOM
Distance Algorithm for Transmission Line with Mid-Point Connected STATCOMDistance Algorithm for Transmission Line with Mid-Point Connected STATCOM
Distance Algorithm for Transmission Line with Mid-Point Connected STATCOM
 
PWM Step-down Converter(NJM2309)
PWM Step-down Converter(NJM2309)PWM Step-down Converter(NJM2309)
PWM Step-down Converter(NJM2309)
 
Ec6412 linear-integrated-circuit-laboratory
Ec6412 linear-integrated-circuit-laboratoryEc6412 linear-integrated-circuit-laboratory
Ec6412 linear-integrated-circuit-laboratory
 
Fq3510001006
Fq3510001006Fq3510001006
Fq3510001006
 
101495802 ee2258-lm-1
101495802 ee2258-lm-1101495802 ee2258-lm-1
101495802 ee2258-lm-1
 
computer architecture notes
computer architecture notes computer architecture notes
computer architecture notes
 
Design and implementation of cyclo converter for high frequency applications
Design and implementation of cyclo converter for high frequency applicationsDesign and implementation of cyclo converter for high frequency applications
Design and implementation of cyclo converter for high frequency applications
 
Assignment 1 Description Marks out of Wtg() Due date .docx
Assignment 1  Description Marks out of Wtg() Due date .docxAssignment 1  Description Marks out of Wtg() Due date .docx
Assignment 1 Description Marks out of Wtg() Due date .docx
 
Pdc manual
Pdc manualPdc manual
Pdc manual
 
Tutorial simulations-elec 380
Tutorial simulations-elec 380Tutorial simulations-elec 380
Tutorial simulations-elec 380
 
Analog function-generator
Analog function-generatorAnalog function-generator
Analog function-generator
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
ACS 22LIE12 lab Manul.docx
ACS 22LIE12 lab Manul.docxACS 22LIE12 lab Manul.docx
ACS 22LIE12 lab Manul.docx
 

Final Project

  • 1. FINAL PROJECT: ANALOG PID CONTROL USING OP-AMPS Objectives 1. Understanding the theory of summing, inverting, differential, derivative, and integra- tor op-amps. 2. Build a complete analog PID control circuit. 3. Test the input–output signal relation of a PID circuit (i.e., P-only, D only, I only, PD, PI, PID versions of the circuit). Components Item Quantity Part No. Supplier 3 23966 Jameco Electronics (www.jameco.com) 8 29663 Jameco Electronics (www.jameco.com) 4 107633 Jameco Electronics (www.jameco.com) 4 29997 Jameco Electronics (www.jameco.com) 1 - - - Jameco Electronics (www.jameco.com) 2 25540 Jameco Electronics (www.jameco.com) 2 198791 Jameco Electronics (www.jameco.com) 1 20722 Jameco Electronics (www.jameco.com) LM358 Op-Amp IC Resistor 1 kΩ Resistor 4.7 kΩ Resistor 100 kΩ Resistor 330 kΩ , 220 Ω , 2.0 MΩ Capacitor 0.22 µF Battery 9 V Breadboard Set of connection wires 1 set 20079 Jameco Electronics (www.jameco.com) Theory 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. In order 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. This is done by
  • 2. LABORATORY EXPERIMENTS 100 kΩ 100 kΩ 100 kΩ 100 kΩ 1 kΩ1 kΩ 1 kΩ 1 kΩ 1 kΩ 4.7 kΩ 1 kΩ 4.7 kΩ 1 kΩ 1 kΩ Vi Vref Vo – – – – – + + + + + –9 V +9 V –9 V –9 V +9 V –9 V +9 V –9 V +9 V +9 V R4 = 220 Ω , 2.0 MΩ R3 = 330 kΩ R1 = 4.7 kΩ R2 = 4.7 kΩ C = 0.22 μF C = 0.22 μF FIGURE 11.18: Analog PID control circuit. adding a resistor R1 in series with the capacitor C (Figures 11.18, 11.19, 11.20, and 11.21). 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) (11.87) 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. It is easy to show that Vi(t) = R1 ⋅ i1(t) + 1 C ∫ t 0 i1(𝜏)d𝜏 (11.88) Vi(s) = R1 ⋅ i1(s) + 1 C 1 s i1(s) (11.89) i1(s) = Cs R1Cs + 1 Vi(s) (11.90)
  • 3. MECHATRONICS FIGURE 11.19: Analog PID control circuit lab setup. Similarly, i2(t) = 0 − Vo(t) R2 (11.91) i2(s) = −Vo(s) R2 (11.92) FIGURE 11.20: Picture of the analog PID control circuit based on op-amps on a breadboard.
  • 4. LABORATORY EXPERIMENTS i1(s) = i2(s) (11.93) Cs R1Cs + 1 Vi(s) = −Vo(s) R2 (11.94) Vo(s) Vi(s) = − R2Cs R1Cs + 1 (11.95) which shows that the new transfer function is a modified version of the differentiator. It not only has a zero at the origin s = 0, but also has a pole at s = −1∕(R1C). This added pole eliminates the high noise amplification problem of the “pure” differentiator. In practice, an integral op-amp circuit typically includes a parallel resistor with the capacitor (R4 in Figure 11.18). The reason for this is that a “pure” integrator adds a −90 degree phase (phase lag) to the loop at all frequencies. If we could reduce that phase lag at least at lower frequencies, it would improve the stability of the closed loop system. Hence, a pure integrator may be modified with a resistor R4 in parallel with the capacitor in the feedback path to accomplish this. Let us show the new transfer function by derivation. Let i1(t) be the current across R1, i2(t) be the current across R2, and i3(t) be the current across C. From the same op-amp relations, it follows that i1(t) = i2(t) + i3(t) (11.96) i1(s) = i2(s) + i3(s) (11.97) It is straightforward to show the relationships between currents, voltages, and resistors/ capacitor, Vi(t) R3 = 0 − Vo(t) R4 + C d(0 − Vo(t)) dt (11.98) Vi(s) R3 = −Vo(s) R4 + Cs(−Vo(s)) (11.99)
  • 5. MECHATRONICS Vo(s) Vi(s) = − R4 R3 1 (R4Cs + 1) (11.100) Vo(s) Vi(s) = − 1 RCs + 1 ; for R3 = R4 = R (11.101) which shows that the addition of R4 in parallel with the C capacitor on the feedback path changes the “pure integrtor” (which has a pole at s = 0.0) into a first-order filter with a pole at s = −1∕(R4C), where R and C parameters should be chosen such that the pole at s = − 1 R4C ≈ 0.0 is close to the origin in order to approximate the integrator function. The textbook PID controller transfer function is u(s) = ( Kp + Ki s + Kds ) ⋅ e(s) (11.102) u(t) = Kp ⋅ e(t) + Ki ⋅ ∫ e(𝜏)d𝜏 + Kd ⋅ de(t) dt (11.103) where e(s) is the Laplace transform of the error signal, s(s) is the PID controller output. Procedure 1. Assemble the circuit on the breadboard as shown in Figure 11.18. Take care not to connect the 9-V batteries until the entire circuit has been assembled. 2. 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. Experiment with both pure-derivative and pure integral, and modified derivative and modified integral, versions of the circuit. That is, remove R4 from the integrator circuit to implement a pure integrator, and remove R1 from the derivative circuit to implement a pure derivative function. For the measurements to be taken below, remove R1 from the derivative circuit and remove R4 from the integrator circuit. There are ten (10) results to capture. 3. Set up the function generator to produce two different wave forms with an amplitude of 6 V: square wave and sine wave. The frequency of the wave functions can be easily adjusted on the function generator, for example to 1.0 Hz. Connect the function generator signal to Vi (feedback signal). Connect the Vref signal to the ground voltage level. 4. Connect the oscilloscope channel 1 to the input signal from the function generator, and oscilloscope channel 2 to the output of the differential op-amp, and sketch (or take a picture of the oscilloscope screen) the input and output waveforms. 5. Connect the oscilloscope channel 1 to the input signal of the proportional op-amp (output of the differential op-amp), and oscilloscope channel 2 to the output of the proportional op-amp, and sketch (or take a digital picture of the oscilloscope screen) the input and output waveforms. 6. Connect the oscilloscope channel 1 to the input signal of the derivative op-amp (output of the differential op-amp), and oscilloscope channel 2 to the output of the derivative op-amp, and sketch (or take a digital picture of the oscilloscope screen) the input and output waveforms. 7. Connect the oscilloscope channel 1 to the input signal of the integrating op-amp (output of the differential op-amp), and oscilloscope channel 2 to the output of the
  • 6. LABORATORY EXPERIMENTS integrator op-amp, and sketch (or take a digital picture of the oscilloscope screen) the input and output waveforms. 8. Connect the oscilloscope channel 1 to the input signal of the op-amp (output of the differential op-amp), and oscilloscope channel 2 to the output of the summing op-amp (which is the output of the PID controller circuit), sketch (or take a digital picture of the oscilloscope screen) the input and output waveforms. Confirm that the output voltage of the summing op-amp is the sum of the voltages from the P-I-D sections of the circuits (voltage outputs from P, I, and D circuits) multiplied with −1. 9. (Optional) Repeat the above 10-result test with the modified derivative (R1 is in the circuit) and the modified integral term (R4 is in the circuit). Note that the values of the added R1 and R4’s affect the performance of the PID controller and must be selected properly for the intended performance. 10. (Optional) Repeat the above 10-result test with the modified derivative (R1 is in the circuit) and the modified integral term (R4 is in the circuit). Except that in this case, select a poor value for R4 on purpose so that the circuit is not a good approximation to the integral function circuit. 11. (Optional) Closed loop control test: build a mathematical model of the PID circuit (using MATLAB® or Simulink®) and simulate for the same circuit parameters and input signal conditions, and compare your simulation results with the experiments. Comment on the causes of the differences between simulation and experimental results. 12. (Optional) Build a second-order system, that is double integrator (mass-force anal- ogy), circuit to “simulate” the plant dynamics. Simply connect two integrators in series. Then connect the output of the PID controller circuit to the input of the double-integrator (plant), and the output of the double integrator into the negative port of the PID’s comparator circuit at the input (Figures 2.35 and 2.36 in the text- book). Using a potentiometer, generate the desired (commanded) output voltage. Simulate the whole system in MATLAB® or Simulink®. Test the same simulated conditions on the actual circuit and compare the closed loop system response results (simulation results and hardware test results). Digital implementation of the PID con- troller in real-time is given by Equations 2.42–2.44 in the textbook. If the sampling period T is fast relative to the bandwidth of the system, the digital implementation should give almost identical results to the analog implementation. The difference between digital and analog implementation can be tested in simulation only using MATLAB®/Simulink® without any hardware involvement, in that we should be able to confirm a selection of a sampling period that is fast enough that the difference between analog and digital implementation of the PID controller is insignificant. In the simulation, we can also include the quantization errors due to finite word-length (finite resolution) of the ADC and DAC converters. Equations 2.42 and 2.44 do not include the effect of the quantization errors introduced by DAC and ADC.