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.
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)
- 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