13
OPA01: Op-Amp Based Control Synthesis Interdisciplinary Automatic Controls Laboratory - ME/ECE/CHE 389 February 8, 2016 Contents 1 Lab Objective 1 2 Introduction to the Operational Amplifier 2 2.1 The detailed model ...................................... 2 2.2 The ideal model ........................................ 3 2.3 Feedback Configuration .................................... 3 2.4 Review of circuit analysis: Kirchhoff’s Laws ........................ 3 2.5 Current–voltage Relation of the Capacitor .......................... 4 2.6 Analysis of a Voltage Follower with the Detailed Model ................... 5 2.7 Analysis of a Voltage Follower with the Ideal Model .................... 6 3 LabView Files 6 4 Individual Circuit Analysis and Testing 7 4.1 Circuit 1: Inverter ....................................... 7 4.2 Circuit 2: Signal Addition (Summer) ............................. 8 4.3 Circuit 3: Signal Subtraction ................................. 9 4.4 Circuit 4: Derivative ..................................... 10 4.5 Circuit 5: Integrator ...................................... 11 5 Circuit 6: PID 12 5.1 Pre Lab: PID Analysis .................................... 12 5.2 In Lab: Integrator Testing ................................... 12 A 741 Op-Amp Schematic 13 B Resistor Code 13 1 Lab Objective This laboratory will cover the use of operational amplifiers (op-amps) to build an analog PID controller that will be used to control a simulated DC motor. See here for a good introduction to op-amp circuit analysis. 1

OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

OPA01: Op-Amp Based Control SynthesisInterdisciplinary Automatic Controls Laboratory - ME/ECE/CHE 389

February 8, 2016

Contents

1 Lab Objective 1

2 Introduction to the Operational Amplifier 22.1 The detailed model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22.2 The ideal model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.3 Feedback Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.4 Review of circuit analysis: Kirchhoff’s Laws . . . . . . . . . . . . . . . . . . . . . . . . 32.5 Current–voltage Relation of the Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . 42.6 Analysis of a Voltage Follower with the Detailed Model . . . . . . . . . . . . . . . . . . . 52.7 Analysis of a Voltage Follower with the Ideal Model . . . . . . . . . . . . . . . . . . . . 6

3 LabView Files 6

4 Individual Circuit Analysis and Testing 74.1 Circuit 1: Inverter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74.2 Circuit 2: Signal Addition (Summer) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84.3 Circuit 3: Signal Subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94.4 Circuit 4: Derivative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.5 Circuit 5: Integrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5 Circuit 6: PID 125.1 Pre Lab: PID Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125.2 In Lab: Integrator Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

A 741 Op-Amp Schematic 13

B Resistor Code 13

1 Lab Objective

This laboratory will cover the use of operational amplifiers (op-amps) to build an analog PID controllerthat will be used to control a simulated DC motor. See here for a good introduction to op-amp circuitanalysis.

1

Page 2: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

2 Introduction to the Operational Amplifier

Figure 1: General op-amp schematic.

The op-amp is a differential, high-input resistance, high-gain, low-output resistance device. It is typicallyused in feedback configurations to implement all sorts of useful circuits such as amplifiers, integrators,differentiators, filters, etc. The op-amp allows simple circuits to be combined into more complicatedcircuits, for example a PID controller.

The op-amp symbol is shown in Figure 1. The high supply and low supply are the power supplies to theop-amp. Normally, these will be +15 and −15 volts, respectively. Supply voltages can usually be ignoredwhen doing circuit analysis, they only become relevant to the analysis when the output voltage comesclose to one of the supplies. The supplies act as limits on the output voltage.

The op-amp has two inputs, called the “inverting” input and the “non-inverting” input. The op-amp takesthe difference of the non-inverting and the inverting inputs, multiplies it by a gain which becomes theoutput of the op-amp. Typically the gain is written as A, in which case the output is given by

Vout = A(V+ − V−), (1)

where V+ is the voltage to in non-inverting input, V− is the voltage to the inverting input, and Vout is theop-amp output voltage. The gain, A, can be very large, typically around 100,000 to 200,000. Becauseop-amps have such a large gain they are useful for feedback configurations, as we will see.

2.1 The detailed model

Figure 2: Detailed op-amp model.

The “detailed” model of the op-amp is shown in Figure 2. The + is associated with the non-invertinginput and the − is associated with the inverting input. The inputs are connected by a resistor, Rin, calledthe input resistance. Usually, the input resistance is very large. The output is connected by an outputresistance, Rout, which is very small, typically around a few ohms. In a real op-amp there are around 20– 30 transistors and resistors that make the op-amp work. However, when doing circuit analysis, we onlyrequire a simple model. Typically, the “detailed” model, shown in Figure 2, or the even simpler “ideal”model, shown in Figure 3, are adequate to determine a good approximation of the behavior of the circuit.

2

Page 3: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

2.2 The ideal model

Figure 3: Ideal op-amp model.

In the ideal model shown in Figure 3, the input resistance is infinite, the output resistance is zero, and thegain is infinite. Naturally, this seems strange, since if the gain is infinite the output will be infinite if thedifference between the inputs is anything other than zero. Don’t be alarmed as we explore more about howto analyze op-amp circuits, the ideal model’s usefulness will become much more apparent.

2.3 Feedback Configuration

(a) Negative feedback. (b) Positive feedback.

Figure 4: op-amp feedback configurations.

Typically, op-amps are used in feedback configurations. Figure 4(a) shows the negative feedback con-figuration and Figure 4(b) shows the positive feedback configuration. In the negative feedback case, theoutput voltage is expressed as Vout = A(Vin − Vout), which is stabilizing. To see this, consider the caseof Vout < Vin. Since the gain is positive, the amplifier increases the value of Vout. Now consider the caseof Vout > Vin. Now the gain becomes negative and the amplifier decreases the value of Vout. Thus, thenegative feedback configuration is stabilizing because Vout to converges to Vin.

In the positive feedback configuration, the output voltage is given by Vout = A(Vout − Vin), which resultsin run away gain in any case other than Vout exactly equal to Vin. Thus, the positive feedback configurationis destabilizing.

2.4 Review of circuit analysis: Kirchhoff’s Laws

Before continuing with the analysis of op-amps, it is necessary to review how to analyze simple elec-trical circuits. There are two laws that define basic circuit theory; Kirchhoff’s Voltage Law (KVL) andKirchhoff’s Current Law (KCL).

KVL simply states that the sum of the voltage drops around a closed loop is zero. (Voltage is potentialenergy per unit charge of electrons). KVL is based on conservation of potential energy. The convention ofsumming the voltages begins at any point in the circuit, continuing in a loop until you return to the same

3

Page 4: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

point. If you hit the (+) side of a component before you reach the (-) side, then you add that voltage. Ifyou hit the (-) side first then you subtract that voltage, see Figure 5(a).

KCL simply states that the sum of the currents entering a node equals zero. This is based on conservationof charge (or electrons). A node is any place where two or more components join. By convention, thecurrent entering a node is added, while the current leaving a node is subtracted. Also, recognize that anytwo nodes connected only by wire (with nothing else between them) can be regarded as the same node,see Figure 5(b).

There are three principle steps to analyze a circuit with KVL and KCL:

Step 1: List the v/i relationship for each component (e.g. v = iR and i = Cdv/dt).

Step 2: List the KVL and KCL equations.

Step 3: Solve the KVL and KCL equations.

(a) KVL: −vs + v1 + v2 − v3 = 0 (b) KCL at node n1: is − i1 + i2 − i3 = 0

Figure 5: Kirchhoff’s voltage law (KVL) and current law (KCL).

2.5 Current–voltage Relation of the Capacitor

The current I(t) through an electric circuit is defined as the rate of flow of a charge passing through it, butactual charge cannot pass through a capacitor. Rather, one electron accumulates on the negative plate foreach one that leaves the positive plate, resulting in an electron depletion and consequent positive charge onone electrode that is equal and opposite to the accumulated negative charge on the other. Thus the chargeon the electrodes is equal to the integral of the current

Q(t) =

∫ t

0

I(τ)dτ, (2)

and the voltage is proportional to the charge

V (t) =Q(t)

C=

1

C

∫ t

0

I(τ)dτ, (3)

where C is the capacitance. In order to determine the current through the circuit, we can differentiate toobtain

I(t) =dQ(t)

dt= C

dV (t)

dt. (4)

4

Page 5: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

2.6 Analysis of a Voltage Follower with the Detailed Model

To begin the general op-amp circuit analysis, we start with the detailed model. Figure 6 shows a voltagefollower circuit constructed with a really crumby op-amp. The op-amp has a low gain ofA = 10 and a lowinput resistance of Rin = 1 kΩ. Using the detailed model we can analyze this circuit with nodal analysis.

Figure 6: op-amp voltage follower with detailed op-amp model.

The voltage follower circuit is redrawn in Figure 7 to clarify the analysis. Considering each of the nodesn1 through n4 individually, we can write down a system of equations to solve for the circuit node voltages.

Node 1: V1 = 3

Node 2: (V1 − V2 = 300i1) = (V2 − V3 = 1000i1)

Node 3: V3

1000+ V3−V4

50= i1

Node 4: V4 = 10(V+ − V−)→ V4 = 10(V+ − V−)

This results in 4 equations with 4 unknowns, which can be solved to obtain,

V1 = 3, V2 = 2.92, V3 = 2.64, and V4 = 2.76. (5)

In the ideal case, i.e. a perfect op-amp, we would expect V3, which is really the op-amp output voltage Vout

to be equal to 3 V. That would be a perfect voltage follower, the output voltage being exactly equal to theinput voltage.

Figure 7: op-amp voltage follower circuit for nodal analysis.

5

Page 6: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

2.7 Analysis of a Voltage Follower with the Ideal Model

Now lets repeat the same analysis with the ideal op-amp model of Figure 8. The ideal model assumesinfinite input resistance (Rin = ∞) and infinite gain (A = ∞), which implies that the input current tothe op-amp is zero at both terminals. If the input current to the V+ terminal is zero the current throughthe 300 Ω resistor must also be zero, which implies a zero voltage drop across the resistor and thereforewe must have V2 = V+ = 3 V. Since V+ and V− are connected via an infinite input resistance, we musthave V− = V+ = 3 V. The ideal op-amp drives Vout to whatever value is necessary to maintain V− at 3 V,therefore we must have Vout = 3 V, since node 3 is directly connected to V−. Thus, the ideal model impliesa perfect voltage follower.

Figure 8: op-amp voltage follower with ideal op-amp model.

At this point you know everything you need to know to begin analyzing general op-amp circuits. Theremainder of the lab will consider each component necessary to build an analog, op-amp based PID con-troller and then finally combine them together to construct the PID.

3 LabView Files

Each of the following sections is dedicated to the analysis of a particular circuit. You will analyze thecircuit analytically and then test the circuit experimentally using the ELVIS and LabView.

1. The necessary files can be found in T:\ME389 EE09

2. Use ME389 OpAmpLab Circuits.vi for analyzing each of the circuits.

3. Use ME389 OpAmpLab PID.vi for building and testing the PID controller.

6

Page 7: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

4 Individual Circuit Analysis and Testing

In this section we will analyze and test simple circuits for constructing addition, subtraction, inversion,derivative and integration with op-amps.

4.1 Circuit 1: Inverter

Figure 9 shows a signal inverter circuit.

Figure 9: Signal Inverter

Lab Work 1: Inverter Circuit Analysis

Use KCL to analyze the inverter circuit. Show that Vout can be expressed as

Vout = − Rf

RinVin. (6)

1. Use the ideal op-amp model to analyze the circuit

2. Determine the values of V+ and V−

3. Find an equation for the current iin

4. Find an equation for the current if

Note, that with the choice of Rin = Rf, the circuit represents a signal inverter.

Lab Work 2: Inverter Circuit Testing

1. Attach the prototyping board with inverter, addition and subtraction circuits

2. Open ME389 OpAmpLab Circuits.vi, and use the tab Invertor to test the inverter cir-cuit.

7

Page 8: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

4.2 Circuit 2: Signal Addition (Summer)

Figure 10 shows a signal addition circuit, a summer.

Figure 10: Signal addition

Lab Work 3: Summer Circuit Analysis

1. Let i1, i2, and if be the currents through resistors R1, R2 and Rf , respectively.

2. Use the ideal model to analyze the circuit, i.e. find an expression for Vout in terms of V1, V2, R1,R2, and Rf .

3. How would you select Rf , R1 and R2 such that

Vout = −(V1 + V2)? (7)

Lab Work 4: Summer Circuit Testing

1. Attach the prototyping board with inverter, addition and subtraction circuits

2. Open ME389 OpAmpLab Circuits.vi, and use the tab Signal Addition to test thesummer circuit.

8

Page 9: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

4.3 Circuit 3: Signal Subtraction

Figure 11: Signal Subtraction

Lab Work 5: Subtraction Circuit Analysis

1. Let i1, i2, be the currents across the resistors labeled R1. Let if be the current through resistor Rf ,and let i3 be the current through resistor R2.

2. Use the ideal model to analyze the circuit, i.e. find an expression for Vout in terms of V1, V2, R1,R2, and Rf .

3. How would you select Rf , R1 and R2 such that

Vout = V2 − V1? (8)

Lab Work 6: Subtraction Circuit Testing

1. Attach the prototyping board with inverter, addition and subtraction circuits

2. Open ME389 OpAmpLab Circuits.vi, and use the tab Signal Subtraction to testthe subtraction circuit.

9

Page 10: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

(a) Ideal derivative (b) Practical derivative

Figure 12: Derivative circuit.

4.4 Circuit 4: Derivative

The pure derivative circuit and an approximate, more practical derivative circuit are shown in Figure 4.4.Use the ideal op-amp model to analyze each of the circuits.

Lab Work 7: Pure Derivative Circuit Analysis

1. For the pure derivative circuit, let iin and if be the currents across capacitor Cin and resistor Rf ,respectively.

2. Sketch the bode plot of the pure derivative circuit in terms of Cin and Rf .

Lab Work 8: Practical Derivative Circuit Analysis

1. For the practical derivative circuit, let iin and if be the currents across capacitor Cin and resistorRf , respectively.

2. Sketch the bode plot of the pure derivative circuit in terms of Cin, Cf, and Rf .

Lab Work 9: Derivative Circuit Testing

Use the VI d

1.

10

Page 11: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

(a) Ideal integrator (b) Practical integrator

Figure 13: Integrator circuit.

4.5 Circuit 5: Integrator

Lab Work 10: Pure Integrator Circuit Analysis

1. For the pure integrator circuit, let iin and if be the currents across resistor Rin and capacitor Cf ,respectively.

2. Use the ideal op-amp model to find a relation for the output voltage Vout in terms of the inputvoltage Vin and Rin and Cf .

3. Sketch the bode plot of the pure derivative circuit in terms of Cin and Rf .

Lab Work 11: Practical Integrator Circuit Analysis

1. For the practical integrator circuit, let iin and if be the currents across resistor Rin and capacitorCf , respectively.

2. Use the ideal op-amp model to find a relation for the output voltage Vout in terms of the inputvoltage Vin and Rin and Cf .

3. Sketch the bode plot of the pure derivative circuit in terms of Cin and Rf .

Lab Work 12: Integrator Circuit Testing

Use the VI d

1.

11

Page 12: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

5 Circuit 6: PID

5.1 Pre Lab: PID Analysis

5.2 In Lab: Integrator Testing

Figure 14: Analog PID schematic.

12

Page 13: OPA01: Op-Amp Based Control Synthesisinconsy/lab/css/ME389/... · circuits, for example a PID controller. The op-amp symbol is shown in Figure 1. The high supply and low supply are

A 741 Op-Amp Schematic

Figure 15: The 741 op-amp configuration.

B Resistor Code

Example: A resistor with color bars Brown Black Yellow Gold, which is used often in this lab would be100 kΩ.

Figure 16: Standard resistor color code.

13