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!


1 Answer 1


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.

  • \$\begingroup\$ Increasing them to 22k and 1M works! Just one more question, what did you mean with the second option? Evening out the beas current contributions? \$\endgroup\$
    – Golaž
    Commented Feb 19, 2014 at 17:45
  • \$\begingroup\$ Worst case bias current is 400nA on the LM393, so that causes an error of about 9mV. By equalizing 22K||1M ~= 30K||62k, the maximum error is reduced to half, and typically to well under 1mV. \$\endgroup\$ Commented Feb 19, 2014 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.