Comparator Output Chatter

Discussion in 'General Electronics Chat' started by Management, Feb 5, 2008.

  1. Management

    Thread Starter Active Member

    Sep 18, 2007
    306
    0
    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
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,178
    1,799
    You need to make a Schmitt trigger by adding hysteresis to the input. Here is a reference.

    http://en.wikipedia.org/wiki/Schmitt_trigger

    Even though the article only mentions doing it with an op amp you can also do it with a comparator. You use the output to change the comparator threshold in each of the states.
     
  3. Management

    Thread Starter Active Member

    Sep 18, 2007
    306
    0
    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
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,178
    1,799
    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.
     
  5. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    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.
     
  6. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    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.
     
  7. Management

    Thread Starter Active Member

    Sep 18, 2007
    306
    0
    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.
     
  8. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    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.
     
  9. Management

    Thread Starter Active Member

    Sep 18, 2007
    306
    0
    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
     
  10. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    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.
     
  11. Management

    Thread Starter Active Member

    Sep 18, 2007
    306
    0
    I'll try the positive feedback route then. Thank you. If it doesn't work then .. I'll be back.

    Dru
     
  12. Management

    Thread Starter Active Member

    Sep 18, 2007
    306
    0
    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
     
Loading...