# Need help with a homework (LM335 thermal controller circuit)

#### Jony130

Joined Feb 17, 2009
5,221
The first thing you need to do is to understand how "ideal" non-inverting Schmitt trigger work.

Maybe this will help For example if

Vcc = 5V; Vee = -5V and Vref = 0V ; R1 =10kΩ; R2 = 100kΩ

The VH = 10V * 10k/100k = 1V and the threshold voltage are

V1 = Vref - VH/2 = 0V - 1V/2 = -0.5V

and

V2 = Vref + VH/2 = 0.5V

In your circuit, you want the threshold voltage to be around V1 = 3.11V and V2 = 3.15V. Therefore Vh = V2 - V1 = 40mV and because you are using single supply voltage (Vcc = 12V and Vee = 0)

And now we can easily solve for R1 and R2.

Vh = Vcc*(R1/R2)

You need to shift the Vref voltage up to:

Vref = V1 + VH/2 = 3.11V +40mV/2 = 3.13V ( exactly speaking Vref = R2/(R1 + R2) * V2)

Because with a single supply V1 and V2 are equal to :

V1 = Vref - (Vcc - Vref)* R1/R2

V2 = (R1 + R2)/R2 * Vref = Vref + (Vref -Vomin)* R1/R2

Where Vomin - comparator output voltage at low state

Last edited:

#### SotosElec

Joined Apr 13, 2018
19
Alright, so we can first determine that R1 = 300*R2, since Vhys = 0.04 = 12*(R1/R2).
Having that, do we arbitrarily set a value for R1 or do we go along the path suggested on the PDF, where R1 is calculated? If so, then R1= 3.13MΩ (3MΩ for E24) and R2 = 3ΜΩ/300 = 10ΚΩ.
Setting the Vref with the pot should be as I theorised on a previous post:
Regarding the potentiometer, we know that the voltage at the R3, R4, R5 junction is going to be 5.6V (right?).
So the vP (voltage pot) at the inverting input will be:
vP = 5.6 (RP2 + R6) / (R5 + R6 +RP1 + RP2), where RP1 is the resistance between the pot's wiper and R5 and RP2 the resistance between the wiper and R6. The expression can be simplified, since RP1+RP2=10, so:
vP = 5.6 (RP2 + R6) / (R5 + R6 +10)
Since we want vP to be the average of the voltage levels of the LM355, then vP=(3.11+3.15)/2 = 3.13V
Thus 3.13 = 5.6 (RP2 + R6) / (R5 + R6 +RP1 + RP2).
3.13V roughly half of 5.6V, so R5 could be equal to R6. Let R5=R6=1K. Then RP2 can be calculated as follows:
RP2 = 3.13 (2*R5+10) / 5.6 - R6 = 3.13 (2*1+10) / 5.6 - 1 = 5.7K
So the pot should be set to 57% (or 43%?).
MrAI mentioned something about tweaking with R1.
Note we may have to go higher than 1k for that because this is such an unusual circuit.
I would intuitively set it to 1KΩ. I assume there is a mathematical way of determining its value.
As for R4 and R3 , I'm not entirely sure what values should be set.

Last edited:
Thread Starter

#### Matherios

Joined Feb 25, 2018
74
hi,
If you look at the last 2 pages of the PDF. Step 1
For the OPA it is referring to has a input leakage current of 2nA, so to swamp out the effect of this 0.2nA they have assumed a R3 current of 0.2uA .
The LM339 has an input leakage on 100nA so I have assumed a current of 1uA thru R3.
So R3 = Vref/IR3 = 3.13/1uA = ~3.0meg Ohms.

Ask if you have a problem.
E
Can u please explain me the leakage current for 311 cause i can't really understand it.So we determine r11 values.

Last edited:

#### MrAl

Joined Jun 17, 2014
8,066
Hello again,

The simultaneous equations i pointed out earlier do work, so if you do not get results then you did not do the solution correctly. This is not really a new method or anything either, it's a standard way of going about calculating values for components. When you only need to solve for one component, you only need one equation, but if you have to solve for two components, then you need two linearly independent equations. Once you have those two, the values fall out of the solution.

I guess i'll have to show the complete solution now because this is a little more complicated than the usual circuit and that is mostly because of the tight operating range of only 40mv. More often we see a range in the volts range, like 2v, 3v, etc., and in fact if someone tries to solve it that way i bet they come up with some better results. For example, change the trip points to 1v to 5v and try to solve that. The midpoint voltage will be 3v, so the two trip points are 2v below and 2v above.

To start, here is a better diagram. Last edited:

#### MrAl

Joined Jun 17, 2014
8,066
I worked out that:
vL=3.15*R11/(R10+R11) = vAVG = 3.13
=> R11 = 3.13/3.15*(R10+R11) => R11=0.99*R10 + 0.99*R11 => R11=99R10
that gives a ratio between R10 and R11, so R11 can be replaced by 99*R10 on the vH equation:

vH= ( (12*R10)/(R10+R1+R11) ) - ( (3.11*R11) / (R10+R11) ) =
=( (12*R10)/(R10+R1+99R10) ) - ( (3.13*99R10) / (R10+99R10) ) =
=( (12*R10)/(100R10+R1) ) - ( (3.13*99R10) / 100R10 ) = vAVG = 3.13

At this point I think it's impractical to figure out a relationship of R10 and R1, so I assumed R1=1KΩ, thus:
3.13 = ( (12*R10)/(100R10+1) ) - ( (3.13*99R10) / 100R10 ) which returns a negative value for R10...

Hello again,

I am not sure what you did, maybe mixed up the high and low values for vLM, but here are the EXACT resutls:

R10=R1/287
R11=R1*313/574

These results are not approximate, they are exact. That means the 'fan' would turn on at exactly 3.15v and turn off at exactly 3.11v, and that is again using the midpoint voltage 3.13v and that is not arbitrary.

Using 3.13v is not arbitrary. We want equal excursions up and down so that we get similar noise immunity for either comparator state on or off. We only change that if we have to, which we dont seem to have to do here.

What this does not include yet are the two resistors R8 and R9. The total series resistance of those two must be at least 10 times the value of R1, and granted we might modify the circuit a little to make it better.
Also, R1=10k is a better choice, but again a better circuit would be a good idea too if that is allowed.

Here are the two equations as used for the above solutions:
3.13=(3.15*R11)/(R11+R10)
3.13=(3.11*(R11+R1))/(R11+R10+R1)+(12*R10)/(R11+R10+R1)

You see these are exactly as stated previously in shorter terms.

#### MrAl

Joined Jun 17, 2014
8,066
Can u please explain me the leakage current for 311 cause i can't really understand it.So we determine r11 values.
Hi,

I dont think you should get that involved with it until you understand the basics.
The leakage current will just confuse the main issues here.

#### ericgibbs

Joined Jan 29, 2010
12,258
Can u please explain me the leakage current for 311 cause i can't really understand it.So we determine r11 values.
hi M,
Check the LM311 d/s.
I used the 100nA input bias current value times 10, ie: 1uA
If you look at the PDF I posted, it shows for a CMOS comparator the input leakage is 0.2nA, they recommended using 0.2uA.
E

Thread Starter

#### Matherios

Joined Feb 25, 2018
74
Hello again,

I am not sure what you did, maybe mixed up the high and low values for vLM, but here are the EXACT resutls:

R10=R1/287
R11=R1*313/574

These results are not approximate, they are exact. That means the 'fan' would turn on at exactly 3.15v and turn off at exactly 3.11v, and that is again using the midpoint voltage 3.13v and that is not arbitrary.

Using 3.13v is not arbitrary. We want equal excursions up and down so that we get similar noise immunity for either comparator state on or off. We only change that if we have to, which we dont seem to have to do here.

What this does not include yet are the two resistors R8 and R9. The total series resistance of those two must be at least 10 times the value of R1, and granted we might modify the circuit a little to make it better.
Also, R1=10k is a better choice, but again a better circuit would be a good idea too if that is allowed.

Here are the two equations as used for the above solutions:
3.13=(3.15*R11)/(R11+R10)
3.13=(3.11*(R11+R1))/(R11+R10+R1)+(12*R10)/(R11+R10+R1)

You see these are exactly as stated previously in shorter terms.
How did you came up with R10=R1/287 and R11=R1*313/574.
Also do you agree that R11=100*R10?

Thread Starter

#### Matherios

Joined Feb 25, 2018
74
hi M,
Check the LM311 d/s.
I used the 100nA input bias current value times 10, ie: 1uA
If you look at the PDF I posted, it shows for a CMOS comparator the input leakage is 0.2nA, they recommended using 0.2uA.
E
Why times 10?

#### ericgibbs

Joined Jan 29, 2010
12,258
hi M,
Post #57 explains the reason.
You have to choose a value for the current thru hysteresis resistor that is not affected by the smaller input leakage current.
Choosing a factor 10 increase means that the leakage current is a small percent of the hysteresis value.

Rhyst = Vref/1uA = 3.11v/1uA , = 3.1 meg Ohms

Have you worked thru the example on the last two pages of the PDF.?

E

#### MrAl

Joined Jun 17, 2014
8,066
How did you came up with R10=R1/287 and R11=R1*313/574.
Also do you agree that R11=100*R10?
Hi,

I have shown that i had solved the two equations in my previous post.
If you solve them for R10 and R11, you get that result.

And no, R11 is not equal to 100**R10. If you divide my R11 by my R10 you will get the relationship which is 313/2 not 100.

Go ahead and solve those two equations and see if you can match the results.

We seem to also have gotten into a second method of solving which i think Eric started.
It should be noted that the two methods will converge once we get farther with the first method (simultaneous equations). The big difference is the values we come up with before provide for a perfect balance between the upper and lower hysteresis thresholds, while the solutions with the large value resistors (10k, 3M) will be very unbalanced. I'll show more about this at some point.

To get the two methods to converge, we solve for the mid point voltage in a different way later. We end up with an unbalance however. Some unbalance is ok but too much is not good for such a small operating range.

#### MrAl

Joined Jun 17, 2014
8,066
hi M,
Post #57 explains the reason.
You have to choose a value for the current thru hysteresis resistor that is not affected by the smaller input leakage current.
Choosing a factor 10 increase means that the leakage current is a small percent of the hysteresis value.

Rhyst = Vref/1uA = 3.11v/1uA , = 3.1 meg Ohms

Have you worked thru the example on the last two pages of the PDF.?

E

Hi there Eric,

I am not sure if you are aware of this or not, but the method you are using will result in an unbalance between the upper and lower hysteresis levels. That simply means one higher than the other. How much difference this makes depends on how big the resistors are. A large value like 3M will produce quite a bit of unbalance, so i have to recommend keeping it lower.

We also are not dealing with non idealities yet but i am not sure if you are doing that or not. We want to show the basic method FIRST, then proceed to more complex ideas. Dont you agree?

The method you use will converge with the method i use shortly. I was taking it one step at a time waiting for the OP to absorb some of the basics first.

Here is a screen shot of the circuit with approximate values 10k and 3M.
Note how the blue wave is not centered anymore because placing the trip points at precisely the values needed requires altering the mid point voltage when non optimum resistor values are used such as 10k and 3M.

Last edited:

#### SotosElec

Joined Apr 13, 2018
19
And no, R11 is not equal to 100**R10. If you divide my R11 by my R10 you will get the relationship which is 313/2 not 100.
Since it's
3.13=(3.15*R11)/(R11+R10)
then it can be transformed like this:
3.13*(R11+R10)=3.15*R11
=>R11=3.13/3.15*(R11+R10)
=>R11=0.99*R11+0.99*R10
=>0.01*R11=0.99*R10
=>R11=99*R10
Am I doing something wrong with math?

#### ericgibbs

Joined Jan 29, 2010
12,258
Note how the blue wave is not centered anymore because placing the trip points at precisely the values needed requires altering the mid point voltage when non optimum resistor values are used such as 10k and 3M.
Morning Al,
I agree it is always a good idea to introduce the student to the basic method first.
The method I have shown is a version I have used in many practical projects.
I hope that you will post a circuit that shows the method that you are using, always interesting to compare results.

Eric

#### SotosElec

Joined Apr 13, 2018
19
Alright, one way or another the resistors for achieving the desired hysteris are calculated. What about R3 and R4 ? What's their purpose?

Last edited:

#### ericgibbs

Joined Jan 29, 2010
12,258
hi Soto,
Which posted circuit image are you referring too.?
R4 5
E

#### MrAl

Joined Jun 17, 2014
8,066
Morning Al,
I agree it is always a good idea to introduce the student to the basic method first.
The method I have shown is a version I have used in many practical projects.
I hope that you will post a circuit that shows the method that you are using, always interesting to compare results.

Eric
Hi,

Sure, no problem.
I forgot to mention that i posted a more clear picture where i fixed the R numbers so we could read them easily. I hope that helps.

#### MrAl

Joined Jun 17, 2014
8,066
Since it's
3.13=(3.15*R11)/(R11+R10)
then it can be transformed like this:
3.13*(R11+R10)=3.15*R11
=>R11=3.13/3.15*(R11+R10)
=>R11=0.99*R11+0.99*R10
=>0.01*R11=0.99*R10
=>R11=99*R10
Am I doing something wrong with math?
Hi,

Well sorry to say, but yes, you are rounding too much. Try this for your fourth equation above instead:
R11=0.99365079365079*R11+0.99365079365079*R10

You'll get the same results as me Or better yet, carry the fraction 313/315 farther until the very end.

• SotosElec

#### MrAl

Joined Jun 17, 2014
8,066
Alright, one way or another the resistors for achieving the desired hysteris are calculated. What about R4 and R5 ? What's their purpose?
Hi,

You mean R5 and R6 of the original circuit?

They are there to limit the adjustment range so that the user does not have to turn the pot knob very, very carefully once they get near the right set point. With those two resistors, a large turn of the pot resutls in a much smaller change of the reference voltage. That makes it easier to adjust, especially since the worknig range is only 40mv. If the pot had a 300 degree rotation and was connected directly to Vcc,then a 300 degree rotation would take the reference voltage from 0 to 5.6 volts, a much wider range. WIth the right resistors, we can get the pot range to match the trip point range (40mv) and thus make it easier to adjust because then a turn of 300 degrees of the pot knob only results in a 40mv change in reference voltage. Nice huh #### SotosElec

Joined Apr 13, 2018
19
hi Soto,
Which posted circuit image are you referring too.?
R4 5
E
Hi,

You mean R5 and R6 of the original circuit?

They are there to limit the adjustment range so that the user does not have to turn the pot knob very, very carefully once they get near the right set point. With those two resistors, a large turn of the pot resutls in a much smaller change of the reference voltage. That makes it easier to adjust, especially since the worknig range is only 40mv. If the pot had a 300 degree rotation and was connected directly to Vcc,then a 300 degree rotation would take the reference voltage from 0 to 5.6 volts, a much wider range. WIth the right resistors, we can get the pot range to match the trip point range (40mv) and thus make it easier to adjust because then a turn of 300 degrees of the pot knob only results in a 40mv change in reference voltage. Nice huh hi Soto,
Which posted circuit image are you referring too.?
R4 5
E

Yes I am referring to the original circuit, but I meant R3 and R4. (Sorry for that mistake) I understand the role of R5 and R6. I actually already made a post about these too, theorising that they are there to narrow the range.
I think the purpose of R5 and R6 are to prevent setting the voltage too high or too low. With them in place the voltage range on the inverting input is narrower than the 0-5.6V enforced by the zener diode.
So, if the pot is set to 0% (wiper is all the way up) the voltage should equal 5.6*(R6+10)/(R5+R6+10), while when it's set to 100% (wiper all the way down) it should be 5.6*(R6)/(R5+R6+10). If R5 and R6 weren't there, at 0% it would be 5.6V and at 100% it would be 0V.
Hi,

Well sorry to say, but yes, you are rounding too much. Try this for your fourth equation above instead:
R11=0.99365079365079*R11+0.99365079365079*R10

You'll get the same results as me Or better yet, carry the fraction 313/315 farther until the very end.
Alright, I see where the issue is now. I didn't consider that rounding would affect the result at a great degree.

• Matherios
Similar threads