Comparators using hysteresis

Discussion in 'General Electronics Chat' started by epsilonjon, Jul 3, 2012.

  1. epsilonjon

    Thread Starter Member

    Feb 15, 2011

    I'm just reading about how to use op-amps as comparators, and in particular how to use hysteresis to reduce noise effects. My book uses this circuit as an example:


    If I understand correctly, the basic idea behind positive feedback is that Vin is inverted at the output and passed back to the noninverting input, increasing the voltage difference between the inputs, which pushes Vout even higher/lower, etc, etc, until Vout is saturated either positive/negative?

    Say, for instance, Vout is saturated positive, then this sets an upper 'trigger' voltage at the noninverting input. When the voltage at the inverting input exceeds this trigger the output voltage will quickly saturate negative. This sets a lower trigger voltage, and when the voltage at the inverting input is less than this, the output will saturate positive again. And so it continues.

    That seemed to make sense to me, but when I tried to write down some equations I got confused. We can write

    V_{out} = A_{ol}V_d = A_{ol}(BV_{out} - V_{in})

    where A_{ol} is the open-loop voltage gain and B = \frac{R_2}{R_1+R_2}. Therefore

     \frac{V_{out}}{V_{in}} = \frac{A_{ol}}{BA_{ol}-1} = \frac{1}{B-\frac{1}{A_{ol}}} \approx \frac{1}{B} = 1+\frac{R_1}{R_2}

    which is the same as for the noninverting amplifier. No indication of the trigger voltages, and the output would only become saturated if I chose R1>>R2 so as to get enough gain. What have I done wrong in that analysis? :confused:

    Thanks for any help :)
    Last edited: Jul 23, 2012
  2. steveb

    Senior Member

    Jul 3, 2008
    Your analysis is correct, but your interpretation of the answer is not correct.

    You have derived an answer that says that a negative input will generate a negative (and amplified) output and a positive input will generate a positive (and amplified) output.

    Doesn't this contradict the obvious polarity of the circuit. It is clear that a negative input would have to create a positive output and vice versa. Basically, the circuit is not DC stable.

    Your analysis works when

    (A R2)/(R1+R2)<1

    The equations fails at the singularity (you can't divide by zero), when

    (A R2)/(R1+R2)=1

    And the equation becomes nonphysical beyond that when

    (A R2)/(R1+R2)>1

    Imagine gradually increasing A from 0 to infinity. The output would gradually increase in magnitude (with sign opposite the input) until it hits one of the rails, and then it could go no further. The math does not know about the saturation limit, so the math thinks the magnitude would continue to increase to infinity, when (A R2)/(R1+R2)=1. Then (as A is increased beyond 1) the math says the sign will change and the magnitude will come back down to a finite value. But, this can not happen in reality.

    To make an analogy. Think back to physics problems you've solved where you get nonsensical answer, such as a distance being imaginary or complex. Typically we ignore such answers as nonphysical.

    Hence, in this case, the result is nonsensical or nonphysical. It must be ignored and a more sophisticated analysis must be used.
  3. WBahn


    Mar 31, 2012
    The reason that you are getting the equation for a noninverting amplifier is because your analysis is making an unstated assumption that is not valid. You are assuming that a solution exists for which both (1) the equation given applies, and (2) is stable.

    In this case, the solution given by the final equation above is not stable and the two stable outputs (the +ve and -ve rails) do not obey the starting equation. Thus it is not possible to satisfy both conditions simultaneously.
  4. epsilonjon

    Thread Starter Member

    Feb 15, 2011
    Ah yeah, I do remember thinking that when I derived it actually, but it got lost in a cloud of other thoughts :p When you say "not DC stable", do you mean that if I were to put say a +1v dc source on the input, then in theory (if the supply voltage would allow it) the output would fly off to negative infinity? Of course it never will allow it, the op-amp saturates, and we get a maximum value.

    I think that makes sense to me. I don't quite get how my answer is correct for (A R2)/(R1+R2) < 1 though. Like you say, this ensures that a negative input will always give a positive output (and vice versa). But due to the hysteresis there should be times when a positive input does give a positive output, if you are going from low to high and you haven't reached the upper trigger voltage yet.

    Thanks for your help.
  5. steveb

    Senior Member

    Jul 3, 2008
    Basically yes, because you are analyzing under your linear circuit assumptions which do not include saturation limits. So, a finite DC input creates an unbounded output. Keep in mind that your model is highly idealized in that it assumes infinite gain (at least in your approximation), infinite bandwidth, no saturation limits and it implies zero delay time from input to output.

    In this real case, if A is very large, the instant you apply even a small positive Vin, the output wants to go to the negative rail, but this negative output is large and quickly comes back around to the + input terminal and makes it just a little bit more negative than ground. This will then latch the circuit into a stable state. It is not until Vin is moved to a sufficiently negative value that this latch condition will change, and then attain another stable state. This kind of latched (nonlinear) stability is different than the DC (linear) stability we often talk about.

    Well, when that condition is met, you don't really have a circuit with hysteresis. You actually have a linear amplifier (linear within the range of the rails).

    Think about it. If you bring the input near ground, the voltage on the + terminal will also approach ground. Once Vin equals ground, the + terminal will be at ground potential. But, this assumed you are in the linear range, and not hitting a rail on the output.

    Now the condition BA<1 implies many possible values of B and A because we only restrict BA<1. If A is large and B is small, such that AB<1, then it is likely that you will hit your rails, and your model will not be correct. But, if A is small and B is large, with AB<1, and if somehow you don't hit your rails, then the linear gain equation is correct. And, naturally, if B is zero, and Vin is small enough to prevent hitting the rails, then the equation is valid.
    epsilonjon likes this.
  6. Jony130

    AAC Fanatic!

    Feb 17, 2009
    epsilonjon likes this.
  7. epsilonjon

    Thread Starter Member

    Feb 15, 2011
    Sorry for the delay in replying. Your answers were all really helpful and I think I understand much better now. Thanks guys!