I am trying to simulate the following comparator circuit with LTspice:

enter image description here

The LM311 comparator was intended to be used with hysteresis, same as the circuit shown in this graph (designators are the same):

enter image description here

The high threshold should be 3.1V and lower threshold 1.9V, centered around 2.5V. I used the following website to calculate the resistor ratios. The pull-up resistor R3 is set to be 1K so that it is much smaller than feedback resistor R4 according to this post.

The simulate results give strange waveforms:

At VIN (the previous stage is a current sense amplifier with 2.5V offset, and at this point there is no current so this voltage is 2.5V):

enter image description here

At the output (COL_OUT) there is unexpected oscillation:

enter image description here

At REF, there is oscillation as well:

enter image description here

What could be the cause of this behavior?


2 Answers 2


What could be the cause of this behaviour? Thanks in advance!

The emitter should be connected (via a resistor or not) to ground and not 5 volts: -

enter image description here

And, the collector normally has a pull-up resistor to 5 volts and not the complex arrangement you have shown (that doesn't match your other schematic).

So, forget about the emitter resistor and connect "E" to ground/0 volts. Use a simple 1 kΩ pull-up resistor from "C" to 5 volts and, feedback to "REF" with a high value resistor such as 100 kΩ or greater.

Here's an example from the data sheet that shows how E and C pins are used (my bits in red): -

enter image description here

  • \$\begingroup\$ R4 is to provide hysteresis. \$\endgroup\$
    – Russell McMahon
    Commented May 11, 2023 at 3:42
  • \$\begingroup\$ @RussellMcMahon and a convoluted way it is shown with some node name of ph+ to add to the confusion!! \$\endgroup\$
    – Andy aka
    Commented May 11, 2023 at 5:26
  • \$\begingroup\$ You are right, I got COL_OUT and EMIT_OUT mixed. But after I fixed it the simulation won't run. Although it might not have anything to do with this part of the circuit. Sorry for the confusion with the ph+ node, it is connected to a full bridge driver's input \$\endgroup\$
    – Zhi
    Commented May 11, 2023 at 7:51

As for an explanation of the oscillation:

enter image description here

Notice the internal comparator feeding the output NPN structure. (Which is not actually a single NPN, it's more complicated than that; but calling it an NPN suffices here.) It must source base current to turn it on. With emitter basically unconnected (pulled high), that base current flows through the B-C junction instead -- to the output.

This has two unexpected effects:

  1. The output sources current. It's not strictly open-collector (sinking only).
  2. The comparator's phase is reversed. When the open-collector output is supposed to be pulling low, in fact it's pushing high instead.

This is compounded by the anomalously large collector load resistors (~100k): the base current is small, but across such large resistances, it has significant effect. Evidently, it's nearly to the supply rail(!).

Finally, oscillation frequency is, in part, determined by the input capacitance, which combined with the large resistor values, gives a time constant of, apparently fractional microseconds or so. Internal propagation delay accounts for the remainder.

(In general, comparators are not stable with negative feedback, as they have too much gain and phase shift to stabilize, as an op-amp would. They are otherwise very similar components [comparators and op-amps], indeed some differed by only one component: the omission of a compensation capacitor.)

This explanation however leaves one wrinkle, that I am not too familiar with: the SPICE model.

Models -- as the name suggests -- are only ever an approximation of the real device. Manufacturers will never (or, in many cases, contractually cannot) release models disclosing their actual as-fabricated devices; that's internal IP, trade secrets, or licensed from the fab. So, they release simplified approximations of them. They might only model the datasheet parameters (or not even all of them), and might not include parasitic effects (for example, the input phase reversal effect, that early op-amps were infamous for, might be such an effect that gets omitted in a model).

I don't know, offhand, to what accuracy the library LTSpice LM311 model is written. It could very well be constructed with a (truly) floating transistor, or even a completely virtual switch element, instead of the representative output structure.

It does seem evident, or likely at least, that they modeled these effects accurately -- accurate enough that the above explanation seems reasonable. Despite that this internal base current is, well, internal -- arguably a parasitic effect!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.