Electronic – Adding hysteresis to a window comparator

comparatorhysteresisled

I have designed a window comparator and am finding it seemingly impossible to add hysteresis. Below is the basic circuit before attempting to add hysteresis.
enter image description here

Now I add a feedback resistor to the positive input of both op amps in an attempt to add hysteresis and this is the result:
enter image description here

The hysteresis seems to only be applied to U2, where the reference voltage is on the positive input. When the reference voltage is on the negative input, as it is for U1, it doesn't do anything. Putting the feedback resistor for U1 on the negative input screws up the whole thing too. This is what is confusing me. Is there a way to do this? The reason I want to add hysteresis is because the LED flickers when you are near the reference voltages, since the input voltage is from an accelerometer and is very sensitive to change.

Best Answer

The reason is probably because Vin is driven with relatively low resistance.

If you want approximately the same amount of hysterisis on U1 comparing to U2, a simple way would be to put the equivalent of R3||R4, around 1.1K 878\$\Omega\$, in series of Vin coming in.

There is a small side effect of doing that -- it does shift the high ref level a little, which you can compensate if you want.


In my original answer above, I didn't see the easy connections to not have the positive feedback from U1 affecting U2. The connections should be Vin through a resistor to + pin of U1 and Vin directly (not through the resistor) to the - pin of U2.