32
M. Horowitz, J. Plummer, R. Howe 1 E40M Op Amps

16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

Embed Size (px)

Citation preview

Page 1: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 1

E40M

Op Amps

Page 2: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 2

Reading

A&L: Chapter 15, pp. 863-866.

Reader, Chapter 8

• Noninverting Amp– http://www.electronics-tutorials.ws/opamp/opamp_3.html

• Inverting Amp– http://www.electronics-tutorials.ws/opamp/opamp_2.html

• Summing Amp– http://www.electronics-tutorials.ws/opamp/opamp_4.html

Page 3: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 3

How to Measure Small Voltages?

• Arduino input has full-scale around 5V– It produces a 10 bit answer (1024)– This means a LSB (least significant bit) is 5mV

• Need to make the signal bigger before input to Arduino– So, we will use an amplifier

• Many ways to build amplifiers– One often uses a standard building block for amplifiers

• Called an Operational Amplifier, or Op-Amp• A circuit with very high gain at low frequencies (< 10 kHz)

Page 4: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 4

Electrical Picture

• Signal amplitude ≈ 1 mV

• Noise level will be significant

• will need to amplify and filter

• We’ll use filtering ideas from the last two lectures

Page 5: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 5

OP AMPS

Page 6: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 6

Op Amp

• Is a common building block– It is a high-gain amplifier

• Output voltage isA (V+ ⎯ V-)Gain, A, is 10 K to 1 M

• Output voltage can be + or –– Often can swing between

+Vdd and -Vdd supplies– Huh?

LM741

Page 7: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 7

Op-Amp Power Supply

• Up to now we had one supply voltage, Vdd– All voltages were between Vdd and Gnd– Generally measured relative to Gnd

• So all voltages were positive.

• A sinewave goes positive and negative– And most input signals do that too

• It is convenient to have a reference where– The output can be positive and negative– Can do that by changing what we call the reference

Page 8: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 8

Moving the Reference

+

-+

-

vout

Vdd = 5 V

2.5 V

+

--

+-

+-

vout

Vdd = 2.5 V

The voltages are all the same, only the reference voltage has moved

Page 9: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 9

What You Will Actually Do

• Use the USB supply– Just change the reference voltage

+

-5 V +

-

R

R

Page 10: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 10

Op Amp Behavior

• Relationship between output voltage and input voltage:

A is the op-amp gain (or open-loop gain), and is huge 10K-1M

• The input currents are very, very smallso ip ≈ 0 and in ≈ 0.

vo = A v+ − v−( ) = A vp − vn( )

Page 11: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 11

Since the Output Swing is Limited

• The high gain only exists for a small range of input voltages– If the input difference is too large, the output “saturates”

• Goes to the max positive or negative value possible• Close to supply voltages

Page 12: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 12

What Does This Do?

+

-vin +

-

2.5 V+-

+

-

voutVcc = 5 V

vout

1

2

3

1 2 3

4

5

4 5

Page 13: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 13

Same Circuit Different Reference

+

-vin +

-

2.5 V+-

+

-

vout

Vdd = 2.5 V vout

-2

-1

0

-2 -1 0

1

2

1 2

Page 14: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 14

How To Get A Useful Amplifier

• The gain of the op amp is too high to make a useful amplifier– We need to do something to make it useful

• We will use analog feedback to fix this problem– Feedback makes the input the error between the value of the

output, and the value you want the output to have.

• Let’s see how to do this

Page 15: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 15

Connect Vout to Vin-

+

-vin +

- +

-

vout

Vcc = 5 V

-Vcc = -5 V

vout = A(V+ −V−) = A(vin − vout)

∴ A +1( )vout = Avin

∴vout =AA +1( )

vin ≅ vin

Page 16: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 16

What Is Going On

• We solved the equation to find the answer– But how does the op-amp get this answer?

• Think about what happens when the input increases in voltage– From 0 V to 0.1 V– Initially the output can’t change

• There is capacitance at every node– The op-amp thinks it needs to create a huge output voltage

• So it drives current into the output• Which charges the capacitor• Causing the output to increase

– This then decreases the input difference

Page 17: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 17

Feedback in an Op-amp Circuit

• As the output rises– The input difference decreases– So A* DVin also decreases

• The system is stable when– A* DVin is exactly equal to Vout

• If A is large (106) for any Vout

– Say in the range of ± 10V– Dvin will be very, very small– Can approximate that by saying Dvin will be driven to 0– Output will be set so vin+ ≈ vin−

Page 18: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 18

BUT

• This is only true if you connect the output feedback– To the negative terminal of the amplifier

• What happens if you connect it to the positive terminal?

Page 19: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 19

Ideal Op Amps

No current into op-amp inputs

No voltage difference betweenop-amp input terminals

The Two Golden Rules for circuits with ideal op-amps*

* when used in negative feedback amplifiers

1.

2.

Page 20: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 20

USEFUL OP AMPS CIRCUITS

Page 21: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 21

Approach To Solve All Op-amp Circuits

• First check to make sure the feedback is negative– If not, STOP!

• Find the output voltage that makes the input difference 0

– Assume V+ = V-

– Find Vout such that KCL holds

• We’ll do some examples

E40M Lecture 19

Page 22: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 22

Non-inverting Amplifier

• ip = 0 so vp = vs

• V+ = V- so vn = vp = vs

i1

i2

i1 = i2 so vo − vs

R1=

vsR2

∴voR1

= vs1R1

+1R2

⎝⎜⎜

⎠⎟⎟

∴vo = vsR1+R2R2

⎝⎜⎜

⎠⎟⎟

Page 23: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 23

Inverting Amplifier

At node vn

vn − vsRs

+vn − voRf

+ in = 0

But vn =vp = 0 and in = 0, so

−vsRs

−voRf

= 0 or vo = −vsRfRs

Page 24: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 24

Current-to-Voltage Converter

KCL at the vn node:

i2

i1

iR

• ip = in = 0

• vn = vp = 0

• So iR = 0 as well

i1 = is = i2 = −voRf

so vo = −isRf

Page 25: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 25

OP AMP FILTERS

Page 26: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 26

Adding Capacitors

Sinusoidal voltage

Cf • Suppose we add a capacitor in the feedback

• We can treat this exactly as we did the earlier circuits by using impedances.

• Our earlier analysis showed

vo = −vsRfRs

Zs =Rs Zf =1

1Rf

+ j∗2πFCf

∴vo = −vsZfZs

= −

11Rf

+ j∗2πFCf

Rs= −vs

RfRs

11+ j∗2πFRfCf

⎝⎜⎜

⎠⎟⎟

Page 27: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 27

Sketching the Bode Plot

F [Hz]

20 log10 |Vo/Vs|

Rs = 1 kΩ, Rf = 100 kΩ, Cf = 160 nF

vovs

−RfRs

11+ j∗2πFRfCf

⎝⎜⎜

⎠⎟⎟

Vo

Vs= ⎯

Fc = 1/(2pRfCf) = 10 Hz

0.1 1 10 100 103 104 105

20

40

60

0

-20

Page 28: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 28

Learning Objectives

• Understand how living things use electricity

• Understand what an op amp is:– The inputs take no current– The output is 106 times larger than the difference in input

voltages

• The two Golden Rules of op amps in negative feedback– Input currents are 0; Vin- = Vin+

• Be able to use feedback to control the gain of the op amp– For inverting and non-inverting amplifiers

• Understand op amp filters and differential amplifiers

Page 29: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 29

More Examples

Page 30: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 30

Summing Amplifier

Output voltage is a scaled sum of the input voltages:

i2

i1 i3

i1+ i2 = i3 so v1R1

+v2R2

= −voR

KCL at the summing point (or summing node):

vo = −RfR1v1+

RfR2v2

⎝⎜⎜

⎠⎟⎟

• ip = in = 0

• vn = vp = 0

Page 31: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 31

A Subtracting (Difference) Amplifier?

• Take an inverting amplifier and put a 2nd voltage on the other input?

• Not quite what we wanted. We’d like vo a (v1 – v2).

v2

v1

i1+ i2 = 0 so vn − v1

Rs+

vn − voRf

= 0

vn = v2 so v2 − v1

Rs=

vo − v2Rf

∴voRf

=v2 − v1Rs

+v2Rf

∴vo = −v1RfRs

+ v2Rf +RsRs

Page 32: 16. Op Amps - Stanford University · No current into op-amp inputs No voltage difference between op-amp input terminals The Two Golden Rulesfor circuits with ideal op-amps*

M. Horowitz, J. Plummer, R. Howe 32

Differential Amplifier 1.0

v1− vnR1

=vn − voR2

v1− v2R4

R3 +R4R1

=

v2R4

R3 +R4− vo

R2

∴voR2

= −v1R1

+v2R1

R4R3 +R4

+R1R2

R4R3 +R4

⎝⎜⎜

⎠⎟⎟

But if R3 = R1 and R4 = R2

vo = v2 − v1( )R2R1