Comparator Output Chatter

Thread Starter

Management

Joined Sep 18, 2007
306
Does anyone know a good way to remove chatter from the output of a comparator circuit?

Current situation:
I have a sample of a digital pot and I was attempting to program it. I figured I could just use some manual analog switch on the input of a comparator circuit to provide the necessary digital high and low signals. The circuit is doing what it is suppose to do but there is some serious chatter (I think it is) on the input signal to the digital pot when I flip a switch. Granted I did connect the output of the comparator straight to the digital pot input.

Attempted:
I tried to add a filter to where the switch is (before the comparator) but it did not seem to help.

Can anyone help me figure this out? I appreciate it.

Dru
 

Thread Starter

Management

Joined Sep 18, 2007
306
I forgot to add that piece of information. Let me describe this chatter (if it is actually chatter).

When I switch from low to high, the output signal goes high as it is suppose to but sometimes goes back low and back to high. Sometimes does it more than once. All the way back down to low.

Would hysteresis still help because it is not like there is just a little noise but looks like I flipped the switch repeatedly when I only switched it once. Basically it will always past the set thresholds and cause the digital pot to be tricked.

Thank you for the quick response.

Dru
 

Papabravo

Joined Feb 24, 2006
21,159
Hysteresis in not just for handling noise but also slow transitions. A comparator is basically a very high gain amplifier that magnifies small voltage differencesbetween the two inputs. Taht is why you seldom if ever see a comparator in the linear range. What hysteresis does is require that once a transition is made it is not sufficient for a small excursion to make it switch back, but rather a fairly large change in input in the opposite direction is required to make the comparator switch back. This action needs to work in both directions.
 

Audioguru

Joined Dec 20, 2007
11,248
The datasheets for most comparators recommend adding a little positive feedback as hysteresis to prevent oscillation when the inputs are at the threshold voltage.
The hysteresis causes the output to switch very quickly in a snap action.
 

mik3

Joined Feb 4, 2008
4,843
As i have understood you are using a switch to set the input to high or low. With switches there is a small problem when used in digital circuits for this purpose. The problem is that when you change the position of the switch the contact inside it change its position too but it bounces (opens and closes for a few times) a bit before remains stationary at its new position. These small bounces are 'seen' by the digital circuit as pulses, so it respond to these pulses by toggling your output between your minimum and maximum output voltage in this case. One solution is to use a set-reset flip flop to eliminate this effect of bouncing. Search in google for these flip flops to see how they work. If you want more detail give me more information about your project to help you if i can.
 

Thread Starter

Management

Joined Sep 18, 2007
306
OK I scan the posted link and notice that the RC after the switch will help slow down the signal so that the bouncing can pass. Plus it is not an actually comparator IC but just a regular opamp. All I want to do is to get rid of this bouncing action.

Is increasing 'C1' enough to help eliminate this.

Here is a picture of my circuit.
 

Attachments

Audioguru

Joined Dec 20, 2007
11,248
I think the comparator's reference voltage is not regulated so it changes the comparator's threshold voltage slowly when a switch is changed position. So the comparator's output goes down then up then down finally.
 

Thread Starter

Management

Joined Sep 18, 2007
306
Is that what causes the it? It just does not happen once, it goes up and down a fews times like the bouncing described in the .pdf file.

Although you are right though because the reference drops just a tiny bit but I didn't think was was enough to cause this bouncing.

Again thank you for the quick responses.

Dru
 

Audioguru

Joined Dec 20, 2007
11,248
The OPA277 is not a comparator. It is a very slow opamp with the same poor high frequency response (9kHz) as an old 741 opamp. But its input offset voltage is very low and it will work fine with some positive feedback.
 

Thread Starter

Management

Joined Sep 18, 2007
306
Just letting people know that I got it working. I just de-bounced the switch with a RC network as it was described in the PDF document link. It was a good read for a young engineer.

Thank you.

Dru
 
Top