# Comparator Undesired Behavior

The following circuit is a comparator, which compares input square signal at non-inverting pin with fixed reference voltage at inverting pin of integrated comparator circuit LM393 ($$\R\$$ is collector resistor since this comparator has open collector). If $$\V_{IN}>V_{REF}\$$ then $$\V_{OUT}=V_{CC}\$$. If $$\V_{IN} then $$\V_{OUT}=0V\$$. simulate this circuit – Schematic created using CircuitLab

As I built this circuit on breadboard I noticed that $$\V_{IN}\$$ has to differ at least few 100 mV in order for comparator to switch between $$\V_{CC}\$$ and 0V. However such behavior is undesired since input square signal's amplitude varies only few 10 mV between HIGH and LOW states. So I set $$\V_{REF}\$$ in the middle between two input voltage states, but comparator didn't change its output.

But shouldn't the comparator change its output even for slight voltage difference between two inputs? According to equation, which applies for differential structure amplifying devices such as comparator and operational amplifier, my statement is correct. This equation goes as follows:

$$V_{OUT}=A_{OL}(V_+-V_-)$$ $$V_{OUT}=A_{OL}(V_{REF}-V_{IN})$$

Also, if I would design a simple differential structure amplifier with discrete components, which would most probably have much smaller open-loop gain and other deficiencies, a slight voltage difference between two inputs would result in much greater voltage difference at its output.

NOTE: I also tried replacing this integrated comparator circuit with operational amplifiers TL072 and LM358, where both of them indicate similar behavior.

Any ideas if this behavior is normal to all operational amplifiers and comparators? How else could I compare input signal, which varies only for few 10 mV if not this way?

• What is the actual value of Vref? Could be a common mode problem if near the rail.
– Nino
Jun 25, 2019 at 18:10
• Do you have an oscilloscope? And Vin_square isn't bipolar, right? Connect replace the Vin_square input with a potentiometer divider and see if it still happens. Jun 25, 2019 at 18:17
• Vref MUST be 2V below Vcc, and scale input accordingly Jun 25, 2019 at 18:20
• @DKNguyen Yes, I have an oscilloscope. Vin_square varies only between positive potentials, it doesn't goes from positive to negative, if that is what bipolar means.
– Keno
Jun 25, 2019 at 18:22
• @Keno Yes, -1.5V CM input range means that Vref or Vin needs to be at least 1.5V below Vcc?. Also, you should look at the "Response Time for Various Input Overdrives". e2e.ti.com/cfs-file/__key/…
– G36
Jun 25, 2019 at 18:37

As others pointed out, this chip requires the input voltages be at least 1.5 or 2 V below the positive rail, and you don't seem to be following this restriction.

Why? Is there some kind of rule I should know about comparators? Why exactly 2V less than Vcc?

Because the datasheet says so: The limit is 1.5 V below Vcc at 25 C (as shown above) or -2 V over the full operating temperature range (shown in the next table in the datasheet).

If your next question is, "But, really, why?", have a look at the schematic in the datasheet: If the input voltages get too close to the positive rails, the current sources shown will go out of regulation, so the circuit will not work as it does when biased properly.