Comparing comparators: Measure signals, get results

-October 08, 2009

Although humble in concept, today’s voltage comparators perform a simple basic task: comparing two voltages to determine which is larger. To accomplish this task, they accept two analog signals and produce a binary signal at the output. In this regard, a comparator resembles a 1-bit ADC. The basic function of a comparator comes in handy in applications requiring a comparison between a voltage and a stable reference. Such applications include level translation, radar, clock-recovery circuits, wheel sensors on antilock braking systems, precipitation gauges, and headphone-jack detection on handheld products. You can learn about hundreds of other potential applications by reading manufacturers’ data sheets and application notes (references 1 through 4).

Despite their utility, however, comparators have countless specifications that you must be aware of (references 5 and 6), and no single device will make everyone happy. “For 80% of the people, a handful of comparators will fulfill their needs,” says Brendan Whelan, design-section leader at Linear Technology. “For the other 20%, no two of them want the same comparator.”

Further complicating the selection and application of these devices, some engineers believe that comparators are just op amps running in open-loop configuration—that is, without negative feedback. Because an operational amplifier has a well-balanced difference input and a very high gain, some op amps can serve as comparators in some functions (references 7, 8, and 9). However, in practice, dedicated comparators have several advantages over op amps. For example, dedicated voltage comparators are generally faster than general-purpose op amps that you are using as comparators. A comparator may also contain additional features, such as an accurate internal voltage reference, adjustable hysteresis, and a clock-gated input.

Another reason to choose a comparator over an op amp is that op amps stay within their linear range, whereas comparators run in open-loop mode and switch to a high or a low output. When you use an op amp as a comparator, you must first ensure that no internal clamps lie between the input pins. These clamps prevent you from pulling the input pins more than a diode drop apart. You may be able to overcome these problems by putting series resistors in the op-amp inputs, but that approach raises the input source impedance. Also be aware that op amps may come out of saturation slowly (Figure 1), and, when you drive them to the rails, op amps’ quiescent currents may reach excessive levels. And forget about using a handy, “free,” leftover op amp from a quad-device package: One part in the quad will swing hard between the rails, almost certainly interfering and causing noise problems with the other three amplifiers in the package. An amplifier’s Spice model may also not properly represent a comparator’s operation during saturation.

On the other hand, engineers can legitimately use an op amp for a comparator function when their design must discriminate between small voltages of, say, 10 to 200 µV. In these cases, an op amp amplifies the input signal to a comparator. In that way, you give the comparator a low-impedance input that provides enough overdrive—the voltage margin above the nominal switching point—to properly switch the comparator. Jim Williams, staff scientist at Linear Technology, has developed several such circuits (references 10 and 11). According to Williams, using an op amp in front of a comparator can also work well. “Take as much gain in the preamp as you can, and let it do the work,” he says.

You can also use two comparators to make a window comparator, which indicates whether the input signal is between two levels, or to ensure that the charging voltage of a lithium-ion charger stays within bounds. Further, you can use comparators with feedback to make free-running oscillators. Because comparators commonly use a reference voltage to set the trip level, hundreds of available parts combine a reference and a comparator.

How it works

The operation of a comparator is straightforward. It has a positive pin and a negative pin. When the voltage on the positive pin is higher, the output of the comparator “asserts,” or drives, a signal. With an open-collector output, the comparator’s output pin is the collector of a transistor or the drain of a FET. With a push-pull output, the comparator has a “totem-pole” output—that is, a complementary NPN/PNP stage—such as the one you find in operational amplifiers. An open-collector output is useful when the load and the comparator each use a different power supply. This approach allows you to implement, for example, a solenoid operating from 12V, even though your comparator may be operating from only 3.3V. Another use of open-collector outputs is to minimize quiescent current when the output is off. No base current flows in an N-type output transistor, whereas some base current always flows in one of the two output transistors in a totem-pole stage.

Open-collector outputs have a couple of drawbacks, however. For example, they require the use of external pullup resistors. The resistors must perform this pullup during high-impedance periods, so the comparator switches more quickly when its output is low than when it turns off and the pullup resistor brings the output high. Thus, using an open-collector output is unsuitable whenever you need a symmetrical waveform, such as with a clock-recovery circuit. If your circuit requires no level-shifting, you should instead select a push-pull output in a part such as Advanced Linear Devices’ ALD2321APC, which can supply a 24-mA output drive and uses 90 µA of quiescent current.

Fast comparators may also have a latched output, allowing you to keep the output in a known state so that you can satisfy a setup-and-hold time to the digital input that it feeds. Once the digital section has read the comparator output, you release the latch pin, and the output tracks the input. Fast comparators also may feature ECL (emitter-coupled-logic) levels of –5 to 0V. PECL (positive-emitter-coupled-logic) outputs have the same voltage swing but operate at 0 to 5V. RSPECL (reduced-swing-PECL) outputs are also available. Some fast comparators feature LVDS (low-voltage-differential-signaling) outputs with two output pins that shift 300 mV in a complementary fashion around a common-mode voltage of 1.2V. You can run these outputs directly into the LVDS input pins of FPGAs (field-programmable gate arrays) and other digital circuits.

Once you have established the output type, your next likely consideration is speed. Manufacturers generally describe a comparator as either low power or high speed. They typically build the low-power parts with CMOS processes and the fast parts with bipolar devices, illustrating the fundamental trade-off: fast, accurate parts with high power consumption versus slow parts with low-power supply currents (Figure 2). Another trade-off is gain versus high speed. A low-power comparator may take 70 µsec to switch and use less than 1 µA of supply current. A fast comparator with 150-psec response time, such as Analog Devices’ ADCMP572, uses 44 mA. Some units stand out in the speed-versus-power trade-off. For example, National Semiconductor’s LMV7219 has a 7-nsec propagation delay and uses 1.1 mA; it has relatively low gain, however. In general, an N-type device has higher electron mobility, so it switches from high to low more quickly than it switches from low to high.

A comparator consumes much more than its quiescent power when switching at its maximum toggle rate. In a quiescent state, the current is low. When you push the comparator to operate faster, you must be able to charge the capacitance, which requires current. In dynamic mode, the current increases with the speed of operation. Another factor in power consumption is the load on the chip. Capacitance also presents itself as a load to a switching circuit, and you must account for that capacitance as well as the resistive components of the load. Many parts have shutdown pins that reduce the current consumption to less than 1 µA.

As with all things analog, propagation-delay claims are true only under strictly defined conditions because how far apart you drive the input pins directly affects propagation delay. The greater the overdrive, the faster the part is. “Dispersion” is the range of propagation-delay values a device exhibits under varying degrees of overdrive (Figure 3). “Dispersion is a critical spec in ATE [automated-test-equipment] systems in which you are trying to measure the propagation delay of a fast logic chip,” says Mike Maida, a technologist at National Semiconductor. The relationship between overdrive and speed is the reason that some engineers are loath to rate a comparator’s speed as a function of toggle rate. First, you must define the output levels that qualify as a valid transition; an output level of 10 to 90% of maximum is typical. The toggle rate also implies the requirement for a hard overdrive to get the propagation delay to be as short as possible. “Propagation delay is often not a good indicator of toggle rate,” says Linear Technology’s Whelan. The company offers the LT1719 and LT1715 comparators, both with 4-nsec propagation delays and toggle rates of 70 and 150 MHz, respectively.

Another parameter to consider in comparator selection is noise. Manufacturers often omit noise specifications for comparators, however, instead relying on random jitter to measure noise. “In addition to just the noise signal through the gain of the device, the input’s aperture errors and the output’s rise and fall times can influence the jitter,” says Brian Carey, senior design engineer at Analog Devices. “A clock-driver part ... is just a lower-gain comparator that’s optimized for noise.” National Semiconductor’s Maida notes that a designer can use larger input transistors in a CMOS part to reduce flicker noise, but that approach increases the input capacitance.

Once you have selected an output type and satisfied speed and power requirements, your next concern should be the voltage rating of the comparator. Manufacturers once made slow, low-power devices in CMOS processes, but that approach meant using a 5V power supply; legacy bipolar parts, meanwhile, would work with ±15V supplies. Today, CMOS and BiCMOS analog processes often can achieve power-supply voltages of 12V or more. “In the past, people tended to use bipolar supplies for the really fast comparators because those [devices] used NPN input stages, and they could not extend the common-mode-input range to down to ground,” says Maida. National Semiconductor implements fast, vertical PNP transistors in the input stage of the LMH7322 so that it can use ground as the negative rail and still allow the inputs to swing 200 mV below ground. Bipolar processes have advantages in supply voltage. Linear Technology’s LT1716, for example, has a 44V input and uses only 35 µA of power. Many of the company’s high-speed comparators have not only 0 to 5V but also ±5V input capability.

Read more In-Depth Technical Features

A factor that relates to power-supply range is the permitted common-mode voltage of a comparator’s input pins. Many engineers use a legacy LM339 timer from National Semiconductor. However, its manufacturer never intended the part to work with the inputs near the top power-supply rail (Figure 4). Some parts allow you to drag the outputs above or below the power-supply voltage range, but others invert the output if you drag either input pin below the negative-power-supply rail (Reference 12). A rail-to-rail input-stage comparator, such as Analog Devices’ ADCMP60x or STMicroelectronics’ TS3021, extends the input-common-mode range. These devices have a dual input stage, with N-type transistors or FETs in parallel with a P-type input stage. The P-type stage works at input voltages close to ground or the negative rail, and the N-type stage works when the inputs swing close to the positive rail. IC designers usually engineer the devices to switch between stages 1 or 2V below the positive rail. Some architectures minimize the offset voltage, and the most pronounced effect occurs when the input-bias current changes from positive to negative as you sweep thought the common-mode range of a rail-to-rail part, such as Analog Devices’ ADCMP600 (Figure 5).

Another important spec for comparators is the input-bias current—the amount of current that flows into or out of the input pins as the part operates. CMOS products have low input-bias currents, representing the mismatch in leakages in the input pin’s ESD (electrostatic-discharge) structures. This input-bias current doubles for every 10°C of temperature rise. The bias currents of fast comparators can be substantial but are not usually problematic because you tend to drive these high-speed comparators with low-impedance circuits. The input-bias current of bipolar parts changes depending on the relationship of the two inputs. In comparators, a 60-mV difference in the base voltage of a differential-input pair yields a 10-times-higher difference in the collector currents of that pair and in the input-bias currents. Thus, you may have one input pin that is sourcing or sinking at twice the rated input-bias current and the other pin with almost no input-bias current, depending on which pin has the higher voltage.

Although designers often overlook it, packaging may be the most critical spec for comparators. Legacy parts have standard pinouts for single and dual comparators that pertain to DIPs (dual inline packages) and SOIC (small-outline-integrated-circuit) packages. You may need one of the newer small packages, such as a SOT-23 (small-outline-transistor) or an SC-70. If you are replacing a legacy part, verify the exact pinouts of both the part and its replacement, even if they come in the same type of package. Other small packages include solder-bump units, or CSPs (chip-scale packages). These packages are as small as the die itself. Maxim fit the MAX9060 comparator into a four-pin CSP by tying one of the input pins to an internal rail. Some companies don’t use CSPs, however, because they can’t achieve the low defect rates of other packages. Manufacturers can test CSPs while sorting the wafers but not after they make the solder bumps. Manufacturers can also package parts without bond wires by mounting a solder-bump die to a lead frame. This approach yields parts smaller than 2×2 mm and still provides for die protection and product testability.

Pitfalls and problems

All analog circuits have pitfalls, and the comparator is no exception. Application experts report that the two most common design problems are common-mode range and oscillation. To understand common-mode range—the area in which you can operate the input pins—you must understand the input structure of the comparator you are using. You must take care that your device’s input range will not exceed its supply range. To ensure that this scenario does not occur, you should limit or clamp the inputs. You could place a Schottky diode on the LM339’s input to ensure that its input cannot go low enough to invert the output. The ESD-protection diodes inside a device clamp the inputs to ensure that the pin cannot go more than 0.6V beyond a power rail. A current of 1 mA is safe, but 10 mA is reaching the upper limit, depending on the duty cycle. ESD-protection diodes on the input pins may limit the voltage, but problems can still occur.

The offset voltage and propagation delay of rail-to-rail devices change as the input levels move from the N-type stage to the P-type stage. In general, this transition is not a problem because you typically set up one of the input pins to a fixed dc level that determines the input stage that will switch the outputs. One important exception is in PWM (pulse-width-modulated) circuits, in which you feed one pin of the comparator a triangle wave and the other pin a waveform that the PWM represents. In this case, the inputs of the comparator sweep through the entire common-mode range.

Oscillation is the next major headache you may face. The outputs of comparators are high-speed signals no matter how slowly their inputs change. “When the guillotine goes down, it’s going to shake the floor,” says Paul Grohe, an application engineer at National Semiconductor. In other words, you can expect significant disruption of the power and ground in your circuit if you fail to decouple all your comparators, even the slow ones. Because of these power disruptions, Grohe warns against using a voltage divider on the power rail as a reference for the comparator.

“You have to bypass things really well with micropower parts,” says Tim Regan, an application-engineering manager at Linear Technology. “The power-supply rejection is not as good as you might think because you have all these high-impedance nodes inside the part.” Fast comparators are even more sensitive to bypassing and board layout (Reference 13). You should maintain a ground plane under the part and ensure that stray capacitances are bringing positive feedback to the inputs to make the part switch solidly rather than create oscillations.

The fundamental way of ensuring clean transitions is to introduce hysteretic resistors into the comparator circuit (Reference 14). These resistors return a bit of positive feedback to swamp out noise and crosstalk once the comparator begins to switch. Without hysteresis, 1 mV of ground bounce can send a part into oscillation, says Brian Hamilton, a design-section leader at Linear Technology. Many fast comparators have built-in hysteresis, and some have a pin that lets you select an adjustable hysteresis level.

Another problem with comparators is high source impedance, which makes your circuit prone to oscillation and subject to crosstalk and stray capacitance. Bob Gonzalez, an applications engineer with On Semiconductor, warns against placing 10-kΩ resistors in series on the inputs because this approach increases impedance into the inputs. The devices have internal parasitic capacitance; if the input impedance is high, that capacitance becomes prominent and adds phase shift to the circuit, leading to oscillations. You may want to use an op-amp buffer or a simple emitter-follower transistor circuit in front of the comparator to minimize the source impedance. You may also be able to overcome the problem by adding hysteresis.

Proper termination of outputs and maintaining an appropriate temperature are also critical factors in avoiding problems with comparators. Hooking a device’s output to a long transition line may cause reflections from the end of the line unless you provide for a termination. You might consider an RC-termination network if you do not want to waste dc power. You could also look at using series termination that allows a reflection from the destination but then absorbs it in a series resistor (Figure 6).

The performance of a comparator changes over temperature. IC designers have made great strides in this area, though, so many parts are available that meet specifications over –40 to +125°C. Still, comparators are prone to oscillate at low temperatures, and high temperatures lower the device’s base-to-emitter voltages and cause other performance differences. It is essential to evaluate your circuit at all the temperature extremes it will face in service. “The biggest thing is propagation-delay change with temperature,” says National Semiconductor’s Maida. “It tends to be faster cold and slower hot. The common-mode range also shifts a little over temperature. In general, gain tends to get worse going hot, and it’s more of a design challenge for head room.”

Another concern is whether to simulate your circuits using Spice models. Most company representatives admit that older Spice models are far less reliable than new ones. Texas Instruments is committed to making good models for all its comparators and offers the free Tina-TI model, which allows you to cut and paste all schematics and waveforms as metafiles into Word or PowerPoint. Remember that, when you are dealing with fast comparators, the PCB (printed-circuit board) is an important component in the design; your layout may create stray capacitances and crosstalk, and these effects will overshadow any Spice simulation that does not model these second-order effects. The extreme speed of Analog Devices’ new comparators, for example, causes problems for Spice. “We do not have Spice models for our newer parts because, as you go higher in performance, it becomes more difficult to get a reasonable model,” says James Frame, a marketing manager at Analog Devices, which is considering developing models. The company will release them only if they are sufficiently accurate, however, so as to not mislead its customers, he says.

Over the years, the processes for manufacturing comparators have improved. Advanced CMOS processes have low power consumption and operate at more than 5V. The fast parts can take advantage of vertical PNP transistors, and the fastest have the benefit of SiGe (silicon germanium, Reference 15). “If you get to mix and match processes, there are obvious parts of a comparator that make sense for you to do in different processes,” says Linear Technology’s Hamilton.

Analog Devices uses a SiGe process in its high-speed comparators. “SiGe has a better speed-power product but also better gain; you just can’t get high gain out of CMOS; we’ve tried,” notes Carey. SiGe also has a greater voltage range. “You can’t give people a 1.8V-input-range comparator; everyone wants to put in at least 2 or 3V along with a wide common-mode range on these parts,” he says. Analog Devices also uses dielectric isolation to make some of the fastest comparators available. Dielectric isolation in the company’s XF3 process provides low parasitic capacitance and low leakage currents.

With thousands of comparator parts and even more application circuits, you may feel overwhelmed. Armed with the basics and the subtleties, however, you can sift through all the specifications to find the comparator that provides the optimum trade-off among all your requirements. Whether you are trying to detect a pushbutton on a handheld product or sensing the trigger level in a gigahertz-frequency input to an oscilloscope, a comparator exists to fill the bill. Just heed Gordon Holton, strategic-marketing manager at Texas Instruments, when he warns you not to be too cheap. He notes some customers buy the lowest-cost comparator only to find they need the rail-to-rail input of a better part. The manufacturers’ Web sites will help you winnow the parts, and their application-engineering staffs will keep you out of trouble. By embracing the unique combination of analog and digital characteristics in a comparator, you can make sure you get the most from your circuits.

  1. Specifying Selected Op Amps and Comparators,” Linear Brief 26, National Semiconductor, October 1973.

  2. LM139/LM239/LM339: A Quad of Independently Functioning Comparators,” Application Note 74, National Semiconductor, January 1973.

  3. Applications of the LM392 Comparator Op Amp IC,” Application Note 286, National Semiconductor, September 1981.

  4. Williams, Jim, “A Seven-Nanosecond Comparator for Single Supply Operation,” Application Note 72, Linear Technology, May 1998.

  5. Comparators,” MT-083 Tutorial, Analog Devices Inc, 2009.

  6. Mancini, Ron, “Designing with comparators,” EDN, March 29, 2001, pg 56.

  7. Using Op Amps As Comparators,” MT-084 Tutorial, Analog Devices Inc, 2009.

  8. Moghimi, Reza, “Amplifiers as Comparators?” Analog Dialogue, April 2003.

  9. Microvolt Comparator,” Linear Brief 32, National Semiconductor, June 1976.

  10. Williams, Jim, “Application Considerations and Circuits for a New Chopper-Stabilized Op Amp,” Application Note 9, Linear Technology.

  11. Williams, Jim, “A Seven-Nanosecond Comparator for Single Supply Operation,” Application Note 72, Figure 65, Linear Technology, May 1998.

  12. LM139/LM239/LM339/LM2901/LM3302 Low Power Low Offset Voltage Quad Comparators,” Note 3, National Semiconductor, March 2004.

  13. Williams, Jim, “High Speed Comparator Techniques,” Application Note 13, Linear Technology, April 1985.

  14. Mancini, Ron, “Adding hysteresis to comparators,” EDN, May 3, 2001, pg 22.

  15. Rako, Paul, “Silicon germanium: fast, quiet, and powerful,” EDN, Sept 18, 2008, pg 27.

Loading comments...

Write a Comment

To comment please Log In