Operational Amplifiers ====================== .. tikz:: **Kirchhoff's Current Law.** laksdl kalsdk lk lkasd :xscale: 50 \draw (0,0) to[vsource, v=$V_0$] (0,3) to[short, -* , i=$I_0$] (2,3) to[R=$R_1$, i>_=$i_1$] (2,0) -- (0,0); \draw (2,3) -- (4,3) to[R=$R_2$, i>_=$i_2$] (4,0) to[short, -*] (2,0); In analog electronics, including signal processing, operational amplifiers are very important components. These are *active components* in contrast to the passive components we have seen so far. As such they are really outside the scope of these lecture series. We only give a very brief introduction as we need an op amp in one of the circuits in the practical course and because opamps are a very nice example of the use of feedback in signal processing systems. .. sidebar:: Powering an OpAmp An opamp can amplify voltages and currents and thus increase the power. That power has to come from a powersource. The opamp is an **active electronic element** just like the bare transistor. A more formal drawing is: .. tikz:: :xscale: 65 \draw (0,0) node[op amp] (opamp) {} (opamp.+) node[left] {$u_+$} (opamp.-) node[left] {$u_-$} (opamp.out) node[right] {$u_o$} (opamp.up) --++(0,0.5) node[vcc]{5\,\textnormal{V}} (opamp.down) --++(0,-0.5) node[vee]{-5\,\textnormal{V}} ; This opamp is 'fed' by a dual rail power source supplying both $+5$ and $-5$ Volt. The inputs $u_{+}, u_{-}$ and output $u_o$ all have to be within the range of the supplied voltages. No matter what the inputs are, the output is always clipped in the interval of supplied voltages. It is possible (and indeed used a lot) to use $0$ and $5$ Volt as supplied voltages but than the opamp *cannot* give negative voltages as output. Something to be reckoned with if you mix digital and analog signals. Functionally an opamp amplifies the potential difference at the input $A_0$ times. I.e. $u_\text{out} = A_0 (u_{+} - u_{-}) $ . The open loop amplification factor is very high, in the order of $10^5$. Approximately we can take it to be infinitely large. We call it an ideal opamp. .. tikz:: **Operational Amplifier (OpAmp).** The open loop gain of the amplifier is given by $U_0 = A_0(u_{+} - u_{-})$. Typically $A_0\approx10^5$. :xscale: 30 \draw (0, 0) node[op amp] (opamp) {$A_0$} (opamp.+) node[left] (plus) {$u_+$} (opamp.-) node[left] {$u_-$} (opamp.out) node[right] {$u_o$}; As an open loop amplifier an opamp is of little use. The output will be clipped by the power supply and that even for very small potential difference at the input. The opamp shines in case we use it in a *feedback* configuration. The easiest feedback loop configuration is the opamp with unity gain, i.e. $u_0 = u_i$. .. tikz:: **Unity gain negative feedback loop.** :xscale: 35 \draw[scale=1] (2,0.5) node [op amp] (opamp) {$A_0$} (0,0) node [left] { $u_i$} to [short, o-] (opamp.+) (opamp.out) |- (0.5, 2) to [short] (2, 2) (opamp.-) -| (0.5, 2) (opamp.out) to [short, -o] (4,0.5) node [right] {$u_o$}; .. image:: https://blog.mbedded.ninja/electronics/components/op-amps/op-amp-schematic-voltage-follower-buffer.png To calculate the transfer function $u_o/u_i$ for this opamp configuration note that: .. math:: u_o &= A_0(u_+ - u_-)\\ u_+ &= u_i\\ u_- &= u_o so .. math:: u_0 = A_0( u_i - u_o) i.e. .. math:: u_0(1+A_0) = A_0 u_i and thus .. math:: \frac{u_0}{u_i} = \frac{A_0}{A_0+1} and for (very) large $A_0$ we have .. math:: \frac{u_0}{u_i} = 1 This circuit is also called a *buffer* or a *unity gain* amplifier. It more or less makes the circuitry that 'makes' $u_i$ (the input) and the circuitry that uses $u_0$ (the output) independant of each other. Note that for $A_0\rightarrow\infty$ we have that $u_- = u_+$ and thus that no current is flowing into (of out of) the opamp through its inputs. These two observations can be proven to characterize circuits with opamps that are more complex than the simple unity gain amplifier. These observations are the principles of the **ideal opamp**: .. math:: u_+ &= u_-\\ i_- &= i_+ = 0 Consider the following opamp circuit where both $u_i$ and $u_o$ are measured with respect to ground. .. tikz:: **Inverting Amplifier.** :xscale: 50 \draw (0, 0) node[op amp, yscale=1] (opamp) {} (opamp.-) to[short,-* ] ++(-1, 0) coordinate(A) (opamp.+) -| ++(-1,-1) node[ground](B){} (opamp.out) to[short,*-o] ++(1, 0) coordinate(C) %(C |- B) node[ground]{} node[ocirc]{} (A) to[R,l_=$R_1$,-o] ++(-2, 0) node [left] {$u_i$} (A) |- ++(1,1) to[R=$R_2$] ++(2,0) -| (opamp.out) to[short,-o] ++(1,0) node [right] {$u_o$} ; Applying the rules of the ideal opamp we get that $u_-=0$ (a *virtual ground*). Given that no current is flowing into (or out of) the opamp, i.e. $i_-=0$ we have that the current flow $i_1$ through $R_1$ equals the current $i_1$ through $R_2$ and applying Ohm's law we have .. math:: i_1 &= i_2\\ i_1 &= \frac{u_i}{R_1}\\ u_o &= -i_2 R_2 leading to .. math:: \frac{u_o}{u_i} = - \frac{R_2}{R_1} Note that again the properties of this opamp circuit are not dependent on the opamp parameter $A_0$. This is a good thing in practice as the open loop amplification is not constant over opamps (even of the same type) and for any opamp is dependent on temperature and other parameters. The use of negative feedback stabilizes the properties of the opamp circuit. In an exercise you are asked to calculate the transfer function for a non inverting opamp. Most OpAmps can amplify DC signal as well as AC signals. It depends on the type op opamp what is *bandwidth* is. This capability can be used to build frequency dependent opamp circuits by introducing capacitors (and sometimes even inductors) in the feedback loop of an opamp circuit. Operational amplifiers can also be used to add signals. Consider the following extension to the inverting amplifier showing a way to mix three different audio signals. .. Figure:: /figures/summing_audio.gif :align: center :figwidth: 70% **Mixing Audio Signals.** A summing opamp is used to mix three audio signals. Note that the US style for resistors is used (the squigly line) and that a resistor with an arrow pointing to it is variable voltage divider (a potentiometer). The capacitors at the input are used to decouple the amplifier from any DC signal in the inputs. A summation circuit using an opamp is also used in a traditional DAC (Digital to Analog Converter). Note that logical signals ''1'' are represented with a constant voltage (often 5 Volt) whereas a digital ''0'' is represented with a zero voltage level. .. figure:: /figures/dac_ladder_converter.gif :align: center :figwidth: 70% **DAC Ladder Converter.** A summing opamp configuration used to convert digital into analog.