# Adding hysteresis to a window comparator

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.

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:

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.

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.

• Of course Rsource=~0, then Rs/(Rs+Rf) = 0% of output= Hysteresis – Tony Stewart Sunnyskyguy EE75 Oct 28 '16 at 12:50
• How do you compensate for the fact that U2 is essentially receiving both positive (R13) and negative (R14) feedback at the same time? – Brad Thiel Oct 28 '16 at 22:58
• rioraxe, when you connect Vin directly to - pin of U2, and Vin through a resistor to + pin of U1....does the value of the Vin resistor stay the same as in your original response (R3||R4). Could you also share the equations used to find that Vin resistor value? – Brad Thiel Jan 11 '17 at 4:56
• The thevenin equivalent for (R3 and R4) is R3||R4 = 1/(1/R3+1/R4) = 878. When combined with the 100K fb resistor gives a hyteresis ratio of around 0.0087 or 43mV when multiplied by 5V swing for U2. So if you want the same hysteresis ratio for U1, use a 878 resistor between Vin and U1 + pin. – rioraxe Jan 11 '17 at 9:11

The solution for hysteresis uses the same "design logic" with R ratios as you would for gain with negative feedback except using positive feedback.

• The key here is to introduce a controlled source impedance and feedback R to give the desired ratio , e.g. 1% 1K source 100k feedback
• The other key is you need to modify the full scale deflection of the output so that your input signal must be always mid-scale to the full scale output ( attenuated by R ratios if necessary)

simulate this circuit – Schematic created using CircuitLab

• if the input signal has a poor SNR then it is wise to analyze the "useful" bandwidth of the signal and design a filter to match that spectrum, and notch the noise if possible.
• e.g. 4th order 5Hz LPF using dual OP Amp and 4 RC values
• If the noise is "mechanical" then add stiffeners.

Note the LT1720 has 2~7mV hysteresis and your signal has 100 mVpp noise while your thresholds are only 200mVpp apart. So although possible to make a clean toggle, I would reduce the noise 5:1 and increase hysteresis to 20mV