# Hysteresis of a voltage comparator

• akaliuseheal
In summary: LED. The comparator is being powered by a 12V voltage source and the resistors used are not known. The ideal hysteresis voltage is a little bit more than the peak-to-peak noise content of the Vin signal, and for a production circuit in a quiet environment, it is recommended to use three to five times the standard deviation of the noise. The purpose of R3 in the circuit is to pull the output pin to a high state, and it is necessary to calculate its value based on the desired output voltage. The LM393 comparator is being used and it is important to choose resistors that
akaliuseheal
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.

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.

#### Attachments

• 123.PNG
3.1 KB · Views: 2,784
• 456.PNG
44.3 KB · Views: 1,214
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.

akaliuseheal and Tom.G
akaliuseheal said:
What is the ideal hysteresis voltage, ...?

I'd say a little bit more than the peak-to-peak noise content of your Vin signal.

sophiecentaur and akaliuseheal
jim hardy said:
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).

akaliuseheal
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.

Baluncore said:
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.

Baluncore said:
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?

akaliuseheal said:
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 let's 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

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

25.7 KB · Views: 1,100
here's a tutorial on comparators
https://www.electronics-tutorials.ws/opamp/op-amp-comparator.html

jim hardy said:
here's a tutorial on comparators
https://www.electronics-tutorials.ws/opamp/op-amp-comparator.html

Okay, so, if I were to use lm393 and if I wanted UTP = 0.6, LTP = -0.6

±(R1 / R1 + R2 ) * V
±( 56 / 56 + 1000 ) * 12 ≈ 0.6
R1 = 56Ω
R1 = 1000Ω

How would I calculate R3?
I don't really know how to read datasheet and on the output I need voltage of 5V.

akaliuseheal said:
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

jim hardy said:
Recalculate R1 and R2 using Vout of 5 volts

100 / ( 100+140 ) * 12 = 5
R1 = 100Ω, R2 = 140Ω

jim hardy said:
Then calculate R3 to make a voltage divider with your new R1 & R2 to give 5 volts at Vout.

How do you mean?

akaliuseheal said:
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.

akaliuseheal
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.

Tom.G
jim hardy said:
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

jim hardy
You're catching on quick !

Study the application hints in datasheets
and become familiar with device ratings.

akaliuseheal
jim hardy said:
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

jim hardy
I hope you build one and it works great...

old jim

dlgoff and akaliuseheal
jim hardy said:
I hope you build one and it works great...

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 Ω

i was away too , will have to get back up to speed. I don't think i checked your calculations - would you show them ?

jim hardy said:
i was away too , will have to get back up to speed. I don't 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

akaliuseheal said:
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

## 1. What is the definition of hysteresis in a voltage comparator?

Hysteresis in a voltage comparator is the difference in input voltage required for the comparator to change its output state. It is also known as the "threshold" or "sensitivity" of the comparator.

## 2. How does hysteresis affect the performance of a voltage comparator?

Hysteresis in a voltage comparator helps to reduce the effects of noise and signal fluctuations. It also improves the stability and accuracy of the comparator's output by preventing rapid switching between states.

## 3. What is the importance of selecting the right hysteresis value for a voltage comparator?

The hysteresis value is crucial in determining the accuracy and stability of a voltage comparator. If the hysteresis value is too low, the comparator may be susceptible to false triggering and noise. If the hysteresis value is too high, the comparator may become sluggish and unresponsive.

## 4. How is hysteresis implemented in a voltage comparator circuit?

Hysteresis is typically implemented in a voltage comparator circuit by adding a feedback resistor between the output and the non-inverting input terminals. This creates a positive feedback loop that increases the hysteresis and improves the stability of the comparator.

## 5. Can hysteresis be adjusted in a voltage comparator circuit?

Yes, hysteresis can be adjusted in a voltage comparator circuit by changing the value of the feedback resistor. Increasing the feedback resistor increases the hysteresis, while decreasing it decreases the hysteresis. It is important to select the appropriate hysteresis value for the specific application of the comparator.

• Electrical Engineering
Replies
4
Views
2K
• Electrical Engineering
Replies
38
Views
2K
• Electrical Engineering
Replies
12
Views
924
• Electrical Engineering
Replies
5
Views
2K
• Electrical Engineering
Replies
2
Views
1K
• Electrical Engineering
Replies
4
Views
2K
• Electrical Engineering
Replies
12
Views
2K
• Electrical Engineering
Replies
15
Views
2K
• Electrical Engineering
Replies
2
Views
1K
• Engineering and Comp Sci Homework Help
Replies
13
Views
2K