Op-Amps are so popular because they are so flexible. There is no better method of demonstrating this than to show you as many operational amplifier circuits as possible.
Last month we revisited the basics of op-amps and how they work.In this issue we will be looking at Comparators, Inverting and Non-inverting Buffers, Inverting and Non-inverting Amplifiers, Differential Amplifiers, Instrument Amplifiers, Summing and Difference Amplifiers, and Mixers. Between them, these circuits are the essential basis of most of the analog circuits you will come across.
THE COMPARATOR
Without any form of feedback, the op-amp acts as a switch providing a high voltage output when the non-inverting input voltage is greater than the inverting input voltage, and therefore a low or negative voltage output when the inverting input voltage is greater than the non-inverting input voltage.
Note: the ‘+’ and ‘–’ symbols on the op-amp symbol indicate non-inverting and inverting inputs respectively, and NOT the polarity of the inputs as is a common misunderstanding.
Any number of transducers can be used as an input as long as the transducer makes a voltage or resistance change that can be level matched to either of the op-amp inputs. The remaining input would typically have a voltage divider to set the reference value as shown in the figure below. In precision circuits the reference may be voltage regulated.
The first circuit [1a] shows a non-inverting triggered comparator, so the inverting input, pin 2, is set by a voltage divider circuit to half the rail voltage, or whatever value is required as a reference value. The voltage divider may even be a potentiometer, or a divider chain with a potentiometer in the centre between two fixed resistors.
Assuming a 9V rail, an equal value divider chain gives us a 4.5V reference. When the voltage on the transducer on the non-inverting pin 3 increases above 4.5 volts, the output of the op-amp will go high, perhaps driving an LED or a digital pin on your Arduino or Raspberry Pi via some level limiting or matching circuit.
The second circuit [1B] shows the opposite switching action, with a rising voltage on the transducer causing the inverting voltage on pin 2 to rise above the reference voltage on pin 3, resulting in the output going low.
Having two options allows the maker to interface the circuits that follow with both possible switching actions. In fact, especially at breadboard stage, changing your mind is as simple as swapping the jumpers between pins 2 and 3.
We used an LM339 four comparator IC in the Logic Probe project (Issue #004) to show both options put to good use, however we should point out that the LM339 is a specialised op-amp comparator, with a single transistor output, called an Open Collector output, a variation on the normal µA741 or LM741 type op-amp
NOISE REDUCTION
The problem with comparators is they can be triggered by noise causing the output to be constantly flashing on and off. This can also be caused by a slightly noisy input going slightly above and below the intended trigger voltage, but fluctuating about that value.
One cure is to reduce the noise by adding a small value capacitor to the input circuit. Typically, a 1nF to 1µF capacitor would be appropriate, however, the value depends on the operating conditions of the circuit, so no ‘one-size-fits-all’ solution can be offered. In long term applications such as filling your swimming pool, a larger capacitor might be suitable.
Fluctuating power supply values can also introduce ‘noise switching’ and may require a regulated or stabilised reference voltage.
This may be a simple capacitor across one side of the divider chain. Which side, positive or negative, depends on how the circuit as a whole is started up. You wouldn’t want the output to turn on unexpectedly as start-up, and a capacitor can be used as a method of allowing the circuit to set up before the comparator can switch on, like the reset capacitor in older computer circuits.
SCHMITT TRIGGER
A slowly increasing/decreasing input can still cause a ‘stutter’ in the output, which needs to be avoided if the circuit controls the running of a motor, such as a large pump. The electric motor can burn out from multiple starts and stops over a short period, and much larger motors generate so much heat in the starting circuits that they require a cool-off period between starts. The answer to this problem is known as the Schmitt Trigger. If the output swings from negative to positive, or very close to each of the rail voltages, then a predictable change to the non-inverting voltage can be achieved using a simple feedback circuit [2].
Here the output, pin 6, is fed back to the non-inverting input, pin 3, via a voltage divider. This is called positive feedback. Let us assume that the divider has a 9:1 ratio of R6:R5. For simplicity we’ll assume that the supply is +/–10V and therefore ground is 0V. We will also assume that the op-amp switches the output from rail to rail, i.e. +/–10V.
The feedback will cause 1/10th of the output voltage to appear on pin 3, thus setting pin 3 to 1V when the output is high and -1V when the output is low. This means that the transducer voltage needs to rise above 1V to set the output low (it is an inverting switch) but has to go below -1V to set the output high.
That is the function of any device known as a Schmitt switch, and the action is called hysteresis, meaning to lag behind. Using these principles, can you devise a circuit to switch some output based on a changing input voltage? Perhaps a thermostat?
In this circuit, if (Vpin3 > Vpin2) Vout = high else if (Vpin3 < Vpin2) Vout = low
BUFFER AMPLIFIER
Some circuits require a high impedance input in order to avoid loading the signal they are sampling, and a low impedance output to deliver a true copy of that signal to the next stage, without any amplification of the signal. To put it another way, we want the same voltage signal as the input, without loading the signal source, but with more current for the following circuits. We call that a Buffer Amplifier, but an older term is the Voltage Follower [3].
The op-amp is perfect as a buffer because it has a combination of high input impedance, low output impedance, a very high current gain, and the ability to limit the voltage gain to 1:1 by simply connecting the output to the inverting input, i.e. pin 6 to pin 2.
Now whatever signal is applied to the non-inverting pin, pin 3, will appear at the output pin; pin 6, with one important limitation; the input frequency must be less than the unity gain bandwidth, so up to 1MHz for the µA741.
Being a unity gain amplifier means that everything that appears at the high impedance input, everything below 1MHz that is, will be delivered to the output of the op-amp at the same amplitude, but with a much lower impedance, resulting in greater current strength of the signal. The noise at the input and even the AM RF energy that is about will also be amplified, current wise.
An audio "Fuzzbox" I once built for my electric guitar would often become an unwanted Radio Receiver, picking up stray signals from the local radio station. The cure would be to place a capacitor across the guitar input, but somehow we never found it too much of a concern. We will discuss filtering the feedback link for instrumentation in the next issue.
In this circuit, Vout = Vin
INVERTER – INVERTING BUFFER
Another kind of buffer is the inverting buffer, with the same requirements as for the non-inverting buffer we have just looked at, but with a negative copy of the sampled signal.
I trust you realise that you need to supply the signal to the high impedance inverting input, at which point you will notice that you have also connected the signal to the low impedance output. Alarm bells should be ringing, as a high impedance in parallel with a low impedance always results in an even lower impedance, and a strong signal being injected into the signal being measured or sampled. The high input impedance is lost as soon as the input is connected to any low impedances.
The solution is to add an input impedance to both inputs with a value equal to the required input impedance. While we could use a 1MΩ resistor, most circuits would be happy with at least 10kΩ, some with just 1kΩ. The circuit shown [4] uses a 100kΩ, mainly to tell you that we can use larger resistor values compared to older transistor circuits.
The circuit shows 100kΩ in series between the signal source and the inverting pin; pin 2. Pin 3 should also have the same value resistance, 100kΩ, in series with the non-inverting input in order to balance the input pins and the internal amplifier inputs.
The output could still be connected directly to the inverting input, as the signal should not be loaded enough to cause issues in many cases, but to be absolutely accurate, well as accurate as we can manage, the feedback should also have the same value resistance, 100kΩ in this circuit. Any current in the input resistor that might cause a voltage drop, will flow to the output via an exact same value, causing an exact same voltage drop. The inverted output will equal the sampled signal, but of opposite polarity, so the mid-point, between the two 100kΩ resistors will be zero.
The Inverting Buffer Amplifier can be looked at as a see-saw, in that the input signal and the output signal are on either end of a see-saw, and as the centre does not move, when one goes up the other comes down, an equal distance or value. It is still better engineering to use a non-inverting buffer followed by a 1:1 inverter.
In this circuit, Vout = -(Vin)
INVERTING AMPLIFIER
What we have just done is create an Inverting Amplifier, albeit with a gain of one. If we want the gain to be more than one, all we need to do is change the feedback resistor, or the input resistors. A gain of ten simply requires a ratio of 10:1 with the feedback resistor being 10 times the input resistor. Let’s keep the 100kΩ feedback resistor between pins 6 and 2, but replace the input resistors with 10kΩ [5].
An input of 1V will cause an output of 10V, providing the rail voltage is above 10V, plus the overhead voltage required by the op-amp.
Although the non-inverting input could be directly grounded, for a dual power supply, the input resistor of the non-inverting input should match the input impedance of the inverting input.
For a 0V signal in, the output would be zero or equal to ground. The feedback resistor would therefore be effectively in parallel with the input resistor, and the non-inverting input resistor should be equal to Rf//Rin, = 100kΩ//10kΩ. That equates to (Rf x Rin)/(Rf + Rin) = 1000MΩ/110kΩ = 100kΩ/11 ~ 9kΩ (9090Ω).
The need for the impedance match on the non-inverting input, is that the current in the inverting input is exactly equal and of opposite polarity to the current of the non-inverting input. Therefore the internal circuit bias will only be correctly balanced when the input impedances are the same. While many circuits will work with a simple grounded non-inverting input, the amplified signal may be affected by having the non-inverted input clamped to ground. We can argue it only affects HiFi systems, and Analog Computer results, but it is a matter of one extra resistor making the circuit better!
The gain calculation can be explained by looking at Rf and Rin as a lever, perhaps at each end of a See-Saw. As the input goes down, the output goes up, with a small input causing a larger output due to the leverage, normally considered as mechanical advantage, but in this case, an electronic advantage supplied by the op-amp.
As the input pin acts as the fulcrum, the outputs can be calculated by the rules of mechanical leverage, Vout/Vin = Rout/Rin, with V substituted for weight (force) and R substituted for length (of the lever arm).
In this circuit, Vout = -(Vin(Rf/R1))
NON-INVERTING AMPLIFIER
The input will now be to pin 3, the non-inverting input, via a 10kΩ input resistor as shown in the figure below. The resistor we previously called Rin, should now be renamed as it is no longer an input resistor, and Rin should refer to the resistor which is now between the input and pin 3. This can get confusing, and already is no doubt. Some books simply number the resistors but I find I am constantly referring to the circuit to remember what “R345” does! So let us call the input to the inverting input ‘Rinv’, and the input to the non-inverting input ‘Rniv’. Rinv will be connected between pin 2 and ground and Rniv between the input and pin 3 [6].
If we want a non-inverting amplifier with a gain of ten, and the formula becomes a little different. Let’s keep Rf = 100kΩ as the feedback resistor between pins 6 and 2. The inverting input resistor is now connected to ground so the voltage on pin 2 will not be zero volts as it was for the inverting amplifier. The output will cause the resistor combination of Rf and Rinv to become a voltage divider, and we want the value at pin 2 to be 1/10th of Vout.
The gain formula then becomes: G = (Rf + Rinv)/Rinv, or simplified G = 1+Rf/Rinv. We want a gain of 10, and are using the 100kΩ resistor for Rf, so the formula needs to be transposed for Rinv;
- 10 = 1+100k/Rinv
- 10-1 = 100k/Rinv
- so Rinv = 100k/9 = 11.111kΩ
You might see why it is often preferable to use an inverting buffer and then a 10x inverting amplifier instead of attempting to accurately amplify 10:1 with a non-inverting amplifier.
In this circuit, Vout = Vin(1+Rf/Rinv)
DIFFERENTIAL AMPLIFIER
The operational amplifier has two inputs, yet so far we have used either one or the other. This is partly for simplicity in explaining gain calculations, and because many applications only need one input.
The differential amplifier uses both inputs forming an amplifier that takes its source from a non-grounded device, or a device with two outputs independent of ground. A microphone element for example may have two connections, both of which deliver an audio signal which is true ac, having no relationship to ground. Of course, the signals may be delivered to the amplifier by a shielded two-wire cable common in audio systems. The reason is to avoid as much ambient noise as possible and to use the CMRR (Common Mode Rejection Ratio) feature of op-amps to maximum advantage.
The circuit shown [7] is a differential amplifier shown with a microphone element and a shielded cable as a typical application. The gain is 10:1, which can be derived from the previous two gain calculations using any of several mathematical methods, all of which are a bit tedious in the space we have.
Note that both input resistors, labelled as Rin, are the same value. Rf and Rg are also of equal value. An op-amp effectively keeps the voltage at both inputs the same but the current determines the output. Therefore, without the maths to complicate matters, the gain results from (Rf+Rg)/(Rin+Rin). Rf = Rg so G = 2Rf/2Rin = Rf/Rin. The input voltage is the voltage found between Vinv and Vniv.
To continue the leverage analogy, the differential amplifier acts like a pair of scissors, except; although some op-amps have dual polarity outputs, normally there is only one output, as if one blade of the scissors is held against the cutting table!
In this circuit, Vout = Vniv-Vinv(Rf/Rin)
INSTRUMENT AMPLIFIER
An instrument amplifier is a differential amp with a pair of buffered inputs that allow the amplifier to use the full input impedance of the chosen op-amps. For very high input impedances, FET input op-amps may be used, such as the TL071, or as a quad op-amp package, the TL074. The Field-effect transistors (FET) built into these op-amps have a very high impedance, making them ideal for these applications. We will explain FETs in much further detail at the end of the article.
Analogue Devices and other manufacturers also make special purpose instrument amplifiers in a package requiring only one external resistor as the gain setting resistor. The resistor is marked as Rg in the diagram [8].
The two non-inverting amplifiers share a common ground resistor which is not actually grounded, so that resistor, Rg, is half of the gain resistor of each buffer amplifier. The gain of the buffer pair being found from the formula G = 1+ 2R1/Rg, using the component labels from the diagram.
The buffers feed the differential amplifier, which can also have gain that is determined as for the differential amplifier above from G = Rf/Rin, or R3/R2 using the component labels in this diagram.
Together, the total gain of the instrument amplifier is the product of the gain of each stage. Therefore G = (1+2R1/Rg) x (R3/R2).
In this circuit, Vout = V1-V2(1+2R1/Rg)(Rf/Rin)
Note: For the highest frequency response, gain should be equal in every stage. The amplifier with the highest gain will have the lowest bandwidth. The gain required by each of these two stages will be the square root of the total required gain.
SUMMING AMPLIFIER
Up to this point, the amplifiers have used a single input to either the inverting input, or the non-inverting input, or in the differential amplifier, the difference between two signals which was really both polarities of the same signal.
However, op-amps are also meant to be used for mathematical functions, including adding and subtracting signals. A common application of a summing circuit is an audio mixer, perhaps mixing the input of a microphone, a guitar and a beat box together to result in maybe one person’s idea of karaoke. Each input may be tailored to the source device. The microphone might require a 600Ω input impedance, or up to 50kΩ. The guitar input is often also 600-700Ω but can be 15kOhms (Humbucker), and the Beat Box may be 1Vp-p at 600Ω but best checked first! With suitable preamplifier stages, those three sources can be mixed using a simple summing circuit [9].
Let us base the summing circuit on an inverting amplifier, using the circuit above. Look first at the feedback resistor and any one of the input resistors. Each one can have exactly the same gain, or the gain can be different for each input based on the expected signal from each. Alternatively, each input can come from the wiper terminal of a potentiometer, so each input can be adjusted in use if necessary.
Also, there is no limit to the number of inputs other than the supply of resistors and space to place them. A 32 Channel mixer table can feed all inputs to one mixing amp.
In this circuit, Vout = -(V1(Rf/R1)+V2(Rf/R2)+V3(Rf/R3))
SUMMING AND DIFFERENCE AMPLIFIER
If any of the signals need to be subtracted, there are two options. One is to invert the signal before it gets to the summing amplifier, and the other is to feed the output of the summing amp which is already inverted, to a second inverter to revert it back to a non-inverted signal, and sum the difference signals at the input of the second inverter.
The circuit [10] is based on an LM358 which has two op-amps in one package. The combined gain of the circuit is 10:1 set by the relationship between the three values labelled as ‘Rf’, which should always be the same value, and the value of each input resistor. Amplification for a single input can be adjusted by changing any of R1, R2, R3, R4, or for the whole circuit by changing all three values of Rf to another same value.
In this circuit, Vout = (V1(Rf/R1)+V2(Rf/R2)-V3(Rf/R3)-V4(Rf/R4))
REALITY CHECK
Operational Amplifiers have a lot more secrets to come, but already, these basic amplifier configurations allow a great many projects to be designed and built by you, our readers.
Now you have the building blocks to most analog applications, and hopefully you will be building circuits with them. Our plans for the next issue include Active Filters, Shapers and Clippers, Integrating and Differentiating Amplifiers, and perhaps PID Amplifiers and others. Add a range of Oscillators, Multi-Vibrators, Signal Shapers, Function Generators etc. to the list and we have a quite full agenda over the next several issues.
What is a FET?
We have mentioned the FET Op-Amp enough times for the question to arise "What is a FET?". The FET, or more precisely JFET, is a "Junction Field Effect Transistor". Although proposed around 1927, it wasn't until the transistor was invented in 1947 that the necessary materials became available to make a FET that worked. Then the patent for the transistor delayed the technology from being made public for another 20 years.
The JFET was simply known as the FET as there were no other types of FET transistor at the time. FETs work more like a Thermionic Electron Valve (Tube) than a transistor as the electron flow from the negative electrode, the Cathode in a valve or the 'Source' in a FET, passes through a 'N' channel to the Anode (in valve terms) or the 'Drain' in FET terminology.
The Drain-Source is a channel of the same semiconductor material (N-type in an N-channel FET) passing through a region of the opposite material (P-type) called the 'Gate'. Applying a voltage to a Valve Grid, or the FET 'Gate' turns off the current flow in the channel.
The PN junction is reverse biased, and therefore intrinsic (an insulator), so the Gate is effectively insulated from the Drain-Source, giving the FET a very high input impedance.
It is the high input impedance that attracts us to FET input Op-Amps, providing us with extremely good buffer amplifiers and sensitive instrumentation and RF amplifiers.