LM393N with hysteresis and potentiometer

comparatorinterruptspotentiometer

I am having a bit of a problem with this next circuit:

The problem is, when there is 0V at the base of Q1 and when the potentiometer is set close to 100 kOhm. Because of the hysteresis set on LM393N, I belive something like this happens:

Meaning the voltage on comparator will never pass ~3.4V to switch its output to high.
My question is, how can I avoid this from happening? How do I have to construct this circuit to work with a potentiometer?

How the circuit should work:

The base of Q1 is connected to IR receiver. When the IR beam is gets broken, the voltage on the base falls down to 0V and C1 starts to fill up through R1, R6 and R2. When voltage on C1 passes ~3.4V interrupt (rising edge) on AVR gets triggered. When the IR beam gets closed, the voltage on the base of Q1 rises to 5V, the capacitor discharges through R2 (which will be replaced by potentiometer in the future). And when the voltage on C1 goes below ~3.4V a second interrupt (falling edge) gets fired.
The capacitor is added to avoid false triggering, and the potentiomter is there to allow the "sensitivity" to be set.

Any help is greately appreciated!

Best Answer

You could increase R9 and R10 by an order of magnitude (22K and 1M). Increasing the resistors on the non-inverting input (eg. to 30K and 62K) would be slightly better in terms of evening out the bias current contributions.