LTspice – Simulation of LM311 Comparator with Hysteresis Issues

comparatorltspiceschmitt-trigger

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?

Best Answer

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