[SOLVED] LM339 with Hysteresis - maths not matching results?

Status
Not open for further replies.

Picit

Newbie level 5
Joined
Dec 16, 2012
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,372
I'm using an LM339 as a non-inverting comparator with Hysteresis.

I'm using the circuit provided in the datasheet (see attached image) but my results don't match the maths?



I'm getting close to my desired output using trial and error, but can anyone help me with the calculations:

My values are:
Vcc is 5V
GND = 0V

Rref 14.7k
R1 10k
R2 330k
R3 1M

Vin is a 0-3v analog signal.

Actual Results
VO goes high at 2.63v and goes low at 1.07v using the formulas provided I get very different theoretical results.

Calculated Results
VOHigh : 2.64
VLOw : 1.40
Vref : 2.03

Any help in calculating the actual results would be much appreciated. Thanks.
 
Last edited:

I think your calculations assume the LM339 output goes all the way up to +5V and all the way down to 0V. You need to measure the actual V0(max) and V0(min) and base your calculations on that.
 

The error is due to the tolerance in the resistors you are using. If you use high precision resistors you will get more accorate results but with added cost.
 

I think your calculations assume the LM339 output goes all the way up to +5V and all the way down to 0V. You need to measure the actual V0(max) and V0(min) and base your calculations on that.

Thanks for the response. Using a scope the output does goes rail to rail 0-5V. Are you suggesting that I should use the amount of hysteresis instead?

- - - Updated - - -

The error is due to the tolerance in the resistors you are using. If you use high precision resistors you will get more accorate results but with added cost.
Thanks for your response. I had considered that. However, if I allow for a 5% error in all the resistors my calculated Vlow is still 1.34v. That's way off the 1.07v that I'm actually getting. Hence there appears to be something more fundamental wrong.
 

Your measured results seem about right. I am not sure how you arrive at your calculated values but the hysteresis will be non-symetrical about the 2V reference. This is because your output voltage is not symetrical about the 2V reference.

When the output is at 5V, the input will trigger when (2V-Vin)/330k = (5V-2V)/1M or around 1.01V. This ignores the input bias current (and approximates Vref to 2V). How did you get 1.4v?

Keith.
 
Reactions: Picit

    Picit

    Points: 2
    Helpful Answer Positive Rating
How did u calculte VLow and VHigh? I think you made some mistake in calculation.
 


Hi Keith. I didn't realise that the hysteresis would be non-symetrical. The way I calculated it was to use the formula from the datasheet (attached above) and then split VH equally about the reference point. So:

Vref =
VCC*R15 * 10k
------------------------
Rref + R114.7k + 10k
Giving a Vref of 2.024V

VH =
R2330k
---------* VO(max)-VO(Min)------------ *5
R2 + R3330k + 1M
Giving a VH of 1.24V (Hysteresis)


I then assumed that 1.24V would be symetrical around the Vref point:

1.24v
-----
2 =0.62V Therefore VHigh = 2.64V (Vref of 2.02V + 0.62V) and VLow = 1.40V (Vref of 2.02V - 0.62V)

I accept I've probably done this completely wrong, hence I'm requesting help. Thanks for your time it's appreciated.
 
Last edited:


Thanks. The ON Semiconductor equation is wrong. It will give the correct answer for small values of hysteresis, but not large values. However, as the correct equation, show on page 17 of the ST document is even simpler, I don't know why they don't use that!

Hopefully now you have the correct equations you will have no problem getting the right answers.

Keith
 


Keith, thank you very much. I would never have worked out that the equation was wrong. I thought it was my maths.
You've been extremely helpful, I spent a lot of time trying to solve it. Thanks once again.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…