%pip install ipympl==0.9.3
Requirement already satisfied: ipympl==0.9.3 in /usr/local/lib/python3.14/site-packages (0.9.3)
Requirement already satisfied: ipython<9 in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (8.39.0)
Requirement already satisfied: numpy in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (2.5.5)
Requirement already satisfied: ipython-genutils in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (0.2.0)
Requirement already satisfied: pillow in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (13.0.0)
Requirement already satisfied: traitlets<6 in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (5.16.1)
Requirement already satisfied: ipywidgets<9,>=7.6.0 in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (8.1.9)
Requirement already satisfied: matplotlib<4,>=3.4.0 in /usr/local/lib/python3.14/site-packages (from ipympl==0.9.3) (3.11.2)
Requirement already satisfied: decorator in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (5.3.1)
Requirement already satisfied: jedi>=0.16 in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (0.20.1)
Requirement already satisfied: matplotlib-inline in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (0.2.2)
Requirement already satisfied: pexpect>4.3 in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (4.9.0)
Requirement already satisfied: prompt_toolkit<3.1.0,>=3.0.41 in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (3.0.53)
Requirement already satisfied: pygments>=2.4.0 in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (2.21.0)
Requirement already satisfied: stack_data in /usr/local/lib/python3.14/site-packages (from ipython<9->ipympl==0.9.3) (0.6.3)
Requirement already satisfied: comm>=0.1.3 in /usr/local/lib/python3.14/site-packages (from ipywidgets<9,>=7.6.0->ipympl==0.9.3) (0.2.3)
Requirement already satisfied: widgetsnbextension~=4.0.16 in /usr/local/lib/python3.14/site-packages (from ipywidgets<9,>=7.6.0->ipympl==0.9.3) (4.0.16)
Requirement already satisfied: jupyterlab_widgets~=3.0.17 in /usr/local/lib/python3.14/site-packages (from ipywidgets<9,>=7.6.0->ipympl==0.9.3) (3.0.17)
Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (1.4.0)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (0.12.1)
Requirement already satisfied: fonttools>=4.28.2 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (4.68.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (1.5.1)
Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (26.3)
Requirement already satisfied: pyparsing>=3 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (3.3.3)
Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.14/site-packages (from matplotlib<4,>=3.4.0->ipympl==0.9.3) (4.0.0)
Requirement already satisfied: wcwidth>=0.1.4 in /usr/local/lib/python3.14/site-packages (from prompt_toolkit<3.1.0,>=3.0.41->ipython<9->ipympl==0.9.3) (0.9.4)
Requirement already satisfied: parso<0.9.0,>=0.8.7 in /usr/local/lib/python3.14/site-packages (from jedi>=0.16->ipython<9->ipympl==0.9.3) (0.8.7)
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.14/site-packages (from pexpect>4.3->ipython<9->ipympl==0.9.3) (0.7.0)
Requirement already satisfied: tzdata in /usr/local/lib/python3.14/site-packages (from python-dateutil>=2.7->matplotlib<4,>=3.4.0->ipympl==0.9.3) (2026.6)
Requirement already satisfied: executing>=1.2.0 in /usr/local/lib/python3.14/site-packages (from stack_data->ipython<9->ipympl==0.9.3) (2.3.0)
Requirement already satisfied: asttokens>=2.1.0 in /usr/local/lib/python3.14/site-packages (from stack_data->ipython<9->ipympl==0.9.3) (3.0.2)
Requirement already satisfied: pure-eval in /usr/local/lib/python3.14/site-packages (from stack_data->ipython<9->ipympl==0.9.3) (0.2.4)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
[notice] A new release of pip is available: 26.2.2 -> 26.3
[notice] To update, run: pip install --upgrade pip
Note: you may need to restart the kernel to use updated packages.
import matplotlib
if not hasattr(matplotlib.RcParams, "_get"):
matplotlib.RcParams._get = dict.get
7. Operational Amplifiers#
In this chapter we will have a look at the “Operational Amplifier” or, in short, “OPAMP”. OPAMPs are very versatile building blocks and can be used to implement various functions in electronic systems. They can be used as amplifiers, filters, integrators and many other applications, just by the addition of a few (passive) components. In order to understand how to use an OPAMP we need to look into electronic feedback principles first.
7.1. (Physics of) Feedback Systems#
Feedback in electronic systems is used in two ways, negative feedback and positive feedback (feedforward). Negative feedback is used more often. Negative feedback is used to stabilize or to control a system. In everyday life we use (unconsciously) a lot of negative feedback systems, even our own body consists of a large number of combined negative feedback systems! To make it clearer we can think of the following example: a heating system. In our house we have a heating system which can be used to maintain a comfortable temperature. In this heating system we have a few key elements:
heaters
thermostat, which consists of a control and a sensor
the room itself
When the room is cold, and we increase the control of the thermostat, it will sense that the temperature in the room is too low. It will send a signal to the heating system, which will switch on and start to generate heat. The room (heat-capacitance) will start to heat up. When the desired temperature of the room is reached, the thermostat sends a signal to the heaters, so they will switch off. The room will slowly cool down, till the thermostat “decides” that it is time to switch on the heaters again. By this the temperature in the room will remain (sort of) constant. Comparing this to a normal wood-burning stove, this will continue to produce heat, regardless of the temperature in the room. The wood stove has no temperature regulation at all.
Based on the description above we can identify a few key elements in the system:
a control input (setting the wanted value) (knob on the thermostat)
a comparing element, to check if the control input is higher or lower than the value we want to control (electronics inside the thermostat)
a measurement input to measure the value of the parameter we want to control (temperature sensor)
an actuator, a system to change the parameter we want to control (heaters)
The example and system description above are for a heating system, with the operational amplifier we will be controlling electrical signals. A block diagram of such a system is shown in Fig. 7.1.
Fig. 7.1 Generic diagram of a system with negative feedback.#
In this system we see that there is an input voltage at “IN+”. This input is connected to a subtraction point (actually it is an adder, but as the other signal is inverted, it results in a subtractor). The output of this subtractor is connected to an amplifier, the output of this amplifier is connected to the output. The output is sampled with a passive network (in block β). This signal is fed to the inverting input of the adder (subtracted). This closes the feedback loop.
In order to further understand the functioning of this system, we will derive a transfer function for this system. As this is a nice linear system, we can derive the transfer step-by-step. The output voltage is the amplified voltage coming from the subtraction point, this voltage is \(U_{in+} - U_{in-}\). The voltage \(U_{in-}\) is the output voltage multiplied by the transfer of block β.
This gives:
With:
The total transfer is thus:
Now we assume that the gain of the amplifier is very high, in the order of 100.000….1.000.000 times and that the block β contains passive components, thus β is between 0 to 1.
The transfer will then become:
Here we can see that the transfer of this system is determined by the passive feedback network which determines the factor \(\beta\). This is true, as long as the gain \(A_{ol}\) is very high, however this gain does not have to be very accurate. The feedback network \(\beta\) is determined by passive components, which generally have good accuracy.
7.1.1. OPAMP#
How does this relate to the OPAMP? The OPAMP is a complete circuit built in a chip, an integrated circuit. The circuit consists of a subtractor and high-gain amplifier (\(A_{ol}\)). A schematic of the amplifier is shown in Fig. 7.2.
Fig. 7.2 Schematic internal diagram of an OPAMP.#
In the diagram in Fig. 7.2, we see the two inputs, the non-inverting input (\(U_{in+}\)) and the inverting input (\(U_{in-}\)). The amplifier is shown as a controlled voltage source. Between the inputs we see an input impedance, which is in general very high. The output of the OPAMP has a source impedance, Zout, which is in general negligible. When drawing circuits, we generally use the symbol shown in Fig. 7.3 and Fig. 7.4, thus without the internal components.
Fig. 7.3 Schematic symbol of an OPAMP.#
Fig. 7.4 Schematic symbol of an OPAMP.#
In Fig. 7.3 and Fig. 7.4 we see the schematic diagram of the OPAMP. We see the power supply connections, +\(U_s\) and -\(U_s\), as well. The OPAMP is a complete circuit, therefore it needs power. Note that the power supply connections are not always shown in the symbol, sometimes they are not drawn, or drawn somewhere else in the schematics: don’t forget to them when you design a circuit yourself!
7.2. Golden (Electronic) Rules - the Zero Condition#
When analyzing OPAMP circuits, we use a few assumptions:
There is no voltage difference between the inverting and the non-inverting input.
There is no current (zero current) flowing into the inputs of the OPAMP.
The output impedance of the OPAMP is zero ohms (behaves like a voltage source)
In order to put these rules in some perspective, some background is needed.
The first one: There is no voltage difference between the inverting and non-inverting input. In ideal op-amp analysis, we assume that this voltage difference is zero. This statement is as true as it is faulty. We have seen that the gain (\(A_{ol}\)) of an OPAMP is very big. The output voltage range of an OPAMP is between -15V and +15V (depends on the power supply voltage). In order to have a voltage output of, say +3V, we need a voltage on the input of the amplifier block of +3 / 100.000 = 30 \(\mu\)V. This voltage difference originating from the subtractor (difference in voltage between the inverting and non-inverting input) and is so small that it is hard to measure. In most circuit analyses, it can therefore be neglected. For this reason, we say that the voltage difference is zero. Besides this, the gain of 100.000 times is conservative, very often the gain is higher, giving an even smaller difference.
The second one: There is zero current flowing into the inputs of the OPAMP. When checking the specifications of an OPAMP in the datasheet we see that the current flowing into the inputs of an OPAMP is usually in the order of magnitude of pA (depends on the type of OPAMP). This current is very often so small compared to the other currents in the circuit that it can be neglected. For example, when other currents are in the µA or mA range, a pA input current has virtually no effect on the result. Furthermore, think about the input as a resistance: \(R = \frac{U_{in}}{I_{in}} \)= “few volts” / “pA” this will give a resistance in the order of hundreds of Giga-\(\Omega\)’s!
The last one: The output of an OPAMP behaves as a voltage source, has zero-ohm output impedance. This is the ideal model used in circuit analysis. The internal circuit of an OPAMP is constructed in such a way that the output has indeed very low impedance, although not perfect. Nevertheless, the output impedance of the OPAMP is further improved by the fact that the output voltage source is within the feedback loop. When the output voltage is too low, due to an external load, the feedback system will compensate for this and increase the output voltage to overcome the losses.
7.3. OPAMP Circuits in Practice (resistances in the Feedback)#
All this theory might seem a bit complicated. Furthermore, how to apply this in practice? Let’s have a look at some practical circuits. Things will become clearer then. In this chapter we will have a look at some basic topologies and other useful circuits.
7.3.1. Non-inverting Amplifier#
The first circuit we will have a look at, is the non-inverting amplifier. Non-inverting means that the amplified output voltage signal has the same polarity as the input signal. For this, the term “phase” is used, the input signal and output signal are in phase. This is in contrast with the inverting amplifier, as addressed later in this chapter, where the input and output voltage have opposite polarities, thus they are in counter-phase.
The non-inverting amplifier nicely follows the feedback scheme presented in the beginning of this chapter. It has an input (non-inverting input of the OPAMP), it has a passive feedback network connected to the output, and the output of this network is connected to the inverting input of the OPAMP. Now, look at the schematic diagram in Fig. 7.5.
Fig. 7.5 Non-inverting amplifier with an OPAMP.#
The resistors \(R_f\) and \(R_i\) are forming a passive network. The two resistors will form a passive voltage divider, which will divide the output voltage \(U_{out}\). The divided voltage is sensed by the inverting input of the OPAMP. As no current flows into the OPAMP (zero condition!) the voltage divider is not influenced by the OPAMP’s input. From the feedback theory we learned that \(\beta\) should be ≤1. This is true for a voltage divider.
Now, what will be the gain of this circuit? The input signal is connected to the non-inverting input. Nothing else is connected to this pin, thus the voltage here will follow the input signal voltage. The first zero-condition states that both inputs (inverting and non-inverting) will have the same potential (no voltage difference). Thus, the potential of \(R_i\) will be equal to the input voltage. Ohm’s Law tells us that there will be a current through \(R_i\).
As this current cannot come from the input of the amplifier (second zero-condition, no current flows into the inputs of the OPAMP) all the current necessary for Ri has to be supplied through Rf. The voltage drop over Rf will be:
In order to have this voltage drop over \(R_f\), the output voltage needs to be:
Combining equations (7.7), (7.8) and (7.9) gives:
The transfer of the circuit will be:
The gain of this circuit will be a positive number, and will always be above 1. This means that the circuit will amplify its input signal and that the input and output voltage will be in phase.
Now assume that resistor \(R_f\) is 10 k\(\Omega\) and resistor \(R_i\) is 1 k\(\Omega\), then we can calculate the gain:
The output voltage will thus be the input voltage amplified by 11 times. The signals would look like the ones in Fig. 7.6.
Fig. 7.6 Input signal and output signal of a non-inverting voltage amplifier.#
Here we can see that the input voltage and the output voltage are in phase, they have the same polarity (and shape), only the amplitude is different.
When a signal needs to be amplified with a different amplification factor, it will suffice to change the ratio of the resistors \(R_f\) and \(R_i\). In practice gains can be realized from 1 to 1000 times with a single OPAMP-amplifier.
A word about the resistor values: While in theory only the ratio of \(R_f\) and \(R_i\) is important to determine the gain, there are other things to consider in practice. Assume we would make the 11 times amplifier with a resistor \(R_f\) of 10 \(\Omega\) and \(R_i\) of 1 \(\Omega\) (compared to the 10 k\(\Omega\) and 1 k\(\Omega\) of the previous example). What would happen then? Based on formula 10, the gain would still be 11x. However, when the output voltage would be, say, 10 Volts, the OPAMP needs to supply a current of almost 1 Ampere through the feedback circuit. In practice an OPAMP cannot supply such a big current, furthermore, the circuit would not be very energy efficient. About 10 Watts of power would be dissipated in the feedback circuit (this will drain a battery pretty quickly!). Therefore we will usually see resistors in the range of k\(\Omega\)s to hundreds of k\(\Omega\)s in the feedback circuit. This is perfectly fine, as the ratio is what matters in the end.
7.3.2. Buffer or Voltage-follower#
While in practice the ratio of the resistors Ri and Rf is limited, they could be any ratio in theory. There is one theoretical situation which will yield a useful circuit in practice. This occurs when resistor Ri will infinite (∞). The gain of the circuit will then be:
The gain of the circuit will thus be 1x. By the way, an infinite resistance, means that it has been taken out of the circuit, so \(R_i\) is not present in the circuit anymore. Furthermore, resistor \(R_f\) could have any value in theory, so it could just as well be zero \(\Omega\) (a piece of wire). When implementing this, the circuit would look like the one shown in Fig. 7.7.
Fig. 7.7 One time amplifier with an OPAMP.#
Now what is the advantage of such a unity-gain amplifier? Can’t we just replace it with a short piece of wire? Gain-wise the answer would be “Yes”. However, when we look at the impedances in the circuit we can get to a different conclusion.
The input impedance at \(U_{in}\) is infinite (no current flows into the OPAMP). The output of the OPAMP behaves as a voltage source (zero output impedance). Thus, we made a circuit which will not load the source, but is capable of driving a more low-ohmic load.
Recap on ‘load the source’ and ‘driving a more low-ohmic load’
Consider a circuit with a source voltage of 1V, a source resistance of 10 k \(\Omega\) and a connected load of 10 k \(\Omega\). Due to a voltage division between the source and load resistor, the voltage over the load is only 0.5 V.
If a unity-gain amplifier is used between the source and the load, the source voltage is not (significally) affected by the connected circuit, because the amplifier draws virtually no current. In other words, the source is isolated from the load.
A low-ohmic load would require a relatively high current (Ohm’s law). A practical voltage source, with an input impedance > 0, might not be able to supply this current without its output voltage dropping. A (unity-gain) amplifier can supply the required current to the load while maintaining the desired output.
This type of circuit is called a buffer or voltage follower. It will find its application in situations where a source with a very high output impedance has to drive a following stage in the signal chain with a (fairly) low input impedance.
In practice one could think of a micro-probe which senses the potential of a single biological cell. This potential is measured over a long coaxial cable, with a lot of parasitic capacitances. When the cable is directly connected to the cell, all energy of the signal is necessary to drive the cable capacitance, so the signal will be totally absorbed by the cable. When the buffer is placed between the microprobe and the cable, the potential is sensed with zero energy. The signal on the cable, a copy of the cell potential, is delivered by the voltage source of the OPAMP. This would make it possible to measure the cell-potential over a shielded cable.
Example microprobe
Assume the cell potential gives a (sudden) increase in electrical potential due to a bio-chemical reaction. The determination of rise time of the electrical peak is essential for the experiment.
The internal (electrical) resistance of the cell and the capacitance of the coaxial cable will form a low-pass filter. Now we assume that the electrical resistance is 10 MOhm, and the coaxial cable has a capacitance of 150pF. The RC-time of this circuit is tau = R * C = 10M * 150p = 1.5 ms.
The rise-time of a pulse is defined as the time it takes for the pulse to change from 10% to 90% of its transition. The RC-time is the time it takes to change from 0% to 63%. The relation between the two can be described as: rise time ~ 2.2 * tau
Thus the minimum rise time we will always measure is: 2.2 * 1.5ms = 3.3ms.
When the transition is slow, this is not a problem, however, when the change is faster, the measurement result will always be determined by the cable and the internal resistance. Adding a buffer will decrease the apparent resistance driving the cable from 10 MOhm to a few Ohm. This will significantly decrease the time-constant of the measurement system, allowing proper measurement of the cell response.
7.3.3. Inverting Amplifier#
Another basic configuration is the inverting amplifier. This type of amplifier will amplify a signal and change its polarity. Changing the polarity of a signal is sometimes of use in (complex) systems, for example when working with differential signals (topic of the next chapter). Sometimes the polarity of the signal is not important and only amplitude is of importance, then other characteristics of the inverting amplifier might make it the best candidate for the job.
First of all, let’s have a look at the basic circuit of an inverting amplifier, see Fig. 7.8.
Fig. 7.8 Inverting amplifier circuit, with a virtual-ground point#
When we have a look at the circuit diagram, we can still see a passive feedback network which consists of \(R_i\) and \(R_f\). This network is connected to the inverting (-) input (negative feedback!). But: the voltage source or input signal is connected to this network as well. The non-inverting (+) input, which was the signal input for the non-inverting amplifier is now connected to ground (0 Volt).
Let’s have a look at how this circuit will work. For this we will use the zero-conditions again. First of all, there is no voltage difference between the amplifier inputs. In this circuit, the non-inverting (+)input is connected to GND. Thus, the inverting (-) input will remain at ground level (0 Volt) all the time. Based on this, we can calculate the current which flows through \(R_i\), using Ohm’s Law.
The current which flows through this resistor, must go somewhere. Now the second zero-condition will become of importance: No current flows into the inputs of the OPAMP. Here it means, that all the current which flows through \(R_i\), has to flow through \(R_f\). Assume the input voltage is positive, then the current through Ri will flow from left to right. This current will continue to flow through \(R_f\) from left to right as well. As the left side of Rf is at ground potential, the current will only flow to the right, when \(U_{out}\) is below ground potential, so negative. In formula:
Based on equations (7.13) and (7.14) we are now able to derive the transfer for this circuit.
Here we can see that the gain is determined by the ratio of Rf and Ri. The minus-sign doesn’t indicate attenuation of the signal, but it indicates the phase-change. The input signal and output signal are in counter-phase. This is shown in Fig. 7.9.
Fig. 7.9 Input and output signal of an inverting amplifier.#
In the graph, in Fig. 7.9, we can see that the input signal and the output signal are opposite in polarity (phase). The output signal has a higher amplitude compared to the input signal. The difference will be the amplification factor.
Another important aspect of this circuit is the input impedance. With the non-inverting amplifier the signal was connected to the non-inverting input, no current would flow there, thus the input impedance was infinite. Here, with the inverting OPAMP, the input voltage source has to supply the current which flows through Ri and Rf. The input impedance will thus not be infinite. What will be the input impedance? For the input voltage it seems that it has to power a resistor which is connected to ground, the resistor \(R_i\). The input voltage source doesn’t “see” \(R_f\). Thus the input resistance of this amplifier equals \(R_i\). The output impedance of this circuit is determined by the voltage source inside the OPAMP. Thus the output impedance will remain 0 \(\Omega\), similar to the non-inverting amplifier. When choosing resistors it is good to realize that \(R_i\) will determine the input impedance. This resistor will usually be several k\(\Omega\)s. The other resistor is determined by the wanted gain-factor, and will be in the k\(\Omega\) region as well.
When looking at the gain factor of this circuit, we can see that the gain can be varied between 0 and (almost) infinite. In theory the gain could be below 1, so attenuation, instead of amplification. While attenuation is possible with an OPAMP circuit, it can be realised by a simpler resistor divider, therefore such circuit will used less frequenctly.
7.3.4. Virtual Ground Point#
When we analyzed the circuit we concluded that the inverting-input of the OPAMP will be at ground-potential. While this point is at ground-potential, it is not actual ground! As the current which flows there, should go somewhere else. In the situation of the inverting amplifier, the current will flow through Rf. Nevertheless, for the rest of the circuit, this point looks like a ground point, therefore we will call this a “virtual ground point”.
Fig. 7.10 Virtual ground point in an inverting amplifier.#
7.3.5. Current-to-Voltage Converter#
The virtual ground point which was described before has proven to be a very versatile characteristic in OPAMP circuits. As said any current flowing to the virtual ground point will continue its journey through another path, most often the resistor Rf. The most basic form is the current to voltage converter, its diagram is shown in Fig. 7.11.
Fig. 7.11 Current to voltage converter.#
This circuit has a current input, for example current generated by a photodiode, so not a voltage input which we see more often. The current at the input will flow towards the virtual ground point. As the current doesn’t flow into the OPAMP, the current continues its path through Rf. The transfer function of the circuits is as follows:
The transfer function of the circuit will be:
The circuit has a transfer which could be expressed in \(\Omega\), because it will be voltage divided by current, as in Ohm’s Law. However, very often it is referred as “Volts / Ampere”, or derivatives, like mV/mA. As this amplifier converts current at its input to a voltage at the output it often referred to as “transimpedance amplifier”. In fact, the inverting amplifier from the previous section can be seen as a voltage to current conversion (with the resistor) followed by a transimpedance amplifier, which converts the current through \(R_i\) in Fig. 7.8 into \(U_out\).
One could argue that just a resistor is a current to voltage converter, as well. In a way this is true, since the voltage across a resistor is given by Ohm’s law. The advantage of the OPAMP circuit is not the conversion of current into voltage itself, but that it performs this conversion while keeping the input voltage approximately constant.
7.3.6. Summing Amplifiers#
Another application of OPAMPs is in summing amplifiers. A summing amplifier, or more correctly, an inverting summing amplifier can be used to add signals together, without the signals influencing each other. This amplifier makes use of a virtual ground point to add the signals together. For this the voltage to be added should be converted to a current first, which in this case can perfectly be done with a resistor. In Fig. 7.12 we see a summing amplifier with three inputs.
Fig. 7.12 Summing amplifier with three inputs.#
For each of the input channels the input voltage will be converted to a current through the corresponding resistors. (This is in a similar way as to the inverting amplifier.) All of these currents will be added in the virtual ground point. The resulting current will then be converted to a voltage by Rf.
In order to get a transfer function for this circuit the following formulas can be used.
The resulting current is: \( I_f = I_1 + I_2 + I_3 \)
The output voltage is: \( U_{out} = -I_f \cdot R_f\)
All these formulas added together give:
From equatiom (7.19) it can be seen that the voltage can be added with different ratios. As the currents are added in the summing point, virtual ground point, oeach input signal contributes independently to the output voltage. This type of circuit is used in complicated regulation systems, but another good example is an audio-mixer where the signals of multiple audio sources are added together (mixed).
Challenge: non-inverting summing amplifier
Would it be possible to build a non-inverting summing amplifier?
What would be the design?
Which formulas would apply?
Argue why the inverting summing amplifier is more favoured over the non-inverting summing amplifier?
7.3.7. Clipping#
OPAMPS will not work if they are not powered, so if (either) of their voltage supply pins are not connected. This supply voltages also limits the range of output voltage: the output voltage cannot be higher than the supplied voltage, and even stay a bit below.
For example: Consider an OPAMP circuit with an amplification of 10, and with \(U_{supply} = \pm \) 15V. If the input voltage is a sine with 2V amplitude, thus 4 Vpp, then the expected output amplitude would be 10 x 2 Vp = 20 Vp, thus 40 Vpp. However, the OPAMP cannot produce a voltage beyond the supply voltages, \(\pm\) 15V, thus a maximum range of 30 V. The resulting output signal will look like a 20Vp sine, but clipped at (slightly below) \(\pm\) 15 V.
7.4. OPAMP Circuits in Practice (with Complex Impedances in the Feedback)#
Up to now we have seen circuits with resistors in the feedback path. These resistors could be replaced with other components as well, indicated as an impedance. In practice it could be a capacitor, an inductor or a resistor. As capacitors and inductors have a frequency dependent impedance, the resulting circuit will show frequency dependent behavior. In Fig. 7.13 we see a generic circuit, an inverting amplifier topology, where the resistors are replaced with generic impedances.
Fig. 7.13 OPAMP circuit with generic impedances in the feedback.#
The transfer function of this circuit is similar to an inverting amplifier with resistors. Instead of Ri and Rf we can write Zi and Zf.
Thus:
When calculating the transfer, the Zf and Zi should be replaced with the appropriate complex function.
Thus:
for a capacitor: \(Z_i\) or \(Z_f\) = \(\frac{1}{j \omega C}\)
for an inductor: \(Z_i\) or \(Z_f\) = \(j \omega L\)
for a resistor: \(Z_i\) or \(Z_f\) = R
Depending on which components are selected the circuit will have different time-dependent and frequency-dependent behavior.
7.4.1. the Differentiator#
When we choose for \(Z_i\) a capacitor and for \(Z_f\) a resistor we get a circuit which is known as a differentiator. The resulting circuit can be seen in Fig. 7.14.
Fig. 7.14 Differentiator circuit with an OPAMP.#
This circuit can be analyzed in two different ways, one way of looking at the circuit is in the frequency domain, the other way is in the time domain. Hopefully you see an analogy with the passive RC-circuit (differentiator or high-pass filter).
7.4.1.1. the OPAMP Differentiator in the Frequency Domain#
For a start, let’s have a look at the behavior in the frequency domain. The transfer of the circuit is determined by the components in the feedback circuit, thus the resistor and the capacitor. When looking at the configuration we see that the structure is similar to an inverting amplifier. The transfer will be:
When we have a look at this formula we see that the gain for DC (\(\omega\)=0) is zero, so the circuit will not pass any DC. For very high frequencies (\(\omega\) = \(\infty\)) the gain should be infinite.
Will the gain become infinite in reality as well? In practice the OPAMP has a limited gain, still high (~100.000x), but not infinite. The gain has to come from the OPAMP, thus this will impose a practical limit on the gain. Furthermore the signal-bandwidth of an OPAMP is not infinite, thus the signal will not be amplified anymore beyond certain frequencies. There the differentiator will stop functioning.
When further looking at equation (7.20) we see that the gain will increase linearly with frequency. For every octave (doubling of the frequency) the gain will increase by a factor of two, thus 6dB/octave. For every decade (10 times the frequency) the gain will increase by a factor of ten, so 20dB/decade.
What is the meaning of the RC value? The RC-value determines the “cut-off” frequency. As the circuit behaves as a high-pass it determines the point from which the gain will be above 1 (=0 dB).
What is the meaning of the “- j” in the formula? The “- j” indicates the phase behavior. Note that this phase behavior is coming from the inverting action of the OPAMP topology (-180º, or -\(\pi\)) and from the capacitor. The capacitor adds a +j, which means +\(\frac{\pi}{2}\). The resulting phase shift will be -\(\frac{\pi}{2}\).
This behavior is shown in Fig. 7.15.
Fig. 7.15 Phase and gain behavior of the OPAMP differentiator.#
7.4.1.2. the OPAMP Differentiator in the Time Domain#
Another way of looking at the circuit is in the time-domain. The capacitor will add a time dependent factor to the circuit when it is being charged or discharged.
For analyzing the circuit this way, we make use of the “Golden rules” aka the zero conditions.
At the input of the circuit we have an input voltage \(U_{in}\). This voltage is connected to one side of the capacitor and between GND. The other side of the capacitor is connected to the inverting input of the OPAMP, as discussed before, this point will behave as a virtual ground-point.
Result: As the inverting input behaves as virtual ground, the full input voltage is over the capacitor. Note: The circuit does not contain a resistor that limits the capacitor’s current. The current through the capacitor is determined by the rate of change of the input voltage. For an ideal voltage step, this would result in an infinitely large current. Practical circuits contain mechanisms to limit the current.
The side connected to the virtual ground point has to pass the current, as no current will flow into the OPAMP, this current has to be supplied through Rf. Which means that the current through the voltage will be converted into a voltage at the output of the OPAMP. Remember Ohm’s Law, when a current passes through a resistor, there will be a (proportional) voltage drop over the resistor.
The current through the capacitor is given by: \(I_{cap} = C \frac{dU_{in}}{dt}\)
As said, the current through the resistor Rf equals the current through the capacitor, thus \(I_f = I_{cap}\).
The output voltage of the circuit is \(U_o = -I_f \cdot R_f\)
Which gives a total transfer of:
The minus sign in front of the transfer function, will give an opposite result, compared to what one would expect from the mathematical differentiating action.
This formula in itself is maybe not very clear. Let’s look at some examples of input voltages and resulting output voltages.
Fig. 7.16 In this figure we can observe some signals in the time domain. Note the inverting action of the circuit.#
In Fig. 7.16 we see that a sinewave on the input does not give a cosine (the mathematicalo differentiation), but, due to the inverting action of the OPAMP, it will give an inverted cosine.When a square-wave or step function is applied, the circuit will only react on the slope of the square-wave or step-function. The output of the circuit will give (inverted) sharp spikes in phase with the transitions of the square wave. The response to a triangle-wave on the input will be a square wave: a constant (positive or negative) voltage at the output depending on the (decreasing or increasing) slope of the triangle.
7.4.2. the Integrator#
When a capacitor is placed in the feedback path and a resistor at the input of the inverting amplifier, a circuit is created which is referred to as the “integrator”. More correctly, it is an inverting integrator, due to the inverting action of the OPAMP circuit. The basic configuration is shown in Fig. 7.17 .
Fig. 7.17 Basic integrator circuit with an OPAMP.#
Compared to the differentiator the resistor and capacitor swapped their position. Similar to the differentiator this circuit can be analyzed in the time-domain and in the frequency-domain. Let’s start with the frequency domain.
7.4.2.1. the OPAMP Integrator in the Frequency Domain#
This circuit is an inverting amplifier configuration with a complex impedance (capacitor) in its feedback path. This will yield a transfer function as shown below, equation (7.22).
When analyzing the formula, we can see that for DC (ω = 0) the gain of the circuit would be infinite. While this is true in theory, the gain of the circuit will be limited by the OPAMP in real life. For very high frequencies (\(\omega = \infty\)) the denominator of the transfer function will be very high, resulting in a transfer very close to zero.
What else can we tell from the formula? We can see a linear behavior of the gain with the frequency. When the frequency (\(\omega\)) will double (octave), the gain will be halved. This results in a linear slope of 6dB/oct. Similar, when the frequency is increased ten times (decade), the gain will be reduced by a factor of ten, which can be expressed as 20dB/dec.
What will happen to the phase of the signal? We can see that there will be an inversion (-180º phase shift) due to inverting amplifier circuit. Furthermore, the capacitor is responsible for another -90º shift in phase, this totals -270º. With continuous signals, this phase shift will look like an effective +90º phase shift, thus \(\frac{\pi}{2}\).
This can be seen from mathematical point as well: Integrating a SIN gives a -COS. In this case the signal will be inverted as well, thus the -COS is multiplied by -1, giving +COS. Which is π/2 ahead of the sinewave.
The resulting gain characteristic is shown in Fig. 7.18 .
Fig. 7.18 Gain characteristic of the integrator. Note that both the horizontal and vertical axis are logarithmic. Thus the frequency on the left side will never reach 0 Hz (DC).#
7.4.2.2. The OPAMP Integration in the Time Domain#
The integrator circuit can be analyzed in the time domain as well. The capacitor will take care of the integrating action, by either storing or releasing energy (charging/discharging). For analyzing the circuit we will rely on the Golden rules, known as the zero-conditions.
The input voltage \(U_{in}\) is connected between GND and the left side of the resistor \(R_i\). The right side of the resistor is connected to the virtual ground point. Which means that the input voltage is converted to a current by the resistor, \(I_f = \frac{U_{in}}{R_i}\). This current will not flow into the OPAMP (zero-condition!) so all this current has to pass through the capacitor to the output. The current will be integrated into the capacitor. Remember, the charge on a capacitor can be described as:
\( Q = C \cdot U_c\)
Written in a different way:
\(U_c = \frac{Q}{C} \)
When we are looking at changing charges we can write:
\(\frac{dU_c}{dt} = \frac{1}{C} \cdot \frac {dQ}{dt} \)
Where \(\frac {dQ}{dt} \) is equal to the current flowing. Remember: 1 Ampere = 1 Coulomb / second
The current flowing can be described with: \(I = \frac{U_{in}}{R_i}\)
Current through the capacitor is equal to the current through the resistor \(R_i\), thus:
Remember the inverting action of the OPAMP, this finally yields:
The approach given above is generic. A special situation occurs when the input of the integrator is fed with a constant voltage for a certain time. Then you can integrate the above equation and obtain:
This shows that the output will change in a linear fashion when a constant voltage is applied to the input. Remember that the charge over a capacitor will increase linearly when supplied with a constant current. In this case the constant current is generated by the OPAMP. In a RC circuit without OPAMP the current is not constant, resulting in exponential charging of the capacitor. The output is nicely illustrated by the time plots of the input and output signal of the integrator in Fig. 7.19.
Fig. 7.19 Input and output waveforms of the OPAMP-integrator. Note that the output of the triangle is a parabolic, and not a sine.#
7.4.2.3. Taming a OPAMP Integrator#
When there is a constant voltage, no matter how small, there will be a resulting net current flowing in the capacitor. As the output voltage of the OPAMP is limited by its power-supplies, the output voltage of the integrator will be limited by the OPAMP’s power supply voltage. In this situation it is clear where the “slow drift” of the output is coming from (the small offset on the input). However, when this offset is not present, a similar effect could occur. The reason for this is the small current the OPAMP draws on its input (as will be discussed in the next chapter). Based on the zero-condition we stated that no current flows into the inputs of the OPAMP. Roughly speaking this is true, but in practice a small current will flow, we call this current the bias-current. The bias current ranges from a few pA to a few nA. Normally speaking, we can neglect this, but in the integrator this current will cause some problems.
Is there a solution to this problem? Luckily there is! By adding an extra resistor (\(R_2\)), a path, parallel to the capacitor can be created for the bias-current, this is shown in Fig. 7.20 . This resistor will have influence on the behavior of the integrator. However, the influence is small, so it’s a small price which has to be paid for having a practically usable circuit.
Fig. 7.20 ‘Tamed’ Integrator with extra resistor added, to mitigate the influence of the small current (bias-current) flowing into the OPAMP.#
The resistor \(R_2\) can have a high value, in the order of mega-\(\Omega\)s. In the transfer function, the influence of the extra resistor is clearly indicated.
The gain for low frequencies, close to DC is limited to the ratio of R2 and R1.
This gain can be described by: \( G_{dc} = -\frac{R_2}{R_1} \)
This can be further clarified by comparing the impedance of the capacitor to the value of the resistance. For DC the impedance of the capacitor will be infinite, the resistor R2 in parallel, with the capacitor will then mainly determine the impedance.
In the frequency characteristic we can see two specific points. The low pass cut-off frequency, determined by \(C\) and \(R_2\) and the point where the gain will be equal to one (0 dB), determined by \(C\) and \(R_1\).
Remember that the complete formulas will be:
Low pass cut off frequency: \( f = \frac{1}{2 \pi C R_2} \)
Unity gain frequency: \( f = \frac{\sqrt{R_2^2 - R_1^2}}{2\pi R_1 R_2 C}\), which only for \(R_2\)>>\(R_1\) will approximate \( f = \frac{1}{2 \pi C R_1} \)
The slope of the gain will be equal compared to the ideal integrator.
7.5. OPAMP Circuits in Practice (with positive Feedback): Comparator with an OPAMP#
Up till now we have been looking at linear circuits. The output voltage is a linear function of the input voltage. For these circuits the Golden rules do apply. However, there are circuits which make use of the high open loop gain of the OPAMP which are not linear. An example of such a circuit is the comparator.
The comparator is used when two different voltages should be compared. Before we jump into analyzing these circuits, it should be noted that comparators can be made with OPAMPs, but there are specialized integrated circuits which are called (surprisingly) “comparators”. An integrated circuit (IC) is an electronic circuit that contain multiple integrated onto a single semiconductor chip and packaged as a single component. In practice, general-purpose OPAMPs are often not well suited for comparator applications, because their internal amplifier stages can saturate, resulting in relatively slow switching and recovery times. Dedicated comparator ICs are designed to avoid these limitations. However, here we will focus on the circuits based on OPAMPs.
7.5.1. Basic Comparator#
The basic comparator consists of just an OPAMP, no other components are needed. On one connection a reference voltage is connected, on the other connection the voltage to be measured (compared). The output of the OPAMP is the output of the comparator. This is shown in Fig. 7.21 .
Fig. 7.21 Basic comparator with an OPAMP.#
In this situation we make use of the high open-loop gain of the amplifier. Basically the OPAMP amplifies the voltage difference between the inverting and non-inverting input. When the output signal (amplified input voltage difference) reaches the power supply voltage, the output voltage will be limited to the supply voltage (the output is clipping). When \(U_+\) is (slightly) higher compared to \(U_-\), the resulting input voltage is positive and the output will clip at its positive supply voltage. When U+ is slightly lower than U- the output voltage will clip at its negative supply. A very small region, where the voltage difference is just a few microvolts, the output can give a voltage in between its power supply voltages. However, this is such a small region, that the change seems instantaneous. In the situation in Fig. 7.21, the \(U_-\) is the reference, thus when \(U_+\) is above the reference voltage the output is positive. When \(U_+\) is below \(U_-\), the output voltage will be negative. When the reference is connected to U+ and the input signal to \(U_-\), the circuit will work in the opposite (inverted) way. When the input voltage is above the reference, the output will be negative. When the input is below the reference, the output is positive. We call this an “inverting comparator”.
In real life signals will carry some noise (small random fluctuations). This noise can cause some erroneous behavior. Imagine we use the comparator in a counter, which counts when the voltage was above a certain reference value. Each time the comparator gives a high signal, an event is counted in an incremental counter. When the counter is close to its switching point, the noise of the input signal (and/or reference signal) will cause a “bouncing” effect of the comparator output, creating a fast train of pulses. This is shown in Fig. 7.22. All these pulses will be counted as well, giving an error in the reading of this measurement system.
Fig. 7.22 Scope image of bouncing at the output. Output-signal is upper trace, input signal, with noise, is the lower trace.#
The higher the peak-to-peak amplitude of the noise on the signal, the higher the error will be in the system. There is an effective solution for this problem, which is referred to as “hysteresis”.
7.5.2. Comparator with Hysteresis, or Schmitt-trigger#
A comparator which has hysteresis is less sensitive to noise; such type of circuit is also referred to as “Schmitt-trigger”. What does hysteresis mean?
The switching levels (thresholds) have moved apart. The result of adding hysteresis to a comparator, is that the output of the comparator will change its state from negative to positive at a different input voltage level, compared to the voltage level when the output changes from positive to negative. This is illustrated in Fig. 7.23.
Fig. 7.23 Behavior of a comparator with hysteresis. The black triangle-wave is the input signal. When above \(U_{trip+}\) the output will become positive and remain positive, till the input signal has passed the \(U_{trip-}\) level.#
In Fig. 7.23 the thresholds are shown as \(U_{trip+}\) and \(U_{trip-}\). The output signal remains at its state till the signal has passed above \(U_{trip+}\) or below \(U_{trip-}\). Noise on the signal will not affect the output state (unless the noise causing the signal to pass a threshold). The difference between Utrip+ and Utrip- should be higher than the expected noise on the signal.
How do we create this behavior in an OPAMP-circuit? In order to get this behavior we will be using positive feedback (also called feedforward). This is the opposite of the negative feedback we saw for the linear amplifier circuits. Part of the output signal is fed back to the inputs of the OPAMP, however, not to the inverting (-) input, but to the non-inverting (+) input.
The diagram of a non-inverting comparator with hysteresis is shown in Fig. 7.24.
Fig. 7.24 Non-inverting comparator with hysteresis.#
The switching levels (\(U_{trip+}\) and \(U_{trip-}\)) are determined by the reference voltage (which could be 0, thus GND), the output voltage of the OPAMP (power supply voltage) and the ratio of the resistors.
In general it can be said that the output of the comparator will change at the moment that the inverting-input and non-inverting-input have the same potential. But note, that due to the resistors the non-inverting-input voltage is not equal to the input voltage of the comparator-circuit!
The following equations can be derived starting with \(U_{out} = \pm U_{supply}\) and the corresponding \(U_{in}\) levels:
The behavior of the circuit can be studied in the time-domain, as shown in Fig. 7.23. Another way of visualizing the behavior of the circuit is by creating a plot in which the output voltage of the circuit is shown as a function of the input voltage. This is shown in Fig. 7.25. Similarities can be seen with the hysteresis curve which might be known from studying magnetism.
Fig. 7.25 Output signal of the comparator as function of the input signal. The arrows show the transitions.#
In order to understand what is happening we will have a closer look at the diagram. Let’s start at the bottom left. The input voltage \(U_{in}\), will travel along the horizontal line at the bottom. As long as the input voltage does not pass \(U_{th+}\) (upper threshold) the output voltage will be \(U_{ol}\). When the input voltage passes \(U_{th+}\), the output will “switch” to its high level (\(U_{oh}\)). The output will remain at this level, as long as \(U_{in}\) remains above \(U_{th-}\). As soon as the input voltage drops below \(U_{th-}\) the output will switch to the low-level (\(U_{ol}\)). The width of the hysteresis curve shows the separation of the low and the high threshold voltage.
The description above is for the non-inverting comparator. It is possible to construct an inverting comparator with hysteresis as well. The diagram is shown in Fig. 7.26, together with its input-output curve.
Fig. 7.26 Inverting comparator with hysteresis and the accompanying input-output curve.#
Advantage of this circuit is that the input signal is connected to an OPAMP input. This input has a very high impedance, thus the source \(U_{in}\) is not loaded by the comparator circuit.
For the switching levels the following formulas can be derived:
Just like with the non-inverting comparator the reference voltage \(U_{ref}\) can be equal to zero. Giving a symmetrical hysteresis curve around GND.
7.5.3. Control Loops#
With the introduction of the OPAMP we made a comparison with the control or regulation loop for a heating system. With the theory of this chapter in the back of our mind we can revisit this topic.
The easiest regulation loop can be made with a comparator without hysteresis. However, such a regulator will be switching on and off a lot when, e.g. the temperature, is around its setpoint. Things can improve when by adding some hysteresis. This will prevent the quick switching on and off around the setpoint at the expense of fluctuations around the setpoint (due to the high and low setpoint).
The regulators based on the comparators have a crude on/off behavior. In practice one wants a smoother regulation loop based on more linear elements. While the theory behind regulation loops is a study on its own, we would like to mention some of these regulators here.
The easiest is the P (proportional)-regulator, which is actually a linear amplifier. The behavior is such that when the difference between the set-value and the real value is small it will give a low output voltage, which equals the control voltage. When the difference is large, a higher control voltage will be given.
A lot of different control systems do exist. Each with their own specific characteristics and requirements. For some applications, where temperature is controlled, overshoot of the temperature cannot be allowed, e.g. when working with proteins, or when heating up a microscope objective. Then a more complicated control is used, This could be a combination of Proportional regulation, combined with an integrator and even a differentiator (to speed up the control process). These types of regulators are named Proportional Integrating regulator (PI-regulator) or Proportional Integrating Differentiating regulator (PID-regulator).
These regulators can be constructed using the basic circuits described in this chapter. So it could consist of an OPAMP amplifier, an OPAMP based differentiator and an OPAMP based integrator. The inputs of these circuits will be connected to the sensor of the system. The outputs are combined in an OPAMP summing amplifier. The output of this amplifier will control the actuator of the regulation loop.
Fig. 7.27 Principle of a control loop based on OPAMPs. The subtraction point where the set-value and measured value are subtracted is not shown (but similar to Fig. 7.1), the output of this subtractor is the input signal for this system.#
7.6. OPAMP Applications#
7.6.1. Application Example - the Photo Diode Amplifier#
Light-intensity measurements are used a lot in (bio)chemical experiments or other measurement systems. Very often a linear measurement of the intensity is necessary, as the intensity relates to e.g. the concentration of a certain molecule or enzyme. Photodiodes make good and sensitive photodetectors. The (blocking) current through the photodiode has a good linear relationship with the light-intensity.
In order to have the photo-diode in the current mode (or photoconductive mode, where the photodiode acts as a current source, and the photocurrent is proportional to the incident light), it should be in zero-bias (0 Volt drop over the diode) or even negatively biased. Negative bias will increase the size of the depletion region, which results in a lower PN-junction capacitance, which increases the bandwidth (speed) of the photo-detection. In Fig. 7.28 and Fig. 7.29 we see both situations, only difference is the potential of the anode of the photo-diode, either GND or a negative voltage.
Fig. 7.28 Photo-diode readout circuit using an OPAMP. with zero-bias,#
Fig. 7.29 Photo-diode readout circuit using an OPAMP. with negative bias.#
The OPAMP is used to convert the current into a voltage and to keep the bias-voltage over the diode constant. The cathode of the photo-diode is connected to the virtual ground point, inverting input of the amplifier. This point remains at GND level, while the anode of the diode is connected to another point with a fixed potential, GND or a negative bias.
When light hits the photodiode a reverse current will flow. This current cannot be supplied by the OPAMPs input, thus has to come from the output through the feedback resistor Rf. One side of the resistor is at GND-potential (virtual ground point), so any current flowing through the resistor will develop a voltage over the resistor (Ohm’s Law) which will result in a positive voltage at the output of the OPAMP.
Of course it is possible to use the photo-diode in photovoltaic mode (voltage mode) as well. However, the relation between light intensity and output voltage is generally less linear compared to the photocurrent. As a result, this type of circuit is often less suitable for accurate intensity measurements.
7.6.2. Analog Computing#
Nowadays digital systems are all around use. This is made possible because of the silicon chips, which allow integration of a lot of components in a small space. Before the silicon chips, the systems had to be made with electronic vacuum tubes or electromechanical relays. These systems became bulky! Building a micro-computer with these elements was possible, however it would take a whole building to build just that computer…not very practical. In that era it was more practical to solve things the analog way. It is possible to build a (mathematical) computer with analog electronics. The formulas could be converted to amplifiers (multiplication!), differentiators, integrators, adders and subtractors. By wiring these circuits a (complex) mathematical problem could “programmed” and solved. The input variables and the outputs were represented by voltages. These computers were capable of solving complex mathematical problems (or models) in a quick way. It is possible to build such a computer with OPAMP-circuits as well. Using this analog processing could be worth considering in specific situations (like high-speed control systems).
Fig. 7.30 Example of a modern analog computer, mainly used for demonstrations.
Created by Jwdietrich2, under CC BY 4.0, original file#
7.7. OPAMP Exercises#
Exercise 7.1 (Computer based temperature measurement)
A computer based system measures the temperature of its chemical reaction chamber. Inside the chamber there is a temperature sensor (type LM35). The temperature sensor gives an output voltage of 10mV/°C. The output of the sensor is 0mV at 0°C. The measurement range of the computer is 0 to 12.8Volt.
Fig. 7.31 amplification of the signal from a LM35 temperature measurement to a computer.#
a) Given that the temperature we want to measure is 40°C at its maximum. Which gain is necessary for the amplifier to fully use the measurement range of the computer? Express your answer in dB.
Tip
Convert degrees Celsius to a voltage and calculate the gain in dB.
answer a)
40 °C equals 400 mV. Voltage gain is thus 12.8V/0.4V = 32. Gain in dB: 20*log(32) = 30
b) Given that Rb is 2kΩ, calculate the value of resistor Ra, to get the gain as calculated in question a.
Tip
What type of amplifier is this (inverting or non-inverting)? From the gain, calculate Ra/Rb, and then Ra.
Numeric answer
Voltage gain = 1+ Ra/Rb = 32 Ra/Rb = 31 Ra = 31*2kΩ = 62kΩ
Exercise 7.2 (Comparator)
In the figure below a comparator is shown. It is used inside the colorimeter for conversion of the light intensity to a frequency varying signal. The maximum output voltage of the OPAMP is +11V, the minimum voltage is -11V. Ra has a value of 3kΩ, Rb has a value of 8kΩ.
Fig. 7.32 amplification of the signal from a LM35 temperature measurement to a computer.#
a) Calculate the switching-levels (both positive and negative).
Tip
Use the virtual ground point to derive the relation between \(U_{in}\) and \(U_{out}\).
answer a)
Assume the output is at -11V. In order to get the voltage at the non-inverting input above 0, apply a positive voltage at Uin. At the threshold, the non-inverting input is at 0V, meaning the voltage drop over Rb = -11V.
\(I_{Rb}\) = -11V / 8kΩ = -1.375 mA
\(I_{Ra}\) = 1.375mA, so \(V_{Ra}\) = 1.375mA * 3kΩ = 4.125V
The switching levels are symmetric, so they are at 4.125V and -4.125V.
b) Describe and sketch what is happening when the signal shown below is applied to the input of the circuit. \(U_{max}\) = 8V, \(U_{min}\) =-8V.
Fig. 7.33 Input signal varies between a negative Umin and positive Umax#
Tip
What happens at the switching levels; will Uout follow the direction of Uin, or will it be oppositely?
Numeric answer
Above 4.125V, output voltage is 11V, until it reaches -4.125V, then it switches to -11V.
Exercise 7.3 (Integrator)
The circuit shown below is an integrator. In first instance the OPAMP may be assumed to be ideal. \(R_c\) has a value of 200 kΩ, C has a value of 50 nF.
Fig. 7.34 An integrator circuit, with \(R_c\) and C.#
a) We assume the capacitor is uncharged (Uc = 0V). At t=0 we apply a voltage to the input of +4V. Make a sketch of the output voltage, starting at t=0.
b) Calculate the slope of the output voltage
Tip
Will Uout increase or decrease at t=0?
answer a)
You integrate a constant voltage, so you will get a constant slope. Due to negative feedback the slope is negative. It will stop when you reach the power supplied to the OPAMP
answer b)
slope \(U_{out}\) = int(\(U_{in}\),t)/RC ≈ 4V/(50e-9F*200e3 Ω )= 400V/s (=0.4mV/μs)
c) Assume we connect a sine-wave voltage source to the input (frequency is few hundred Hertz, amplitude 50 mV).
The signal source has a small DC offset of 20mV.
Describe what will happen when this signal source is connected to the input of the circuit. You may assume that the capacitor is uncharged at t=0s.
Tip
Analyze the influence of the sine wave plus DC offset separately, and afterwards combine
Numeric answer c)
The signal will be integrated by the integrator, but the 20 mV offset will constantly be integrated as well. On the output you will see a negative cosine superimposed on a slowly decreasing linear signal. At some point it will clip to the negative supply voltage of the OPAMP, where you will see a cosine with slightly cut off minima.
Exercise 7.4 (Temperature measurement 2)
A circuit is made to read the temperature from a sensor. A schematic diagram is shown below.
Fig. 7.35 amplification of the signal from a LM35 temperature measurement to a computer.#
The sensor gives an output voltage of 2.5 mV/°C. At 0 °C the voltage is 0 mV.
a) An amplifier is added as shown in the schematic diagram. The amplification is set, such that Uout changes with 10 mV/°C (absolute value, so either positive or negative coefficient). R2 has the value of 12 k\(\Omega\). Calculate the value of R1.
Tip
First derive the gain you need.
answer a)
This is an inverting amplifier. The output voltage will become 10 mV/°C.
The needed gain is -4x.
Gain=-R2/R1, so R1=3 k\(\Omega\)
b) What will the current flowing to R1 when the temperature of the sensor is 30 °C? You may assume the OPAMP to be ideal.
Tip
First derive the output voltage of the sensor.
Numeric answer
At 30 °C the output voltage of the sensor is 30 x 2.5 mV = 75 mV.
Resistor R1 is connected between the sensor output and a virtual ground point (inverting input of the OPAMP).
Current is \(I_l\)=\(U_{sensor}\)/\(R_1\) = 25 \(\mu\)A
Next the circuit is modified, an extra OPAMP is added. See schematic below
Fig. 7.36 amplification of the signal from a LM35 temperature measurement to a computer. With additional amplifiction with a second OPAMP and some resistors.#
c) Assume that the voltage at Uout1 changes with -20mV/°C. What will be the change per °C at Uout2 when R3 = 20kΩ and R5 = 1kΩ?
You may assume that U1 and R4 have no influence
Tip
Is OPAMP2 an inverting or non-inverting OPAMP, without the influence of U1 and R4?
Numeric answer
OPAMP U2 is connected as a summing amplifier. However, we can neglect the influence of U1 and R4, so we can regard it as an inverting amplifier.
Gain = -0.05, which means attenuation.
Change per degree Celsius: -1mV/°C
d) When U1 has a value of -3V and R4 has a value of 91kΩ. What will be the offset at Uout2 due to these two components?
Tip
The current from U1 and R4 is converted into voltage via R5.
Numeric answer
Input current = U1/R4 = -32.97 \(\mu\)A.
Contribution to Uout2 = I * R5 = 32.97 mV
Note: the temperature output of this circuit is now in Kelvin.
Exercise 7.5 (Building an OPAMP circuit)
The OPAMP U1 may be assumed to be ideal. The output voltage Uout will be within -10…+10 V. a) What kind of circuit is this? What is the drawback of this circuit? The circuit could be modified as shown below.
Fig. 7.37 Simple OPAMP circuit#
Tip
What are the characteristics of an OPAMP circuit you check first?
answer a)
The circuit has no feedback!
It will behave as a:
non-inverting comparator
When Uin <0, Uout < 0
When Uin >0, Uout > 0
Drawback: when Uin is noisy, the output will bounce when Uin is around 0.
The circuit is modified as below.
Fig. 7.38 Adapted circuit with feedback.#
b) Calculate the switching levels, draw a diagram in which you show Uin on the horizontal axis and Uout on the vertical. Describe the way this circuits works when the voltage Uin is being varied.
Tip
Notice the feedback is on the
Answer b)
The switching happens when the inverting and non-inverting inputs of the OPMAP are equal. The non-inverting input voltage is determined by the voltage division of R1 and R2. The voltages connected to the resistors are Uout and Uin.
I=Uout/R2 = +10 V/4k= 2.5 mA
Uin = -5V.
So the switching levels will be +5V and -5V
Exercise 7.6 (Photodiode readout)
The circuit below shows a system for photodiode readout
Fig. 7.40 A photodiode readout with a coax-cable and an OPAMP circuit.#
a) D1 is a photodiode, what are the names of the connections 1 and 2?
answer a)
1: cathode, 2: anode
A photodiode can be used in two ways, one way is to measure the voltage which is generated by the photodiode (similar to a solar-cell), another way is to measure the generated photodiode current.
First we will have a look at the situation when the diode behaves like a voltage source.
Connection 2 of D1 will be the positive side, connection 1 the negative side.
Given the following:
Voltage over the photodiode = 350 mV, R1 = 100 kΩ, R2 = 2 MΩ
b) Calculate the voltage of Uout
Tip
start by calculating the gain
Answer b)
The photodiode can be regarded as a voltage source. The negative side of the voltage source is connected to R1. The positive side to GND. The amplifier is an inverting amplifier.
Gain =-20x.
Uin = -350 mV, thus Uout= 7V
Next the circuit is modified, R1 is shorted, so it has a value of 0 \(\Omega\)
c) What will be the voltage drop over the photodiode?
Tip
Think about what happens around the virtual ground point.
Answer b)
When R1 is shorted, the diode basically connected directly to the inverting input. As the non-inverting input is at GND level, the inverting input is at GND level as well (no voltage difference between OPAMPs inputs). The inverting input behaves as a virtual ground point. The voltage drop over the photodiode is reduced to 0 V.
d) When the photodiode generates a photocurrent of 100nA, direction of the current is from 1 to 2. What will be the voltage at Uout?
Tip
Think about what happens around the virtual ground point.
Answer b)
There is no current flowing into the input of the OPAMP. All the diode current had to pass through R2. Direction of the current is from 1 to 2, this means the current through R2 goes from Uout to the virtual ground point.
Uout = 0.2 V.
Exercise 7.7 (Adapting voltages with an OPAMP)
You need to convert an input voltage range between 0 to 2V, to an output voltage range of 0 to -3V. For this you will use the following circuit, in which \(U_{in}\) gets converted into \(U_{out}\) with an inverting amplifier.
Fig. 7.41 OPAMP circuit, for adapting the voltage from Uin to Uout#
a) Calculate the value of Ra when you know Rb = 10 kΩ.
answer a)
The input voltage is 0…2V, the output voltage should be 0…-3V, which means a gain of -1.5x.
Gain = -Rb / Ra → -1.5 = 10k / Ra → Ra = 6.7 k Ω
Now assume that the (Uout) voltage range should be between -4.5 V and +1.5V . The amplifier circuit is modified with an offset voltage, see diagram below.
Fig. 7.42 OPAMP circuit, for adapting the voltage from Uin to Uout, with an additional Uoffset
Rb = 10kΩ, Rc = 20kΩ.#
b) Uin still varies from +2V to 0 V.
Calculate the value of Uoffset and Ra, such that the input voltage is converted to an output voltage of -4,5…+1.5V.
Tip
Uin=0V, corresponds to Uout=+1.5V.
Answer b)
When the input voltage is 0V, the output should be at +1.5V.
The resistors Rb and Rc give a gain of:
gain = -Rb / Rc = -10k / 20k = -0.5x
This means Uoffset should be -3V (-3V * -0.5 = +1.5V).
The input range of 0…2V should be mapped on a total span of +1.5 - (-4.5) = 6V. This gives a gain of -3X.
Gain = -Rb / Ra = -3 = -10k / Ra → Ra = 3.3 k Ω
Exercise 7.8 (What kind of amplifier?)
Fig. 7.43 Some sort of amplifier Ra=2k\(\Omega\), Rb= 800 \(\Omega\), Rf= 4 k\(\Omega\). Ua= 5V, Ub=-3V, Udc=±15V#
a) What is the name of the above circuit
Tip
What happens with the two voltages Ua and Ub?
answer
summing amplifier
b) Derive the value of \(U_{out}\)
Tip
What happens with the two voltages Ua and Ub?
answer
Ia = Ua/Ra = 5V /2 k\(\Omega\) = 2.5 mA Ib = Ub/Rb =-3V/ 800 \(\Omega\) = -3.75 mA
If = sum of both currents = -1.25 V
Uout = -If * Rf = 5 V
Exercise 7.9 (OPAMP with RC)
Given the circuit below. The input signal is a square wave symmetrical around 0, duty cycle = 50%, amplitude is 10 Vpp, period = 1ms, R = 10 kΩ, C = 100nF
Fig. 7.44 OPAMP circuit, with feedback Capacitor.#
a) Derive the numerical values for the voltage over the capacitor
Tip
treat the capacitance as a (complex) impedance.
answer
The charge current through the capacitor is: Ic = Uin/R = 5 / 10k = 0.5mA
The voltage change over the capacitor is: dU = (I * dt) / C = 2.5V
b) Explain how the circuit works, and make an accurate drawing (showing the proper amplitude!) of the output signal, starting t=0s, when the waveform starts
Tip
When Uin is positive, will Uout increase or decrease?
Answer b)
Fig. 7.45 When Uin is positive, Uout decreases. When Uin is negative, Uout increases.#
Exercise 7.10 (OPAMP with RC 2)
Given the following OPAMP circuit
Fig. 7.46 OPAMP circuit, with feedback Capacitor.
Given that R1 = 250 kOhm, C1 = 100 nF.#
a) Assume the voltage of \(U_{IN}\) is +2V, the OPAMP is ideal, OPAMP power supply is +/-10 V and the capacitor holds no charge on t = 0ms.
What will be the voltage on Uo on t=10ms?
Tip
What will the voltage over the capacitor become?
answer
The voltage from the source will be converted to a constant current, linearly charging the capacitor. The charging current is: Icharge = -Uin / R1 = -2V / 250k = 8uA. Charge on the capacitor is: Q = C * U = I * t => Uc = (It)/C = (8u10m)/100n = -0.8V
Exercise 7.11 (comparator)
A comparator is made, give the circuit diagram below.
Fig. 7.47 Comparator circuit with hysteresis#
a) Given that the OPAMP’s maximum output voltage is +12V and the minimum -12V. Resistor R1 = 6 kOhm, R2 = 18 kOhm. What will be the switching thresholds for this comparator?
Tip
What is the voltage at the OPAMP’s input when switching will occur?
answer
Switching threshold positive: Uth+ = Uout * (R1 / (R1+R2)) = +12 (6k / (6k+18k)) = +3V Switching threshold negative: Uth- = -Uout * (R1 / (R1+R2)) = -12 (6k / (6k+18k)) = -3V
b) Now assume, the switching thresholds are +/- 4.5V (not the right answer to the previous question!). When the input
voltage is 2.5V, what will be the output voltage?
I) The input voltage is within the linear region, thus it will be amplified 4x, thus 10 V.
II) The output voltage will be +12V.
III) The output voltage will be -12V.
IV) This cannot be said, it could either be +12V or -12V
Tip
Good luck. Not only think of the current input, but also the previous state.
answer
Correct answer IV
Exercise 7.12 (Summing amplifier)
Fig. 7.48 Summing amplifier with two voltage inputs.
R1=5k\(\Omega\), R2= 10 k\(\Omega\), Rf= 25 k\(\Omega\). U1= 0.5V, U2=1 V#
a) Derive the value for Uout
Tip
Start by calculating the currents I1 and I2
answer
I1 = U1/R1 = 0.5V /5 k\(\Omega\) = 0.1 mA
I2 = U2/R2 = 1V/ 10 k\(\Omega\) = 0.1 mA
If =-0.2 mA (mind the arrow)
Uout = If * Rf = -5 V
Exercise 7.13 (Complex transfer function)
Fig. 7.49 OPAMP circuit with complex transfer; R1=1 k\(\Omega\), R2=9 k\(\Omega\), C1=10 \(\mu\)F#
a) Derive the asymptotic values for the transfer function \( A(\omega) = \frac{U_{out}}{U_{in}}\)
Tip
What is the complex impedance for C1 at \(\omega\) is zero or infinity?
answer a)
\(\omega = \infty\) : ZC=0 → \(\frac{U_{out}}{U_{in}} =\frac{R1+R2}{R1}\)= 10 (20 dB)
\(\omega\) = 0 : ZC=\(\infty\) → \(\frac{U_{out}}{U_{in}} =\frac{R1+R2}{R1}\) =1 (0 dB)
b) Sketch bode-diagram
Tip
If you know what happens at the extremes, then how is the transition taking place?
answer a)
The graph will look like:
\(\omega\) < \(\omega_1\) : \( A(\omega) \) = 0
\(\omega\) > \(\omega_2\) : \( A(\omega) \) = 20 dB
transition between \(\omega_1\) and \(\omega_2\)
c) Calculate the corner frequencies where asymptotes change?
Tip
First derive the exact complex transfer function.
Then find the frequency for which the transfer function is 3dB higher or lower than the extreme values.
answer c)
The graph will look like:
\( A(\omega)\) = \(\frac{Z_1+Z_2}{Z_1}\)
= \(\frac{R_1 + \frac{1}{j\omega C_1}+R_2} {R_1 + \frac{1}{j\omega C_1}} \)
= \(\frac{1 + j\omega C_1 (R_1+R_2)}{1 + j\omega C_1 R_1} \)
\(\omega_1 = \frac{1}{C_1 (R_1+R_2)} \) (=1.6 Hz) \(\omega_2 = \frac{1}{C_1 R_1}\) (=16 Hz)
Exercise 7.14 (Inverting comparator)
Fig. 7.50 Comparator circuit, with two voltage sources.
\(U_{sup}\)=10 V; \(R_1\)=1 k\(\Omega\); \(R_2\)=9 k\(\Omega\)#
a) Evaluate switching points when \(U_{ref}\)=0V
Tip
Start with \(U_{out}\)= \(U_{sup}\)
answer a)
\(U_{+}= U_{ref} + \frac{R_1}{R_1+R_2}(\pm U_{out}-U{ref}) \)
If \(U_{out} = -U_{sup}\), then \(V_{+}\)=- 1V
If \(U_{out} = +U_{sup}\), then \(V_{+}\)=+ 1V
b) Evaluate switching point when \(U_{ref}\)= +2V
Tip
Use the derived \(U_+\) once more
answer b)
\(U_{+}= U_{ref} + \frac{R_1}{R_1+R_2}(\pm U_{out}-U{ref}) \)
If \(U_{out} = -U_{sup}\), then \(V_{+}\)=+ 0.8V
If \(U_{out} = +U_{sup}\), then \(V_{+}\)=+ 2.8V