Volume 37 April 2003
Ask The Applications Engineer31 AMPLIFIERS AS COMPARATORS? Q. What is a comparator? How does it differ from an op amp?
A. The basic function of a high-gain comparator is to determine whether an input voltage is higher or lower than a reference voltageand to present that decision as one of two voltage levels, established by the outputs limiting values. Comparators have a variety of uses, including: polarity identification, In principle, any high-gain amplifier can be used to perform this simple decision. But the devil is in the details. So there are some basic differences between devices designed as op amps and devices designed to be comparators. For example, for use with digital circuitry, many comparators have latched outputs, and all are designed to have output levels compatible with digital voltage-level specifications. There are some more differences of importance to designersthey will be discussed here. Q. What are some circumstances where one can go either way? A. Amplifiers should be considered for use as comparators in applications where low offset and drift, and low bias current, are neededcombined with low cost. On the other hand, there are many designs where an amplifier could not be considered as a comparator because of its lengthy recovery time from output saturation, its long propagation delay, and the inconvenience of making its output compatible with digital logic. Additionally, dynamic stability is a concern. However, there are cost and performance benefits in using amplifiers as comparatorsif their similarities and differences are clearly understood, and the application can tolerate the generally slower speed of amplifiers. No one can claim that an amplifier will serve as a drop-in replacement for a comparator in all casesbut for slow-speed situations requiring highly precise comparison, the performance of some newer amplifiers cannot be matched by that of comparators having greater noise and offset. In some applications with slowly changing inputs, noise will cause comparator outputs to slew rapidly back and forth (see Curing comparator instability with hysteresis, Analog Dialogue, Volume 34, 2000). In addition, there can be savings in cost or valuable printed-circuit-board (PCB) area in applications where a dual op amp could be used instead of an op amp and a comparatoror in a design where three of the four amplifiers in a quad package are already committed, and two dc or slowly varying signals must be compared. Q. Can that fourth amplifier be used as a comparator? A. This is a question that many system designers are asking us these days. It would pointless to buy a quad op amp, use only three channels, and then buy a separate comparatorif indeed that amplifier could be used in a simple way for the comparison function. Be clear, though, that an amplifier cant be used as a comparator interchangeably in all cases. For example, if the application requires comparison of signals in less than a microsecond, adding a comparator is probably the only way to go. But if you understand the internal architectural differences between an amplifier and a comparator, and how these differences affect the performance of these ICs in applications, you may be able to obtain the inherent efficiency of using a single chip. In these pages, we will describe the parametric differences between these two branches of IC amplifier technology and provide useful hints for using an amplifier as a comparator. Q. So how do amplifiers and comparators differ? A. Overall, the operational amplifier (op amp) is optimized to provide accuracy and stability (both dc and dynamic) for a specified linear range of output values in precision closed-loop (feedback) circuits. However, when an open-loop amplifier is used as a comparator, with its outputs swinging between their limits, its internal compensation capacitanceused to provide dynamic stabilitycauses the output to be slow to come out of saturation and slew through its output range. Comparators, on the other hand, are generally designed to operate open loop, with outputs slewing between specified upper and lower voltage limits in response to the sign of the net difference between the two inputs. Since they do not require the op amps compensation capacitors, they can be quite fast. If the input voltage to a comparator is more positive than the reference voltage plus the offsetVOS (with zero reference, its just the offset) plus the required overdrive (due to limited gain and output nonlinearity), a voltage corresponding to logic 1 appears at the output. The output will be at logic 0 when the input is less than VOS and the required overdrive. In effect, a comparator can be thought of as a one-bit analog-to-digital converter.
There are different ways of specifying a comparator and an amplifier. As an example, in an amplifier, the offset voltage is the voltage that must be applied to the input to drive the output to a specified mid-range value corresponding to ideal zero input. In a comparator this definition is modified to center in the specified voltage range between 1 and 0 at the output. The comparators low output value (logic 0) is specified at less than 0.4 V max in comparators with TTL-compatible outputs, while for a low-voltage amplifier, the low output value is very close to its negative rail (e.g., 0 V in a single-supply system). Figure 1 compares the low output values of typical amplifier and comparator models, with a
Figure 1. Responses of single-supply amplifier (63 pV) and comparator (280 mV) models to a 1-mV input-voltage difference. Built to compare two levels as quickly as possible, comparators do not have the internal compensation capacitor (Miller capacitor) usually found in op amps, and their output circuit is capable of more flexible excitation than that of op amps. This absence of compensation circuitry gives comparators very wide bandwidth. At the output, ordinary op amps use push-pull output circuitry for essentially symmetrical swings between the specified power supply voltages, while comparators usually have an open-collector output with grounded emitter. This means that the output of a comparator can be returned through a low-value collector load resistor (pullup resistor) to a voltage different from the main positive supply. This feature allows the comparator to interface with a variety of logic families. Using a low value of pull-up resistance yields improved switching speed and noise immunitybut at the expense of increased power dissipation. Because comparators are rarely configured with negative feedback, their (differential) input impedance is not multiplied by loop gain, as is characteristic of op amp circuits. As a result, the input signal sees a changing load and changing (small) input current as the comparator switches. Therefore, under certain conditions, the driving-point impedance must be considered. While negative feedback keeps amplifiers within their linear output region, thus maintaining little variation of most internal operating points, positive feedback is often used to force comparators into saturation (and provide hysteresis to reduce noise sensitivity). A comparators input usually accommodates large signal swings, while its output has a limited range due to interfacing requirements, so a lot of rapid level shifting is required within the comparator. Each of the above differences between an amplifier and a comparator is there for a reason, with the major goal of comparing rapidly varying signals as quickly as possible. But, for comparing slow-speed signalsespecially where sub-mV resolution is requiredsome new rail-to-rail amplifiers from Analog Devices could be better buys than comparators. Q. OK. I can see that there are overall differences. How do they look to the designer who wants to use an op amp to replace a comparator? A. Here are six major points:
1. Consider VOS and IB non-linearity vs. input common-mode voltage
Figure 2. Response of open-loop AD8605 to a 100-mV differential step with 3-V common-mode voltage. Note the essentially linear slewing between the 0- and 5-V rails, and the clean saturation. But, for many rail-to-rail-input amplifiers, input offset voltage (VOS) and input bias current (IB) are non-linear over the input common-mode voltage range. With these amplifiers, the user needs to take this variation into account in the design. If the threshold is set at zero common-mode, but the part is used at some other common-mode level, then the logic level that results may not be as anticipated. For example, a part with offset of 2 mV at zero common mode, and 5-to-6 mV over the entire common mode range may give an erroneous output when comparing a difference of 3 mV at some levels in that range.
2. Watch out for input protection diodes
Figure 3. Response of an OP777 amplifier to a ±2-V, 1-kHz signal, biased by +2V, and compared with a +0.5-V dc level. Note that there is no phase inversion for this large swing. However, the gain is quite low at a common-mode level of +0.5 V from the negative rail, as can be seen by the approximately 0.3-V overdrive that is needed.
3. Watch out for input voltage range specs and phase-reversal tendencies:
4. Consider saturation recovery
Figure 4. Recovery of two popular amplifiers in closed-loop configuration.
5. Factors affecting transition time
Figure 5a. Amplifier circuit.
Figure 5. Responses of comparator and three open-loop amplifier models compared,
While most comparators are specified with 2-mV to 5-mV overdrive, most high precision, low input offset amplifiers can reliably operate with as little as 0.05-mV overdrive. The amount of overdrive applied at the input has a significant effect on propagation delay. Figure 6 shows the response of the AD8605 to several values of overdrive voltage.
Figure 6. Response of the AD8605 as a comparator to step inputs with overdrive of 1, 10, and 100 mV.
As amplifiers are allowed to consume more power, their speed improves substantially, so that they can compete with comparators in terms of rise- and fall times. Figure 7 includes an example of thisfor an AD8061, with a 300 V/μs slew rate, in an open loop configuration responding to a sinusoidal zero crossing input, the output recovery time is
Figure 7. Response of AD8061 as a zero-crossing comparator. In Figure 8, the AD8061s step response is compared with that of the popular LM139, and two other open-loop amplifiers, connected in the same circuit configuration as in Figure 6. As can be seen, the AD8061 responds within 300 ns, which is faster than LM139. This is achieved at the expense of higher current consumption.
Figure 8. Step response of three amplifiers and a popular comparator. Note the especially fast response of the AD8061.
6. Consider the way to interface with different logic families Figure 9 shows an OP1177 (dual-supply amplifier), interfaced to logic circuitry, and Figure 10 shows its response to 100 mV of overdrive. With ±5-V supplies, quiescent power dissipation is lowered and thermal feedbackdue to output stage dissipationis minimized, compared to ±15-V operation. The lower supply voltage also reduces the OP1177 rise and fall times as the output slews over a reduced voltage rangewhich in turn reduces the output response time. Without the protective circuitry on the output of OP1177, the output would swing to +VCC2 and VEE2; these levels might be detrimental to downstream logic circuitry. Adding Q2 and D2 prevents the output from going negative and translates the limits to TTL-compatible output levels. D2 clamps the output, so that it will not go below 0.7 V, as can be seen from waveform V(D2,2). The value of VCC of Q2 can be selected (5 V was selected for this analysis) such that a correct logic level results, as shown by waveform VOUT.
Figure 9. OP1177 connected for comparator operation, with translation and protective circuitry for TTL output.
Figure 10. Response waveforms for the OP1177 comparator circuit.
To conserve power, an N-channel MOSFET may be used instead of the NPN transistor shown in Figure 9. Q. So the bottom line is... A. An amplifier can be used as a comparator with excellent precision at low frequencies. In fact, for comparing signals with microvolt-level resolution, precision amplifiers are the only practical choice. They can also be an economical choice for multiple-channel op amp users when employment of free amplifier channels to satisfy comparator requirements is feasible. Savvy designers can save money while optimizing their designs if they take the trouble to: understand the similarities and differences between amplifiers and comparators; read the amplifiers data sheet for the right features; understand about trade-offs in recovery time, speed, and power consumption; and are willing to verify designs with amplifiers configured as comparators. Copyright 1995- Analog Devices, Inc. All rights reserved. |