2
\$\begingroup\$

I have build a schematic to read a counter. The counter has a white point at one of the digits, that I detect with a IR transmitter-receiver. The voltage at the receiver changes from 2.2 to 2.5 volts (with some noise between) when te white point passes. So I use a opamp diff amplifier to change the voltage range to 1 - 3 volts. That signal goes to opamp comparator that changes at 2.2 volt input. I measured the voltage and indeed, only when the white point passes, the voltage is more than 2.2 volts The output from the last one goes to a arduino that I programmed to count the signal via a interrupt. The problem is now that I have false counts, but I cannot find why. I use a software debounce that is sure big enough to avoid false detections caused by bounces. I think it has something to do with the hardware. Hereby a schematic. Unfortunatly I have no scoop...

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ My preference would be to go for a software-only solution: let the Arduino A/D the fotodiode input at a regular bas (1kHz?). You can log what you sample, and analyse at your leisure when something goes wrong. \$\endgroup\$ – Wouter van Ooijen Dec 15 '13 at 20:47
2
\$\begingroup\$

You might need to apply hysteresis to OA2 - this has the effect of minimizing the effect of noise as the signal from OA1 gets close to the threshold point defined by R7. Try a 1k ohm in series with the signal from OA1 to non-inverting input of OA2 and something like a 100k to 1M ohm from output of OA2 back to its non-inverting input. The size of this feedback resistor will set the amount of hysteresis.

\$\endgroup\$
0
\$\begingroup\$

I agree with Andy's recommendation for hysteresis, and I want to also suggest that you use a better op amp than the LM358. With a supply voltage of 5V you can't guarantee that the output voltage of an LM358 will get any higher than about 3.5V, which is a pretty sloppy logic 1 level. You should look for an op amp that has a "rail-to-rail" output instead.

\$\endgroup\$
  • \$\begingroup\$ Thanks! Can you advice better opamps for that issue? \$\endgroup\$ – WannesNaf Dec 15 '13 at 20:28
  • \$\begingroup\$ Try an AD8605 - it's fast enough and is a general all-round good R2R op-amp for 5V systems \$\endgroup\$ – Andy aka Dec 15 '13 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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