Methods of Experimental Physics Semester 1 2005 Lecture 7: Filtering and Operational Amplifiers i 1 : v ! E r A1E € ,' ' - - - . = _ z gj . =- ; -= | Lt =i - ii=-lzs{;gg' i==-:-!FE;;3S i:=-i=i*:EEa ==:;=!5:dE i:tj:i:Igsi 1 5i E ;'Z Z ::E. * E ' 1=z. :=* a '=<acE=:-F';' = i' - al a= !r : =5i -: :=. E - t . ! _ n . g ! - F a S ) = - = == € e e at 'E:.tiii:;E . = Z = . ; P = 9 E p, = == i = =- == r= -= = = = : ! . ; i J = : 9 Y ? 'E= Z1= tir;;:;5=^ E = . :=' i i | l \ i = : : Introduction ' - g ; - ! j _ ' : ^ ' ;' i= = S 75 ; 3 j =a = -: ;: F I' :i : 1 . a : E € ; E = a l 2 € . 6 . F: ;7_'?=5EEfi: 7.1 - H Passive Filters : 5 9 1 - g - - 7.2 ' It is often the case that some added noise is unavoidable despite the best efforts of the experimental design. In order to mitigate its effect it is often desirable to include some filtering in the electronic parts of the apparatus - this might be e.g. for the purpose of eliminating interference from AC line power, or for limiting the bandwidth of the apparatus to limit the amount of noise while leaving the signal alone. This of course, is only possible if the signal frequencies differ from the noise frequencies. In this lecture we will look at various filtering strategies. This naturally leads to active filters making use of operational amplifiers. We will study the ideal amplifier and how to construct a filter from such an amplifier. Finally, we will consider a sensible noise model for an amplifier. I q C) o + F s \o 0 IL O i N l - I r \ *l a v ! i i ?. , r) ln N J + , l ,l Y , + J l oo Tr rl! v + n - rr f rrr Q ! -l.il + -l!U i : . d) S l ^ rN r-ri Figure 1: A collection of passive first-order filter circuits The filters shown in Figure 1 and the transfer functions of these filters (Figure 2) show some typical first and second order filters and transfer functions built from passive components. The peaked response seen in the second order filters are characteristic of a resonance (energy storage ability). 7-1 Lecture 7: Filtering and Operational Amplifiers 7-2 filterxfer.nb 1 filterxfer.nb 1 100 100 10 10 1 1 0.1 0.1 0.01 0.01 0.1 1 10 100 0.01 0.01 0.001 0.001 0.0001 0.0001 0.1 1 10 Figure 2: Low pass and High Pass filters. The peaked response is for the LC devices (second order) while the smooth functions are for the RC or LR based filters You have learnt about these before so I refer you back to the second year course if you want to know more about it - this is merely a reminder. I note though that these are very useful for getting rid of interference or limiting the bandwidth of circuits that you might build i.e. it is a good way of maximizing your signal to noise. For example, Figure 3 shows you a passive filter network for blocking (band-reject) 60 Hz signals (often found in the USA). What would you need to do to make it work for the 50 Hz signals we see in Australia? oo qi bo va J ro ro gi ifleg Fti:Ft€ E E # g E:pf , e : ; i ; En = = €; aai;t;fi E E . is; rF€: b? t :a[ :*::rF:=.r;: sg s : Bi€Ei: !Ei.$ii ! ae * sEE:i€ iiE!Bi ;f,FSFE*?I682?rI:: E : !i l ; ; €! P i i €; i i E E e: E " n : F E ! * ; e = z E i I t ; ; g f , g I g i E €i i atEEFEE?$ fEie;i : i : g ; ; # E H e i s €E ! : i*eiiitliiE:iiii -ll9u t>7.3 Figure 3: 60Hz band-reject filter Introduction to Operational Amplifiers (Op-Amp) Operational amplifiers are the most remarkably useful electronic devices that can allow you to achieve things easily that were previously extremely difficult using transistors etc. Please see your previous course lecture notes (and appropriate books ) for details - I’ll give only the the most cursory introduction together with the salient facts that I am interested in. I would also recommend http://www.allaboutcircuits.com/ if you are interested. Chapter 8 in Volume III covers op-amps. [;; N c.) 8 lc ^ e - ! ! ( g p )u o r t e n u a u v To start with lets imagine an ideal op-amp (see Figure 4). Lets make some points about the way it works and also about some things that are perhaps not so obvious. An ideal amplifier takes the two voltages at its input, V+ and V− , and amplifies their difference by a large factor, Vo = A(V+ − V− ), where A is called the open loop gain of the amplifier. The open loop gain of a typical amplifier is around 106 or greater. V+ is called the non-inverting input, while V− is the inverting input. Since the output voltage of the op-amp is larger than the input voltages it is clear that there needs to be some other energy input to the device to satisfy energy conservation. Power is supplied by two other pins (Vs± ) to meet this requirement. Most op-amps use symmetrical supplies i.e. ±7 V or ±15 V although there are also many op-amps that will run of a single positive supply, or from unsymmetric supplies for various applications. 100 = = r r > * a = u- ; ! = :a I Lecture 7: Filtering and Operational Amplifiers 7-3 Vs+ V+ + V- - VO Vs- Figure 4: A simple Op-Amp. VS± are the supply voltages, V± are the input voltages, and Vo is the output voltage It is not usual to show these power supply pins on diagrams, except if the power supplies are unusual, or if we are giving an explicit circuit diagram. Perhaps surprisingly, it is rare for an op-amp to have a pin which supplies the 0 V reference. The op-amp figures this out from the midpoint of the power supplies (i.e. if the input voltages are equal then the output voltage will be at the mean of the two power supplies). We normally refer all input and output voltages to this 0 V reference and so one should never forget that it is really hanging around...even if it is not explicitly shown on the diagram. If one examines Figure 5 you can see that the ground in the power supply plays a key role in the way current flows in the circuit. In this model of an op-amp it is assumed to be a voltage source with an output voltage proportional to the voltage difference between the input pins. The use of a variable potentiometer implies the way the device handles currents in relations to its power supply pins. I note also that one almost inevitably runs an operational amplifier with feedback resistors (as you will see in the next section and as shown in Figure 5) and these dominate the op-amp’s behaviour so that it behaves correctly even if the power supplies are moving around or are unsymmetric. Figure 5: Showing the complete current flow paths in an op-amp: from www.allaboutcircuits.com 7.3.1 How does one figure out an op-amp circuit Lets refer first to Figure 6 which shows a very simple op-amp circuit. There are four assumptions usually made in the first instance to figure out the solution to the circuit. 1. That the open loop gain of the op-amp is essentially infinite 2. That the input impedance of the op-amp is infinite (i.e. no current can enter into the input Lecture 7: Filtering and Operational Amplifiers 7-4 R2 Vin R1 I1 + I2 Vout Figure 6: A simple Op-Amp. VS± are the supply voltages, V± are the input voltages, and Vo is the output voltage terminals) 3. That since the gain is infinite the only stable solution requires that the voltages at the two inputs are identical 4. That the output impedance is zero So using rule (3): the voltage on both terminals is the same. Since we grounded V+ this means that both are at zero potential. Thus we can calculate I1 = (V1 − 0)/R1 and I2 = (0 − Vo )/R2 . Now using rule (2): the input impedance is infinite means that the two currents must be equal. So equating these equations we obtain: R2 Vo = −V1 R1 Thus the transfer function of the operational amplifier is R2 /R1 . If we generalize that the impedances in the feedback path and the input path are allowed to have both real and imaginary components it is still true that at each frequency the output voltage is related to the input frequency by: Vo (f ) = −V1 (f ) Z2 (f ) Z1 (f ) (1) As flagged in that previous sentence this is an example of feedback. In a latter lecture we will re-examine feedback in relation to control, and will understand perhaps a little more about op-amps. You’ll find some useful op-amp circuits below (together with their transfer functions) from the National Semiconductor AN-31 Application Note (Figure 8). I’ll leave it to you to calculate the transfer functions of these devices. 7.3.2 Active Filters We can use op-amps to make active filters. This can be done following two different philosophies. Either we can use op-amps to isolate passive components (using the op-amps as buffers, or impedance transformers) that do the filtering (see Figure 9a), or we can make use of the op-amp itself to be the filter (see Figure 9b for an example). See if you can figure out the transfer function of Figure 9b! Generally speaking (as I am guessing you already know) we can make use of the response of an op-amp with a circuit around it to act as a low-pass or high pass filter, or to do the much more complex operations shown in Figure 9b. For example, I said before in Eq. 1, the transfer function of an op-amp with a −Z2 (f )/Z1 (f ) where Z2 is the impedance in the feedback path and Z1 is the impedance at the input. Thus if we place paralleled resistor and capacitor in the feedback path and a simple resistor in the input, we can create a low pass filter with integral gain. This is a potentially useful signal enhancement tool. 7.4 Amplifier Realities Application Note 31 September 2002 Note: National Semiconductor recommends replacing 2N2920 and 2N3728 matched pairs with LM394 in all application Lecture 7: Filtering and Operational Amplifiers circuits. Section 1—Basic Circuits Inverting Amplifier Non-Inverting Amplifier p Amp Circuit Collection Op Amp Circuit Collection 7-5 00705702 00705701 Difference Amplifier Inverting Summing Amplifier 00705703 00705704 R5 = R1//R2//R3//R4 For minimum offset error due to input bias current For minimum offset error due to input bias current Figure 7: Circuits from the National Semiconductor Applications Note AN-31 (this section taken from Horowitz et al and other places) As already mentioned earlier op-amps are not perfect. In this section we will consider some of their non-idealities in more detail. An ideal amplifier has AN-31 1. Input impedance (either differential or common mode) = infinity 2. Output impedance (open loop) = 0 3. Voltage gain = infinity © 2002 National Semiconductor Corporation AN007057 www.national.com 4. Common-mode voltage gain = 0 5. Vout = 0 when ∆Vin = 0 i.e. zero offset error 6. Output can change instantaneously (infinite slew rate) All of these characteristics are presumed (incorrectly) to be independent of temperature, supply voltage changes, output current and input frequency. Below we will address the truth as well as considering noise in the op-amp. Our assumption stated in point (5) above tells us (once again incorrectly) that noise must be zero (otherwise the output is behaving independently of the input). Many of these real effects are alleviated by running the op-amp in the negative feedback condition. We will note this when this is the case in each of the sections below. This is another good reason to use negative feedback. 7.4.1 Input bias current Real op-amp inputs either draw or source a small current called the bias current, IB , which is defined as half the total input current when the two inputs are connected. The two input currents are usually approximately the same. Bias currents in cheap devices are around a few hundred nA, while a good bi-polar input op-amp will be around 1-2nA. A FET input op-amp has a bias current of around a few pA. The annoyance associated with this is that it causes voltage drops and errors in your op-amp input network. This means that the input resistors need to be relatively small if you want small input errors. Lecture 7: Filtering and Operational Amplifiers AN-31 Section 1—Basic Circuits 7-6 (Continued) Practical Differentiator Integrator 00705709 00705710 For minimum offset error due to input bias current Fast Integrator Current to Voltage Converter 00705712 VOUT = lIN R1 *For minimum error due to bias current R2 = R1 00705711 Figure 8: More circuits from National Semiconductor Applications Note AN-31 7.4.2 Input offset current This is the term associated with the difference in the input currents between the two inputs. This results in a net error between the two input voltages even if the impedance presented to the op-amp is balanced 3 www.national.com in the two inputs. The offset current is typically a tenth of the input current. 7.4.3 Input impedance This usually refers to the differential input impedance (i.e. the impedance seen into one input with the other one grounded). The common-mode resistance is usually very much higher (this is also given in a typical spec sheet). For a bipolar input stage op-amp it will be around 2 MΩ. For a FET input op-amp it can be up to 1012 Ω. When one is operating the op-amp in a negative feedback arrangement it is usually the case that the voltages present at the two inputs are equal and thus this effect does not result in an error. In effect, it means that the input impedance is some very high value in this condition. 7.4.4 Common-mode input range The inputs to the op-amp should typically stay within some defined range which is less than the power supply range. If this range is exceeded then the behaviour of the op-amp is not defined and it can do some crazy stuff. For a typical op-amp for example, if we are running it from ±15 V range, then the input voltage should not exceed ±12 V. If you exceed the supply range itself then the op-amp will go bang. 7-7 ; ! .ll r €_ b - 'to b 3E The output voltage of a typical op-amp can usually only swing to within 1 V or so of the supply voltages. There are special op-amps that allow the output to swing all the way to either the positive or negative power supply (only to one or the other though). It is usually good practice to ensure that the input voltages do not exceed the supply voltages (if they do then the op-amp usually goes bang). ;r Output and Input voltage limits E*$ The output impedance of the op-amp is that exhibited by the op-amp without a feedback network. For a typical op-amp it is in the tens of ohms range, while for low-power op-amps it can rise to several kiloohms, and for high power op-amps it can be hundredths of an ohm. The presence of negative feedback effectively lowers the output impedance to a negligible level (the voltage at the output of the op-amp is forced to be the correct value in order to keep the operational amplifier operating properly), and thus the most important factor is usually the maximum output current. This ranges from a few mA up to 10A in some cases. 7.4.7 b Output impedance 'to 7.4.6 - 5 I is the gain for a change in the average of the input voltage levels. For a typical op-amp this is around 104 − 106 although it is normally expressed with a dB measure (i.e. CMRR is 80-120dB). For example, the precision OP-27 has a CMRR of 126 dB. ! o o V0 V+ −V− 2 ! 5 t ' o o bI) (2) where Adiff is the normal open loop gain for a differential voltage at the input and ACM = .ll F Sr:f gg ! I o y Adiff ACM 3E *E o ct.i€ ;E (b) a complex op-amp filter The output of the op-amp should only depend upon the difference in the input voltages not on the average voltage at the input. The Common-mode Rejection Ratio is given as CM RR = ; r €_ b f;>F s F; F f €; : d d; t ' o E*$ ;r F S r : f g g, 5f r fF; >;Fl s *FE E , 5 F ; l s F E 3 H E S E €t fr 3 H E S E €t s F; F f €; : E i;ia ..=ut ; c t . i € ; E = E,B;: o bI) - v +-->,-rf^>,E'.<!E hry-c< U 6 = r e 8 3 €f E { ' 8 f Ri eE i E E D h t r : _ t 9 , , = t r b o i ! . g i t 9 q :E a;frFeE-gd g = €H i s 3 : ' . E F a; :,sEi;lq:E E - u :, :E$a o A E : F : : €Y * =l E E c s i = ; q =9 o u s , EH 5 H Common-mode Rejection Ratio f As= E i;ia ..=ut F i i f €i F $ E s : '€t ' = i E e * tr o o =3g;HPo r 7.4.5 Figure 9: Some op-amp filters = E,B;: s 6 = r e 8 3 €f E s{ ' 8 fE i q ? s ' f r g g E H S - e 9 ; F : , U o 9 5 > . ' E €a F d * A €E ; E €s ' ) d ;a = 9E v -->,-rf^>,-E + E'.<!E hry-c< y Ri eE i E - i ! . g i t 9 q : E a ; f r F e E - :g d * =d g = €H i s 3 : ' . E a ; : , s E i ; l q : EF E U : '€t i E e ' = E - D h t r : _ t 9 , , = t r b oo i - o s E E u 5 IFaE 8:. :F. 06; ; : g - cS E ' E:E:. E E i q ? s ' f r g g:i€iE H= - e 9 ; F : , U o 9 5 > ;. € ' aF tF i + i i5 F E e €a F d * A €E ; E €s gE5+q;EEVi.ls q =9 o u $;*E ; s€€ II I st * g; €e$E: lFgrpcE s , EH 5 H E,i: :* =d :, :E$a o A E : F : : €Y =l E E c s i = ; $ : ;*; E T ; €. E $ E ; E € ii = IFaE 8:. :F. 0se g E3:r: 3*if - c5 ,t;! 6; ; : E ' E:E:. E :€ ; € aF tF i + i i5 FFEEf ,e:? Et Ii HI : ! EFgi ,i ;=liP€g[g ' ) d ;a = =3g;HPo E , i :g E 5 + q ; E E V i . l s 9E E € $ : ; ; E T ; €. E $ E ; tr o o se ,t;!E3:r: 3*if r I : F i , ; lP gg Ff, ?tI H E : E i ! Eg i = i € [ oi-o g; (a) Three op-amp filters: (a) output buffered, (b) input and output buffered, and (c) buffered in and out with some net gain As= $;*E F i i f f€i F $ E ; s€€ qAArll' -i_ - Lecture 7: Filtering and Operational Amplifiers Lecture 7: Filtering and Operational Amplifiers 7-8 complicated circuit.nb 1 1µF 100 50 20 5 3 10 Ω 10 Ω + 10 5 2 0.01 (a) simple op-amp filter 0.1 1 10 (b) transfer function of a simple op-amp filter Figure 10: Some op-amp filters 7.4.8 Voltage gain The open loop voltage gain, A, of a typical op-amp is around 105 -107 , not infinite. In addition the voltage gain is frequency dependent (A(f )). It is generally flat exhibiting a value as given above till some critical frequency around 102 -103 Hz. For higher frequencies, A(f ) starts to fall proportional to 1/f 2 (i.e. it is a simple 10dB/decade roll-off like a low pass filter) and it passes through a gain of 1 (called the unity gain frequency with symbol of fT ) at a frequency of 1-10 MHz for conventional op-amp. These days it is possible to have gain from a fast op-amp with a unity gain frequency of nearly 1 GHz. 7.4.9 Input offset voltage Op-amps rarely have perfect input stages and so if you connect the inputs together you typically see the output saturate at the positive or negative power supply. The difference in input voltages required to bring the op-amp output to zero is termed the input offset voltage, VOS . Most op-amps have extra inputs that allow you to trim up the input offset voltage to zero. Of great importance in any precision application is that the input offset voltage typically drifts with temperature and time. A typical op-amp has a couple of mV of input offset voltage. A precision op-amp (OP-27) has an offset of just 10 µV and a temperature coefficient of 0.2 µV/K, and a drift of 0.2 µV per month. 7.4.10 Amplifier Noise We had a short look at amplifier noise in the first lecture. Now lets take another look in more detail. A noise model of an amplifier is given in Figure 11a. The conventional method of characterising the noise of an op-amp is to place two fluctuating current sources at each of the inputs, as well a voltage noise source at one of the inputs. The voltage and current noise generators are generally thought of to be independent, however it is generally the case that the average direction of the two current noise generators is in the same direction (i.e. both in or out from the amplifier). The noise sources are frequency dependent with a 1/f type dependence from zero frequency up to around 100 Hz. Beyond this the magnitude is generally independent of frequency. The circuits shown in Figure 11b are intended to convey how the noise sources can be measured and this will tell us how the noise sources manifest themselves in a real circuit. Turning to the noise measurement for the voltage noise source we see that the voltage noise, en , is manifested in the negative terminal as well (because the voltages must be identical on the two terminals). These voltage fluctuations induce current fluctuations in R1 , and this must be matched by the current flowing in R2 , and hence necessary voltage fluctuations in the output. So we can write the output fluctations as e0 = en (1 + R2 /R1 ). One can equally solve the current noise source equations as well i.e. e0 = Zin− or e0 = Zin− with one of the switches closed. 100 Lecture 7: Filtering and Operational Amplifiers (a) simple op-amp noise model 7-9 (b) How to measure voltage and current noise Figure 11: Op-amp Noise models R2 R1 en in Vo (a) A noise model with input impedance as well as current and noise generators (b) A noise model including the rest of the circuits Figure 12: Op-Amp Noise models with input signals The sum of the noise sources appearing at the output of the amplifier set up as in Figure 12a (where both current and voltage noise are present) will be V0= en (1 + R2 /R1 ) + R2 in . One can refer this noise R1 to the input in which case one gets Vi = en R + 1 + in R1 . The relative noise contributions of the 2 current and voltage noise would be equal if: en R2 = 2 in 1+ R R1 (3) The ratio of en /in is called the characteristic noise impedance, or the noise matched impedance, or optimal noise impedance of the amplifier. If the effective input impedance exceeds this value then the the amplifier noise is dominated by current noise instead of voltage noise, else it is the other way around. As we will see in the next section, if one chooses the output impedance of the previous stage to match the input impedance of the amplifier then one achieves minimum noise. The typical voltage and current noise of some amplifiers as a function of frequency is given in Figure 13. Lecture 7: Filtering and Operational Amplifiers 7-10 I N , Y O E 6 o o o @ = C o I I f o c o o n r N .a c il $ E o @ L t - 1 r d ! T e " = 3 : = * a 4 ^ c ) : 9 : = 2 - = E ' i > > 2 .i9 0 f o > ^ d = 3 e E - i : 6 - _ U E E E o ' - C > = P 5 a 6 = : i : E ! = c . F _ = Figure 13: Some typical current and voltage noise spectral densities for amplifiers 7.4.10.1 Noise Figure We came across the Noise Figure in the first lecture of this course. The more complete definition (in light of our new knowledge of the combination of current and voltage noise is: 4kT Rs + en 2 + i2n Rs vA 2 + i2n Rs N F = 10 log = 10 log 1 + 4kT Rs 4kT Rs We note that this is a minimum when Rs = en /in . This suggests that to maximize the signal to noise it is sensible to match the impedance of some transducer to the noise matched impedance of the amplifier. If the signals moving through the system then it is possible to a noiseless impedance transformation using a transformer. For example, a transformer with a turns ratio of 1:N allows an impedance transformation of N 2 (the voltage is increased by N times, while the current is decreased by N times). Of course this only works for AC voltages (transformers are not dc coupled). Do not think that these statements imply that it is sensible to enforce the matching by using a noisy impedance transformation (i.e. by using a series resistor after a low impedance stage before entering an amplifier with a relatively high noise matched impedance.) Although this may mean that the noise figure is least degraded by the amplifier this might have been achieved by destroying the signal-to-noise before the signal got to the amplifier - so be careful! Effectively all I am saying is that the least degradation of the SNR occurs when one matches the input impedance - but this could equally well occur by having a very noisy source. Lecture 7: Filtering and Operational Amplifiers 7.5 7-11 And finally... The actual noise performance of your op-amp depends both on its characteristics and the circuit configuration surrounding the op-amp. The best suggestion is really to decide on the type of circuit you are going to need and then do the calculation in full, where you include the noise arising in all the resistors surrounding the op-amp (Johnson noise) where you include their effects as voltage noise sources or their equivalent current noise sources. In addition, add in the effects of amplifier noise (obtained from specification sheets) and then consider their net effect at the frequencies of interest in your signal. With modern computer packages this is really quite trivial and yields an answer that is easily good enough for nearly all situations. Lecture 7: Filtering and Operational Amplifiers 7-12 Lecture 7: Filtering and Operational Amplifiers 7-13 Lecture 7: Filtering and Operational Amplifiers 7-14