LM393A Comparator

After a lot more experimentation at the breadboard, I've finally figured out how to use the LM393A comparator. I was using the device open loop, which I had thought would work fine. But it kept not working, and that was puzzling. The outputs were always jittery and noisy, and it kept happening.

Ultimately, this was a case of my not RTFM, in this case National Semiconductor AN-74. Or at least not reading it relatively recently, whereas I definitely used that app note in the 1970s. In some prior projects from that time, I'd used the related LM339A (quad comparator) part successfully, and had not seen the jitter problem that only seemed to happen in recent years. Some of my test LM393 parts were new old stock, which is what I thought might be the problem at first. Then the same result happened with brand-new parts. That's when I realized I had to dig in further. In fact, I later realized that what made my 1979-era VCO work is that the LM339A comparators used open-loop in that design were followed by a NAND latch, which essentially filtered any noise effects by offering regenerative (positive) feedback for latching.

AN-74 is all over showing how to use regenerative feedback directly with the LM393A -- it's called hysteresis 😂! Basically, the comparator can be made to be a precision Schmitt Trigger, something I had already done successfully with BJTs.

To get to the bottom of this "mystery," I decided to try the textbook clean suggested circuits from AN-74. Both the inverting and non-inverting comparator designs worked very well, achieving fast and clean switching at very high audio frequencies and beyond into ultrasonic. This was quite a relief, and what I realized too is that I could get the precision thresholds I wanted by just designing the switching points properly. The key to clean precision switching with these IC comparators is hysteresis.

For the LM393A bench test circuit, I used ±7.5V supplies, anticipating bipolar analog and CD4000 CMOS switches and logic. My goal for these comparators is to drive CMOS switches in a triangle wave harmonic multiplication application. So, they needed to be fast. I was so worried about speed, that I have also tested the LM319 dual comparator, but was again using it open loop, and not getting clean switching. But this recent test of the LM393A showed < 300 ns switching, which is < 0.6% of the period of a 20 kHz waveform. The LM319 would likely be better, but it has more restricted application usage and is more expensive.

The engineering notebook page is shown next:
LM339A Inverting & Non-Inverting Test Circuit

I decided to integrate what I'd learned about these IC comparators by taking some notes:
  1. Comparators generally have input voltage range limitations. Faster comparators have the smallest input voltage limits.
  2. For the LM393/LM339 devices, 0 ≤ Vi ≤ Vcc - 2V. For the LM319, -5V ≤ Vi ≤ 5V. I discovered that the LM319 inputs actually clamp to these voltage limits.
  3. For larger Vi, just scale the inputs with a precision resistive divider. I've also seen this trick done in instrumentation designs, like the Tek FG-503 TM-500 Function Generator plug-in.
  4. Without hysteresis, comparators will tend to have chattery, inconclusive, and noisy outputs.
  5. The best form of hysteresis is a Schmitt Trigger design, with precision resistors to set threshold voltages. The utility of this circuit design topology was already seen with ultra-fast transistor Schmitt Triggers, which also directly afforded larger voltage input ranges.
  6. An inverting comparator has always seemed less "chattery" than a non-inverting comparator. But that is only the case for open loop implementations. Non-inverting implementations can be done well and generally require an input isolation resistor with which resistive divider action is used for hysteresis. Note that in AN-74, the non-inverting comparator uses a reference voltage Vcc/2 for single power supply implementation. That reference voltage merely becomes ground in a dual (e.g. equal bipolar voltage) power supply implementation.
  7. Because the comparators have open-collector outputs which require the use pull-up resistors for digital signal output, resistor value tradeoffs for speed vs. power must be weighed, and also circuit output loading must be considered too. Because the output is open-collector, other forms of output can alternatively be considered, such as driving a differential pair of transistors that switch a precision reference voltage or are just used for level shifting to achieve voltage compatibility. For my LM393A test, I found that the 3kΩ pull-up driving a 100kΩ test load worked perfectly well up to 50 kHz or so.  
  8. The circuit definitely needs to use decoupling capacitors. However, use of decoupling to filter noisy inputs is not recommended because it degrades hysteresis.
  9. If the input being sensed is a pulse, or otherwise has a fast edge rate, of course the comparator is going to have an easier time switching due to the fast Î”t.
  10. Because voltage input range can be limited, the comparator Vos carries a greater weight as a % of the input signal. Hence, low Vos comparators should be specified unless the application does not demand precision.
Various annotated scope fotos now follow.

1 kHz & 20 kHz Sine Wave Response

Solid Rising Edge Response from 2 Different Comparators with 20:1 Frequency Difference

1 kHz & 20 kHz Triangle Wave Response

Anti-Phase Triangle Waves at 1 kHz

Both Comparators Falling Edge at 1 kHz

Both Comparators Rising Edge at 1 kHz







Comments