Does a symbol help or hinder our thinking about a design?
Symbols are important, but what if the symbol can mean several things?
This can lead to problems, as we shall see. In the analog world, a triangle can represent an op amp, a comparator, or an instrumentation amplifier. You could force one of them to do the function of one of the others, but system performance would not be optimum. Let’s look at their differences and what to be cautious of so we can design around them if possible. As we shall see, there are some cases when you don’t even want to try to design with the wrong type of part.
Looking at Figure 1, which triangle is the op amp? Which triangle is the comparator? And which triangle is the instrumentation amplifier? The answer is:
They all are!
So, what’s the difference and why do we care? Looking at Table 1, we can see that there are some big differences in several characteristics, but what do they mean at the circuit and system level?
|Open-Loop Gain||5k to 10 million||3k to 50k||Fixed 0.2 to 10k|
|Closed-Loop Gain||Usually < 10,000||Fixed 0.2 to 10k|
|Important Specs||VOS, GBW/PM||Prop delay||CMRR|
|Programming||R or C||None||R, SPI, jumpers|
Let’s see how you can get into trouble …
An op amp has a huge gain. We were told in engineering school to start the analysis with the difference between the two inputs equal to zero. But in real life, this can’t be true. If the open-loop gain is 1 million, then to get 5 V on the output, you would have to have 5 μV on the input. For a usable circuit, we need to apply feedback, so when the output tries to go too high, a control signal is fed back to the input, counteracting the original stimulus—for example, negative feedback. When used as a comparator, with no feedback, the output will slam against one rail or the other; with positive feedback, it will be driven farther in the same direction. So, op amps need negative feedback. In fact, when some op amps are used as comparators with no feedback, the supply current can be 5 to 10 times higher than the max on the data sheet.1
For a comparator, however, positive feedback is exactly what we need. With no feedback, if one input to a comparator slowly crosses the level of the other input, the output will slowly start to change. If there is noise in the system, such as ground bounce, the output may reverse, which is certainly undesirable in a control system. But then it starts changing back, resulting in oscillatory behavior, sometimes called chatter (see Figure 5 in MT-0832). The benefits of adding positive feedback, also called hysteresis, are well covered in the article “Curing Comparator Instability with Hysteresis” by Reza Moghimi.3
For an instrumentation amplifier, the feedback is already internal, so adding feedback just produces an inaccurate gain. A typical way to build an instrumentation amplifier with op amps is shown in Figure 2.
Note: there is feedback around each individual op amp. Let’s begin by using the standard negative feedback diagram (see Figure 3) with the in-amp being G, with a desired gain of 10, implying a feedback factor of 0.1. Next, choose an in-amp fixed gain of 100. Using Equation 1, the actual closed-loop gain will be 9.09, almost a 10% error. So, using an in-amp triangle as an op amp and putting feedback around it doesn’t make sense.
For an op amp, we really need negative feedback; for a comparator, we really need positive feedback; and for an in-amp, we don’t need any feedback.
Open-Loop and Closed-Loop Gain
For op amps, looking at Equation 1, the higher the open-loop gain (AVOL), the more accurate the closed-loop gain will be. Most op amps have open-loop gain between 100,000 and 10 million, but some of the older high speed op amps might be as low as 3000. As shown earlier, the higher the open-loop gain, the lower the closed-loop gain error.
For a comparator, if the logic swing on the output is 3 V, and you want a 1 mV threshold, then the minimum gain needs to be 3000. Higher gain will give you a smaller window of uncertainty, but if the gain is too high, microvolts of noise will trigger the comparator.
For an instrumentation amplifier, the concept of open-loop gain doesn’t really apply.
Capacitors are often added to circuits to limit the bandwidth. Looking at Figure 4, at first glance it seems that R1 and C1 form a low-pass filter. This does not work and can lead to oscillations. The feedback factor for an inverting amplifier is R2/R1, but in Figure 4, the feedback factor is R2/(R1 + Xc). As the frequency increases, the feedback factor increases, so the noise gain is going up at +20 dB/decade, while the op amp open-loop gain is going down at –20 dB/decade. They cross at 40 dB, which, according to control system theory, guarantees oscillation. The correct way to restrict the bandwidth of the circuit is to put the capacitor across R2.
Comparators usually don’t have a negative feedback network, so the simple R and C in front of the comparator in Figure 5 forming a low-pass filter works well. RHYS should be much larger than R7, and the two divide the output swing to provide a small amount of positive feedback (hysteresis). If the comparator has built-in hysteresis, such as the LTC6752 or the ADCMP391, then R7 and RHYS are not used.
For instrumentation amplifiers, a cap across the inputs is quite acceptable as shown by C4 in Figure 6. The figure in Chapter 5 of the Analog Devices instrumentation guide4 shows a good thing to do every time you use an instrumentation amplifier. If you lay out the printed circuit board with the appropriate traces and pads to allow adding the two resistors and three capacitors, you can start with 0 Ω resistors and no capacitors, and measure the system performance. By adjusting the values of the five components, you can set the common-mode roll-off and the normal-mode roll-off independently (see the guide for details).
An op amp or an instrumentation amplifier will have an output that swings from close to one rail and to the other. Depending on whether the output stage uses common emitter or common source configurations, it may get within 25 mV to 200 mV of either rail. This would be considered a rail-to-rail output. If the op amp is powered by +15 V and –15 V, this is inconvenient to interface to digital circuitry. One poor solution that has been tried is to put diode clamps on the output to protect the digital input from damage. Instead, the op amp current goes sky high and the op amp gets damaged. There are more elaborate ways to interface an op amp to digital logic, but why bother? Just use a comparator.
Comparators can have a CMOS totem-pole output, or an NPN or NMOS open-collector or open-drain output. Although the open-collector or open-drain output requires a pull-up resistor, resulting in unequal rise and fall times, it does offer the advantage of operating the comparator on one voltage, say 5 V, and interfacing to logic operating on a different voltage, such as 3.3 V.
For an op amp, we need a gain bandwidth higher than the highest signal frequency to keep the closed-loop error low. Looking at Equation 1, we can see where the rule of gain bandwidth should be 10 to 100 times the highest signal frequency. From Equation 1, as discussed earlier, note that AVOL is a function of frequency and will affect the closed-loop accuracy. Phase margin is also important and will vary with capacitive load, so the spec table should clearly state the test conditions. For dc accuracy, the offset voltage should be low. For a trimmed bipolar op amp, 25 μV to 100 μV is good; for a FET input op amp, 200 μV to 500 μV is good. Auto-zero/chopper/zero-drift op amps are almost always below 20 μV maximum, and this is over temperature. For examples, see some typical op amp data sheets, such as the OP27, AD8610, or ADA4522.
Propagation delay is the key specification for comparators. Contrary to op amps that get slower when overdriven, comparators will get faster when you overdrive them. Spec tables will sometimes have a propagation delay with a small amount of overdrive, say 5 mV, and a different delay with a larger overdrive of 50 mV or even 100 mV.
The number one spec for instrumentation amplifiers is the common-mode rejection ratio (CMRR). You are trying to extract a very small differential signal riding on top of a large common-mode voltage. Like many specs, this varies with frequency and sometimes a dc CMRR or a CMRR at a very low frequency is listed. A graph of CMRR vs. frequency is usually provided. This would be important, for example, if you were trying to sense current in an H-bridge motor drive as shown in Figure 7.
This is probably the most difficult application for an instrumentation amplifier, because the common-mode voltage goes from near one rail to close to the other, and the current reverses quickly. Gain bandwidth and slew rate are both important.
Programming in this sense doesn’t mean writing code; it means configuring the part to meet the requirements of your system (although some in-amps do have traditional software programming features with SPI ports and registers).
For op amps, we configure the part with negative feedback. This can be a purely resistive element, but usually a resistor is used with a capacitor in parallel to restrict the bandwidth. This helps the signal-to-noise ratio because noise will be integrated across the entire range, even if we are only using a part of it. You can also use capacitors by themselves and get an integrator or a differentiator.
Comparators should always have a bit of positive feedback to ensure that once the input forces the output to move, the output reinforces the move (see Figure 4 and Figure 5). Pictures and calculations are included in MT-083. Some comparators do have internal hysteresis, but you can usually add more if desired. Some comparators with internal hysteresis have a pin to add a resistor to slightly change the amount.
It is possible to use an op amp as a comparator, but it’s not ideal, and there are several considerations. You must be a good analoger to get away with it in a production environment. Some considerations are in MT-083 and many articles, pro and con, have been written. See the references if you like to live dangerously.
Comparators are almost always programmed with resistors. You can add a high value resistor to give a little bit of positive feedback, and it is also possible to use a capacitor for ac feedback to avoid adding dc hysteresis. Some comparators have built-in hysteresis, but this can be increased, again, by adding a small amount of positive feedback.
Subtle things happen when trying to use an op amp as a comparator. Quite a few of the low noise bipolar op amps have anti-parallel diodes between the inputs. The input common-mode range for most comparators encompasses 80% of the total range or more. But some low noise, bipolar op amps have one or two diodes in series between the inputs. This is to keep the input stage from Zenering one of the emitter base junctions, which would degrade the noise performance over time.
So a 5 V op amp used as a comparator with a threshold level of 3 V for a power-good indicator in a 3.3 V system would have a problem with 3 V on one input and 0 V on the other, as these diodes limit the maximum differential voltage allowed across the op amp inputs.
For many applications, the choice of op amp will depend on whether you are focused on dc accuracy, ac accuracy, input offset voltage, gain bandwidth, or supply voltage. In 2020, you have over 700 to choose from. The key parameters for comparators are usually propagation delay and supply voltage. The choice is a little easier, with 122 parts to choose from. The main criterion for instrumentation amplifiers is CMRR as a function of frequency, but near dc, offset voltage, and gain accuracy are also important. Because in-amps are a more specialized part, there are “only” 63 choices.
Choosing the right part will result in a trouble-free, production-worthy design for years to come.
1 Harry Holt. “The Maximum Supply Current that Wasn’t.” Analog Devices, Inc. November 2011.
2 MT-083 Tutorial: “Comparators.” Analog Devices, Inc. 2009.
3 Reza Moghimi. “Curing Comparator Instability with Hysteresis.” Analog Dialogue, Vol. 34, No. 7, November 2000.
4 A Designer's Guide to Instrumentation Amplifiers, 3rd edition. Analog Devices, Inc. 2006.