Op Amp Basics op amp = operational amplifier Prepared by Scott Robertson Fall 2007 Diefenderfer and Holton (D&H), Ch. 9 Horowitz and Hill (H&H), Ch. 4,5,6,7 1 What are they good for? • • • • • Amplifiers: sum and difference of voltages Differentiators Integrators Buffers or follower (cable drivers) Filters: high pass, low pass, bandpass, band reject, notch • Comparators • Limitations of op amps (nonideal behavior) • Oscillators (another lecture) 2 1 Theorists view: 3 pins: Experimentalists view: 7 pins + ground: V+ Inverting input VA VB VA − Vout + VB Non-inverting input Positive power supply Offset adjust (optional) − Vout + V− Negative power supply Ground is sometimes not connected to the op amp. Vout = Gain × (VB – VA) Vout from Golden Rules 3 Manufacturer’s views Notch The socket also has a notch at pin 1 so you don’t put the op amp in backwards. Dual-in-line (DIP) Package 4 2 What’s inside? National’s LF356 5 “Bypass” the impedance of the power supply wires using small capacitors V+ 0.01 μF, >15 V To power supply VA VB To power supply Failure to do this can cause oscillation and “cross talk” between circuits because the power supply voltage will otherwise vary when the load varies. A screwdriver-adjust potentiometer is used for “one time” offset adjustment − Vout + Small disc ceramic capacitors are used for “bypass.” They MUST be located near (a few cm) to the chip and attached to a “good” ground. V− 6 3 Characteristics of the ideal op amp 1. Input impedance is infinite inputs draw no current 2. Gain G is infinite in the math, terms with 1/G → 0 3. Negative feedback determines the function performed Negative feedback is a connection from the output to the inverting input 4. Output impedance is zero 7 From D & H ch 9-1 Inverting x1 amplifier (G not ∞) VB = 0 Negative feedback thus Vout = G × (0 − VA ) R (1) I1 = I 2 Vin R I2 VA − I1 + VB Vout Vin − VA VA − Vout = R R Vout = − Vin + 2 VA (2) 2 equations, 2 unknowns Vout = − Vin − 2 VGout ⎯G⎯ ⎯→ − Vin →∞ VB − VA = Vout G ; VA ⎯G⎯ ⎯→ VB →∞ 8 4 Golden rules of ideal op amps 1. The output does what is necessary to make VB = VA. 2. The inputs draw no current. With these rules, knowledge of G is not needed as long as G>>1. Reference: H&H 4.03 9 Inverting amplifier from Golden Rules Golden rules : R2 Vin R1 I1 = I2 I2 VA − I1 + VB Vout and VB = VA = 0 Vin − 0 0 − Vout = R1 R2 1 equation, 1 unknown Vout = − R2 Vin R1 X10 inverting amplifier if R2 = 100KΩ and R1 = 10 kΩ. 10 5 Summing amplifier R R,R,R V1 V2 V3 VA − Vout + VB VA = 0 Vout = -(V1 + V2 + V3) “intuitively obvious” 11 Current to voltage converter or electrometer R I1 -I1 VA → Ileak Vout = −I1 R + Voffset - + Vout VB Used to measure small currents. Offset error: Voffset = -Ileak R, where Ileak is the nonideal input offset current (also called Ibias). 12 6 Non-inverting amplifier with gain >1 Vin = VA R2 R1 Feedback is simple voltage divider : ⎛ R1 ⎞ ⎟⎟ VA = Vout ⎜⎜ ⎝ R1 + R2 ⎠ I2 VA − I1 Vin + (Golden rule) Vout VB ⎛ R + R2 ⎞ ⎟⎟ Vout = Vin ⎜⎜ 1 ⎝ R1 ⎠ Vout R = 1+ 2 Vin R1 Answer is NOT R2/R1. Can’t make a x1 or x0.5 amplifier this way! 13 Non-inverting amplifier with gain = 1 or <1 VA VA − Vin VB + − Vin Vout + Vout VB x1 amplifier is a buffer or follower It is used to drive long lengths of cable, otherwise signal is decreased. Volume control, gain <1 High current buffer amplifiers with no “-B” input are available. BUF634 can put out 250 mA ! 14 7 Difference or “B-A” amplifier R2 R1 VA − V1 V2 + Vout = ( V2 − V1 ) Vout VB R1 R2 R1 R2 Gain can be 1, >1 or <1. The mathematical analysis is in D&H, ch. 9-5, (3 eqns., 2 unknowns) 15 Differentiator from Golden Rules R Vin C Golden rules : I1 = I2 I2 VA + − Vout d or Vin = dt R 1 equation, 1 unknown Vout VB Here is what it will do to a square pulse: VB = VA = 0 C − I1 and Vout = −RC − Vout d Vin = dt RC d Vin dt Vin The derivative of a step fcn. is a delta fcn. Vout What determines the width of the delta fcn. in this case? What determines the height? 16 oscilloscope 8 Simple integrator is “ruined” by nonideal Ibias Golden rules : I1 = I2 and VB = VA = 0 Vin d − Ileak = −C Vout R dt 1 equation, 1 unknown C Vin R I2 VA t → Ileak I1 Vout + Vout = − I V d Vout = − in + leak RC C dt or t 1 1 Vin dt ′ − ∫ Ileak dt ′ + Vout (t = 0) 14243 RC ∫0 C0 constant of 14243 integration →∞ VB Eventually, the capacitor is charged to the supply voltage by the leakage current and integration stops. Ileak is the tiny input current to terminal VA, often ignored. Ileak is also called Ibias. 17 Practical op amp integrator with extra resistor R2 tends to discharge C Vin R1 VA I1 R2 Golden rules : I1 = I2 C V Vin d = −C Vout − out R1 dt R2 VB = VA = 0 and or V V d Vout = − in − out dt R 1C R 2 C I2 → Ileak + t Vout = − Vout VB t 1 1 Vin dt ′ − Vout dt ′ ∫ R 1C 0 R C ∫0 124 4244 3 error term error term is small if t Ileak is the tiny input current to terminal VA, often ignored. 1 Vout dt ′ R 2 C ∫0 t << 1 or << 1 Vout R 2C so make R 2 big. The cost of this is : Voffset = −Ileak R 2 18 9 Error of practical integrator is “droop” Vin Input signal Vout True integral Output of practical integrator “droops” with time constant R2C Not significant if R2C >> t t’ → t oscilloscope 19 The comparator a special kind of op amp 20 10 Comparator output is either high (V+) or low (V-) V+ VA Vref − Vout + VB Vtest Vtest > Vref Vout is V+ Vtest < Vref Vout is V- Op amps designed to be comparators are not damaged if VA ≠ VB. 21 Comparator as temperature controller V+ “Thermostat” Colder RT V+ R Vref − Hotter Buffer + Vout Heater Vtest R R Note that V- can be ground. Thermistor RT is heated and gets more resistive, driving Vtest down below Vref, and the heater turns off until the comparator changes state again. 22 11 Some comparators only “sink” current the output is an “open collector” V+ LF311 V+ Vref VA Rload − Vout + Vtest VB Wait a bit and we will talk about transistors and what this means. 23 Schmitt trigger Definition: A comparator that goes high at a higher reference voltage than the reference voltage for going low. If off, and then Vtest > Vref - ΔV then output goes high (furnace turns on at 68 F) If on, and then Vtest < Vref + ΔV then output goes low (furnace turns off at 70 F) Why do this? So that your furnace (for example) will stay on until the house heats up a few degrees, then turn off. The furnace should run 5 minutes per hour rather than 5 seconds per minute. ΔV determines how much the parameter being controlled is allowed to vary. 24 12 Comparator made into Schmitt trigger V+ V+ 100 RT RT ≅ R R RT Vref − “thermostat” Buffer + R R Vout Heater Vtest Positive feedback (100RT) raises Vtest relative to Vref when the heater is on, which has the same effect as lowering Vref (by about 1% in this case). This circuit provides control to order 1%. 25 Schmitt trigger for digital logic prevents noise from changing the output Noisy signal Vref+ΔV Vref – ΔV Vin Special symbol For Schmitt trigger Clean output Vout Ordinary comparator Vout time → Noisy output 26 13 Comparator made into time delay V+ Vref VA − + Vin Vout VB R C Input pulse (solid) Vref C voltage (dotted) Vin Delayed output pulse Delay is of order RC Vout 27 time → Filters 28 14 Filters are for 1. removal of noise 2. selecting a feature (radio station?) Low pass High pass Vout Vin Vout Vin f Vout Vin Bandpass, Band reject f f Q ≅ f / Δf Quality factor 29 Unsophisticated low pass filter (3db per octave) Z2 = [(R2)-1+jC2ω]−1 C2 R2 VA Vin − Z1= R1 Vout + VB Replace R by Z in op amp circuit analysis Vout = − R2 Z Vin becomes Vout = − 2 Vin R1 Z1 ⎛ 1 ⎞ + jC 2ω ⎟⎟ Let : Z 2 = ⎜⎜ ⎝ R2 ⎠ ⎛R Vout = −⎜⎜ 2 Vin ⎝ R1 −1 and Z1 = R1 ⎞ 1 ⎟⎟ 1 + jR 2 Cω ⎠ Vout/Vin Compare to simple RC : Vin Vout Vout 1 = Vin 1 + jRCω f 30 15 Unsophisticated high pass filter R2 Vin R1 C Vout = − Let : Z 2 = R1 + 1 / jCω and Z 2 = R2 I2 VA ⎛ ⎞ − jR2Cω ⎞ Vout R2 R ⎛ 1 ⎟⎟ = ⎟⎟ = −⎜⎜ = − 2 ⎜⎜ + + + Vin R jC jR C R jR C 1 / ω 1 ω 1 1 / ω ⎝ 1 ⎠ ⎠ 1 1 ⎝ 1 − I1 Z2 Vin Z1 + VB Compare to simple RC : Vout R jRCω 1 = = = Vin R + 1 / jCω 1 + jRCω 1 + 1 / jRCω Vin Vout/Vin 31 f Sophisticated filters • You can easily get 6 db per octave with 1 op amp, 2 Rs and 2 Cs, so don’t settle for 3 db per octave (previous slides). • It is standard practice to copy the filter design from a book. • There are “too many” filter designs Butterworth, Bessel, Chebyshev, etc. Some designs are flatter near the cutoff. • See textbooks for examples f 32 16 Typical 6 db per octave filter 4 Rs, 2 Cs C R R − C + R See H&H, Fig. 5-16. R 33 Twin – T notch reject filter Vin Vout/Vin 90 degree phase delay at f0 C,C R,R 2C 90 degree phase advance at f0 Vout R/2 f0 f At frequency f0, currents from the two sides of the circuit are 180 degrees out of phase and cancel at location Vout . 34 17 Non ideal op amps • There is a nonzero input current (20 pA?) • Op amp can’t put out more volts than V+ or V• The output current is limited (usually it can’t drive a long 50 ohm cable) 5 V / 50 Ω = 100 mA = too much • The frequency response is limited (pay more $ above 1 MHz) 35 Input current is not zero LF156 family And it increases with temperature strongly! 36 18 Output impedance LF156 family Output impedance is higher at higher frequencies and higher gains Av. Don’t ask for more than about 15 mA from this chip. This chip cannot put 1 V onto 50 ohms! 37 Op amp frequency response An expression for the gain G valid at all frequencies is: G (ω ) = G (ω ) = G0 G0 = 1 + j (ω ω0 ) 1 + j ( f f 0 ) G0 1 + j (ω / ω0 ) Open loop gain G(ω) is less at high frequencies. f0 and ω0 are 3 db points of op amp. Open loop gain-bandwidth product (~5 MHz) is a constant at the higher frequencies. G (ω ) × ω ≅ G0ω0 ω >> ω0 38 19 Using gain bandwidth product Suppose the gain-bandwidth product G(ω)ω = 5 MHz. Then I can have a gain of 5 at 1 MHz. Or a gain of 1 at 5 MHz. Or a gain of 50 at 100 kHz, etc. This helps you SELECT the proper op amp for the job. 39 Op amp frequency response with feedback Open loop response Closed (feedback) loop response for 30 db gain If the feedback sets the gain at 30 db, then the frequency response of the circuit is flat to 100 kHz for this chip. 40 20 The op amp has internal noise 1/f (one-over-f) noise below ~100 Hz (varies) Ordinary noise (independent of f) Noise is covered later in PHYS3330. Please wait a while to find out what √Hz is all about. 41 21