Debouncing with OpAmp

Thread Starter

MikeA

Joined Jan 20, 2013
362
Hi, I have a circuit board with a 4-channel op-amp that is amplifying a signal using one of the channels. I'm feeding the amplified output to an Arduino and using an external interrupt to find the falling/rising edge.

But I'm getting bouncing on the edge as there is noise in the amplified signal. The signal is a sine wave between 0.1hz to 30hz or thereabouts.

I'd obviously like to eliminate the bounce, and I'm assuming I can setup a Schmitt trigger using one of the extra channels. The amplified signal ranges from about 0.5v to 3.5v, and I already have a voltage divider at 2.5v on the board that I can tap into.

How would my debounce circuit look like? And I'm assuming I need a capacitor-resistor pair that would have to match my sine wave frequency range to debounce it just right? :confused:
 

MrChips

Joined Oct 2, 2009
30,714
Yes, you can do it with an op-amp.
An op-amp with open-loop gain makes it a comparator. By adding positive feedback you give it hysteresis. That is what the schmitt trigger does.
 

Thread Starter

MikeA

Joined Jan 20, 2013
362


That would be perfect if I can just use the existing op-amp. How would I connect up the 2 channels of the LM324? Just take the output of one channel and connect it to the input of the other?
 

Thread Starter

MikeA

Joined Jan 20, 2013
362
Maybe I'm not getting the terminology right, but I think that's what I meant. Taking output from op-amp that is amplifying the sine wave and feeding it straight into input to the other opamp set up like the image above?
 

crutschow

Joined Mar 14, 2008
34,285
The circuit you show in post #5 looks fine for the Schmitt trigger. You can run it through another opamp if you want a non-inverted signal.
 

Thread Starter

MikeA

Joined Jan 20, 2013
362
So I've set up my LM324N with 5v Vcc, divider @ 2.5v (10K+10K) and a 28K resistor from output and V+. And got everything to work as I wanted, just had to blindly play with the resistor.

The 28K resistor gives me thresholds at 2.2v and 2.6v. But the simulator at the link(http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/schmitt.html) would suggest that my thresholds should be 1.3v and 2.8v.

Why the discrepancy? Is it because it's an op-amp and not a comparator? Are all comparators equal and that simulator would be true for all of them? Is there a way to simulate the same thing with an op-amp?
 

crutschow

Joined Mar 14, 2008
34,285
I tried the link simulator and it gave me thresholds of 2.14V and 2.62V, close to your calculations. Don't know how you got those other values.

Note that the simulator apparently assumes a high output voltage of 5V but the LM324 has a high output of a least a volt below the supply voltage, so that will affect the upper threshold in real life.

To get a more realistic simulation you can use a Spice simulator such as the free LTspice download from Linear Technology.
 

Thread Starter

MikeA

Joined Jan 20, 2013
362
I just tried it in different browsers (Firefox & Opera) and on a different computer. They all showed me the same 2.8V and 1.3V thresholds.

crutschow, can you please check it again? Maybe the NSA is doing something to my traffic. :D

Edit: I think you left the resistor at 100K, my circuit has 28K. But that still leaves the question why my real life test was so different from the simulator.
 

crutschow

Joined Mar 14, 2008
34,285
OK, I redid the website calculation and it now gives the values you show (which are not correct). So it appears to be some bug in the website calculations.
 
Top