Author Topic: comparator's with hysteresis  (Read 3705 times)

0 Members and 1 Guest are viewing this topic.

Offline CameronHanson20Topic starter

  • Contributor
  • Posts: 11
comparator's with hysteresis
« on: March 18, 2015, 11:35:33 pm »
Hello everybody, so I have been playing around with comparator's and positive feedback after watching w2aew's video on analog control for a rc servo motor. The link to it ishttp://m.youtube.com/watch?v=iaGZOO33Z-o. I'm having a bit of trouble with the calculations. In the video, he has some formulas. Vth = vref + vref(R1\R2) and vth = vref - vref(R1\R2). My question is why is it a proportion of R1 and R2 instead of the voltage divider rule. I've attached a picture of some of my math. I'd like to know if I'm doing the calculations correctly as well.
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21609
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: comparator's with hysteresis
« Reply #1 on: March 19, 2015, 10:17:23 am »
I haven't watched the video so I don't know exactly how he's defined the thresholds; but...

The main problem with positive feedback is, you don't have one threshold, it splits into two, the rising and falling thresholds.

The analysis is simple.  When the comparator is in the output-high state, evaluate the node voltages and all that.  You'll see the voltage gain (meaning, from Vin to +in) is defined by resistor ratios, and the threshold by Vout, Vref and some resistor ratios.  Repeat the process for the output-low state.

Once you've done that, subtract the two thresholds, and you have the hysteresis band Vhyst.

Now, if you prefer to think in terms of a single threshold, you can average them together.  The meaning of a single threshold with hysteresis is, at Vth, you must either add or subtract slightly more than Vhyst/2 to cause the comparator to change state.  It's a symmetry point, because the amount added or subtracted, that causes it to change state, is equal.

Just from your description anyway, I don't understand which definition he's using, because you only mention a single threshold, no hysteresis band, and none of the relations depend on Vout.  As I say above, it is possible to define a meaningful "threshold" (that is, a single one) for such a circuit, but it's not clear if this is what is meant; and in any case, it is insufficient information, because two thresholds means two thresholds, period, no matter what: a complete definition must always be either: the two thresholds as such, or the average with hysteresis band.

Note that, since the threshold depends on the output voltage, it further matters what type of comparator is used, and what circuit it is used within.  Comparators are often open-collector output types, which require a pull-up.  If the pull-up is a resistor (and the load doesn't affect the voltage at all), then this resistor is in series with the feedback resistor when the output is high, but not when it is low.  If the output voltage is constrained (a typical application would be: the OC comparator drives a bipolar transistor base, which means it's clamped to +0.7V when "high"), then that must be used in the analysis.  If the output is active driven (typical of some general-purpose comparators, and many high-speed comparators), you use V_OH and V_OL in the analysis.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11790
  • Country: us
Re: comparator's with hysteresis
« Reply #2 on: March 19, 2015, 11:37:19 pm »
Yeah, double post.

Anyways, here is a screen shot from Alan's video showing the comparator schematic and the calculations for the rising and falling thresholds.

If you examine the diagram and the annotations you can verify the expressions shown.



My question is why is it a proportion of R1 and R2 instead of the voltage divider rule.
Understanding is more important than rules. If you don't have understanding you may apply "rules" incorrectly and get wrong answers.
 

Offline CameronHanson20Topic starter

  • Contributor
  • Posts: 11
Re: comparator's with hysteresis
« Reply #3 on: March 20, 2015, 12:41:39 am »
Sorry about the double post. My question really comes down to why is it R1/R2 instead of R1/(R1+R2)?
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11790
  • Country: us
Re: comparator's with hysteresis
« Reply #4 on: March 20, 2015, 12:49:16 am »
Sorry about the double post. My question really comes down to why is it R1/R2 instead of R1/(R1+R2)?

Well, assume the comparator has a single rail supply that goes from 0 to +Vcc, and assume that the rail-to-rail output can swing all the way between 0 and +Vcc likewise. Now consider the switching condition when the output is low and the input is rising. At the time that the switch happens, write down an equation relating Vin, Vref, R1 and R2. What equation do you get? How does this equation compare to what Alan shows in the notes?
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 2051
  • Country: nl
Re: comparator's with hysteresis
« Reply #5 on: March 20, 2015, 12:59:31 am »
You can work it out real quick yourself. Apply two simple characteristics about an ideal opamp.

1) virtual ground between the + and - output. As in, V- (the negative input of the opamp) is at Vref voltage. Due to that virtual ground the V+ (positive opamp input) is also at a voltage of Vref.

2) no current flows into the opamp inputs. So you have your Vinput on one side of that R1 resistor and Vref is the potential on the other side. That gives you the current flowing through that resistor R1. And since  no current is flowing into the opamp at the V+ node, all that current flows through R2 to Vout. And that allows you to work out Vout...
 

Offline CameronHanson20Topic starter

  • Contributor
  • Posts: 11
Re: comparator's with hysteresis
« Reply #6 on: March 20, 2015, 01:24:16 am »
I have come up with an equation. It looks similar to Alan's except for the(R1\R1+R2). I have attached a photo. I just cannot figure out why he uses just (R1\R2).
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11790
  • Country: us
Re: comparator's with hysteresis
« Reply #7 on: March 20, 2015, 01:52:17 am »
I have come up with an equation. It looks similar to Alan's except for the(R1\R1+R2). I have attached a photo. I just cannot figure out why he uses just (R1\R2).

OK, then, let's see.

Well, assume the comparator has a single rail supply that goes from 0 to +Vcc, and assume that the rail-to-rail output can swing all the way between 0 and +Vcc likewise. Now consider the switching condition when the output is low and the input is rising. At the time that the switch happens, write down an equation relating Vin, Vref, R1 and R2. What equation do you get? How does this equation compare to what Alan shows in the notes?

If the output can swing from rail to rail and the output is low, then the output will be at 0.

At the time the switch happens, we know that the voltages will be equal on the two input terminals. So V+ = V- = Vref.

What equation can we write down for this condition? Well, we know that the current in R1 must equal the current in R2 (because where else can it go?). So let's write down that equation:

    Current in R1 = Current in R2

    Current in R1 = (Vinput - Vref) / R1

    Current in R2 = (Vref - 0) / R2

Therefore:

    (Vinput - Vref) / R1 = (Vref - 0) / R2

Multiplying by R1:

    Vinput - Vref = Vref * R1/R2

Then moving Vref to the right hand side:

    Vinput = Vref + Vref * R1/R2

This is Alan's equation for the positive going threshold. You can do a similar analysis for the negative going threshold.
 

Offline CameronHanson20Topic starter

  • Contributor
  • Posts: 11
Re: comparator's with hysteresis
« Reply #8 on: March 20, 2015, 02:06:51 am »
Ohhhhhhhh. I get it now. I was thinking of adding in the voltage by doing a kvl and kcl. I didnt need to do that :p i feel silly now. Thats where I was getting the voltage divider because I was told that it feeds a portion of the ouput back to the input. Thats why I used the voltage divider formula. But anyways. Thank you. I really appreciate you helping me. :)
 

Offline w2aew

  • Super Contributor
  • ***
  • Posts: 1780
  • Country: us
  • I usTa cuDnt speL enjinere, noW I aR wuN
    • My YouTube Channel
Re: comparator's with hysteresis
« Reply #9 on: March 20, 2015, 02:32:10 am »
Thanks for the backup, IanB!
YouTube channel: https://www.youtube.com/w2aew
FAE for Tektronix
Technical Coordinator for the ARRL Northern NJ Section
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21609
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: comparator's with hysteresis
« Reply #10 on: March 20, 2015, 07:11:14 am »
Tricky part about a divider between things is, don't forget to subtract the baseline, then add it back in at the end.

For voltages V1 and V2 at either end of a voltage divider, the middle voltage is:
V1----R1----Vm----R2----V2
When V2 == 0, we have Vm' = V1' * R2/(R1+R2).  But this isn't the case now, hence writing the other voltages as prime.  We need to subtract V2 to offset both nodes correctly:
Vm - V2 = (V1 - V2) * R2/(R1+R2)
which can be rearranged to
Vm = V1 * R2/(R1+R2) - V2 * R2/(R1+R2) + V2
= V1 * R2/(R1+R2) + V2 * [1 - R2/(R1+R2)]
= V1 * R2/(R1+R2) + V2 * [(R1+R2) - R2]/(R1+R2)
= (V1*R2 + V2*R1) / (R1+R2)
Which looks like the weighted average of the two voltages, the one voltage being weighted by the opposite side resistor, which might seem strange to say, but makes sense given the nature of the voltage divider.

If R1=R2 (which is the case in the picture, at Vref = Vcc/2 -- thanks Ian), the weights go away and you get the simple average.  Stuff like that.

So, it appears it's a much simpler, specific case, not a general case example or formula -- as said, watch out how you apply it!

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf