Monday, June 21, 2010

Thou shalt not turn an op amp into a comparator

Is that writ in stone? A commandment from Mt. Sinai no less?

Texas Instrument engineers Bruce Carter and Ron Mancini say that using an op amp as a comparator is a no-no because "an op amp has an output stage optimized for linear operation, while the output stage of a
comparator is optimized for saturated operation." Moreover, "the comparator is an open loop device, utilizing no feedback resistors." The op amp, on the other hand, is
optimized for closed loop applications. The results are unpredictable when an op amp is used open loop. No semiconductor manufacturer can or will guarantee the operation of an op amp used in an open loop application.
Yet more bad news:
The transistors used for op amp output stages are not switching transistors.... When saturated, they not only may consume more power than expected, they may also latch up. Recovery time may be very unpredictable. One batch of devices may recover in microseconds, another batch in tens of milliseconds. Recovery time is not specified, because it cannot be tested. Depending on the device, it may not recover at all! Runaway destruction of the output transistors is a distinct possibility in some rail to rail devices.
There can be exceptions to the rule, however. 
In some cases, the designer may get away with using an op amp as a comparator. When an LM324 is operated in this fashion, it hits a rail and stays there, but nothing 'bad' happens. The situation can change dramatically, however, when another device is substituted.
But what if we use the op amp with positive feedback? That's no longer open loop, right? Well that's a question that Carter and Mancini don't tackle. And positive feedback is what we put into the touch sensor op amps to turn them into comparators with hysteresis. So does that make the use of op amps as comparators ok? Doubt it. Even if that solves the open loop problem, it still leaves the issue of op amps being used to saturation and slamming its output to rail. Then again maybe we'll get lucky and will be able to get away with it, depending on the op amps we use.

Engineer James Bryant of Analog Devices has the same advice as the guys from TI.
[T]he best advice on using an op amp as comparator is very simple—don't! Comparators are designed to work as open-loop systems, to drive logic circuits, and to work at high speed, even when overdriven. Op amps are designed for none of these. They are intended to work as closed-loop systems, to drive simple resistive or reactive loads, and should never be overdriven to saturation.
Damn.

Bryant does address the matter of building hysteresis into the op amp.

He concludes on a more positive note:
[A]lthough op amps are not designed to be used as comparators, there are, nevertheless, many applications where the use of an op amp as a comparator is a proper engineering decision. It is important to make an educated decision to ensure that the op amp chosen performs as expected.

To do this, it is necessary to read the data sheet carefully and to consider the effects of nonideal op amp parameters on the application. Because the op amp is being used in a nonstandard manner, spice models may not reflect its actual behavior, and some experiment is advisable. Furthermore, because not all devices are typical in their behavior, some pessimism is warranted when interpreting the experimental results.

----

Reference:

Bruce Carter & Ron Mancini, Op Amps for Everyone, 3rd ed., Newnes, 2009, p. 535-538.

No comments:

Post a Comment