Hysteresis of a voltage comparator

  • #1
Hello,
I am designing a circuit which basically takes two voltages (V1,V2) and based upon which one of the two is greater, turns corresponding LED. So, I have got to the part where I have output from differential op amp that is the input of the inverting voltage comparator with hysteresis. Comparator compares that voltage with ground, which tells me whether that voltage is positive or negative or V1>V2 , V1<V2 . Comparator is shown bellow.
123.PNG

Minimal input voltage is ±0.72V, voltage used to power the comparator is 12V, resistors are not known.

Questions:

  1. What is the ideal hysteresis voltage, a little less than minimal input voltage?
  2. I have found some expressions in the book and if someone is willing to clarify them( which value is which apart from the resistors ) it would help.
It says:
Output voltage will change based upon voltages given by these expressions.
456.PNG
 

Attachments

Answers and Replies

  • #2
Baluncore
Science Advisor
8,672
3,347
It takes very little hysteresis to switch cleanly. 5 mV was built into many comparators in the good old days.
The hysteresis should be greater than (Output voltage swing) / (open loop gain).

A voltage comparator can operate with a big differential input voltage. But an Op-amp is designed to operate in a closed loop with very low differential input voltage. You will need to check that your selected op-amp behaves well as a comparator.
 
  • Like
Likes akaliuseheal and Tom.G
  • #3
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,839
4,881
What is the ideal hysteresis voltage, .....?
I'd say a little bit more than the peak-to-peak noise content of your Vin signal.
 
  • Like
Likes sophiecentaur and akaliuseheal
  • #4
Tom.G
Science Advisor
3,700
2,387
I'd say a little bit more than the peak-to-peak noise content of your Vin signal.
For experimenting that's fine, and you can always increase it if needed.

For a production circuit in a moderately quiet environment, I would say three to five times the standard deviation of the noise to handle its random nature. In a noisy environment, three to five times the highest peak noise you have observed (and add some filtering).
 
  • Like
Likes akaliuseheal
  • #5
Baluncore
Science Advisor
8,672
3,347
We need more information about the noise profile of your signal.
Also, what do you mean, or how do you define “minimal input voltage” = ±0.72V.

When the comparator switches between low and high output voltages, that voltage swing appears at the non-inverting input, attenuated by the R1 + R2 potential divider.
 
  • #6
We need more information about the noise profile of your signal.
Also, what do you mean, or how do you define “minimal input voltage” = ±0.72V.
Input comes from differential op amp which takes two fixed values of voltage(14 total fixed values that originate from representation of resistance as voltage in the first step of the device). ±0.72V being the closest to 0.
About the noise, this won't be commercial product and I'm a beginner in this. I have no information about noise.

When the comparator switches between low and high output voltages, that voltage swing appears at the non-inverting input, attenuated by the R1 + R2 potential divider.
But, what is the purpose of R3?
 
  • #7
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,839
4,881
But, what is the purpose of R3?
R3 is called a "Pull Up Resistor".
Its purpose is to "pull" the output pin to a high state.
That lets you use the comparator to drive logic level circuits where the maximum permissible voltage might be 5 or 3.3 volts not the 12 used by your analog circuitry.

Many comparators are built with no internal output current (high) drive for their output pin, they can only sink current to pull the pin low.
That's on purpose so you can use them to interface between analog and logic circuits that use different supply voltages , and to let you connect several outputs in parallel for "wired or" logic.
It's called "Open Collector" or "Open Drain" .
here's the inside of a TI LM139 comparator , from http://www.ti.com/lit/ds/symlink/lm239a.pdf

upload_2018-9-11_4-33-25.png


So, to your question - R3 provides current to drive the output to its high voltage state, ie "Pull it up" .

What comparator are you using ?

old jim
 

Attachments

  • #10
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,839
4,881
How would I calculate R3?
I don't really know how to read datasheet and on the output I need voltage of 5V.
Recalculate R1 and R2 using Vout of 5 volts
Then calculate R3 to make a voltage divider with your new R1 & R2 to give 5 volts at Vout.


old jim
 
  • #11
Recalculate R1 and R2 using Vout of 5 volts
100 / ( 100+140 ) * 12 = 5
R1 = 100Ω, R2 = 140Ω

Then calculate R3 to make a voltage divider with your new R1 & R2 to give 5 volts at Vout.
How do you mean?
 
  • #12
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,839
4,881
How do you mean?
5 volts across (100 + 140 )ohms = 5 / 240 = 0.02083 amp,
and when output is 5 volts that current must all flow down through R3 because the open drain can't source current It can only sink ..
So,
What value of R3 would drop the remaining 7 volts between your Vo pin and your 12 volt VDD source ?

R = E/I = 7 / 0.02083 = 336 ohms

That of course neglects any current required by whatever the Vo pin drives.
And one should check the datasheet to make sure the device is rated to sink those 20.83 milliamps.
 
  • Like
Likes akaliuseheal
  • #13
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,839
4,881
LM393 datasheet says, in line "Output Sink Current" the chip will sink at least 6 milliamps and typically 16 milliamps.
So good design using that comparator would suggest use of higher values for R1 R2 and R3.

Can you find three resistors that give your desired trip and reset points yet only require the IC to sink 6 ma ?

That would be a good design.
 
  • Like
Likes Tom.G
  • #14
Can you find three resistors that give your desired trip and reset points yet only require the IC to sink 6 ma ?

That would be a good design.
Well, R1 = 342 and R2 = 480
Gives:
I = 5 / ( 342 + 480 ) = 0.006 amps
R = 7 / 0.006 = 1167 ohms
 
  • Like
Likes jim hardy
  • #15
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,839
4,881
You're catching on quick !

Study the application hints in datasheets
and become familiar with device ratings.
 
  • Like
Likes akaliuseheal
  • #16
You're catching on quick !

Study the application hints in datasheets
and become familiar with device ratings.
Huge thanks to you, thank you for your time.

Edited
 
  • Like
Likes jim hardy
  • #17
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,839
4,881
I hope you build one and it works great....
Good luck in your studies..

old jim
 
  • Like
Likes dlgoff and akaliuseheal
  • #18
I hope you build one and it works great....
Good luck in your studies..

old jim
Sorry to bother you, I was away for 3 days and I wanted to look over this thread again and I have also seen that you answered on that "reading datasheet" thread so thank you for that also.
Now, going thru it again, what confuses me is when we recalculated values of R1 and R2. Are those the new values of R1 and R2 and if not, why was that step necessary.

To sum it up:
R1 = 56 Ω
R2 = 1000 Ω
R3 = 1167 Ω
or
R1 = 342 Ω
R2 = 480 Ω
R3 = 1167 Ω
 
  • #19
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,839
4,881
i was away too , will have to get back up to speed. I dont think i checked your calculations - would you show them ?
 
  • #20
i was away too , will have to get back up to speed. I dont think i checked your calculations - would you show them ?
I figured out the correct values but I still don't see the point in this:
Recalculate R1 and R2 using Vout of 5 volts
Then calculate R3 to make a voltage divider with your new R1 & R2 to give 5 volts at Vout.
That was to calculate resistance of a pull up resistor so that logic 1 has value of 5V.
Why that step? When R = V / sink_current, where V = Vdd - voltage_wanted_on_the_output
 
  • #21
jim hardy
Science Advisor
Gold Member
Dearly Missed
9,839
4,881
but I still don't see the point in this:
That was to calculate resistance of a pull up resistor so that logic 1 has value of 5V.
Why that step? When R = V / sink_current, where V = Vdd - voltage_wanted_on_the_output
Look back at post #1 where you were uncertain about those equations from your book.

I just wanted you to start from scratch and figure out how to calculate the resistors , independently.

I hadn't checked those formulas myself so didn't trust them.
As you point out it's not a difficult calculation.

old jim
 

Related Threads on Hysteresis of a voltage comparator

Replies
2
Views
2K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
8
Views
985
  • Last Post
Replies
5
Views
5K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
6
Views
2K
  • Last Post
Replies
6
Views
4K
Replies
7
Views
10K
  • Last Post
Replies
5
Views
805
Top