Comparing ambient temperature with desired temperature by LM35

WBahn

Joined Mar 31, 2012
32,942
As you have described things, you are setting up conflicting requirements. If the temperature is one degree above the desired temperature, should the fan be on or off? Can you actually answer that question based on only that information, or does the answer to this question depend on the recent history of the temperature? For instance, if the temperature was recently below the desired temperature and is now increasing, you seem to want to NOT turn on the fan until it gets at least two degrees above the desired setpoint. But if the temperature was recently more than two degrees above the setpoint you seem to want the fan to be on in order to get the actual temperature down to the setpoint. With those conflicting goals, you can't just look at the current temperature, but you have to take into account the recent history of the temperature. You do this by incorporating "hysteresis" into the circuit. Look into Schmidt triggers and see if that gives you some ideas about how to proceed.
 

wayneh

Joined Sep 9, 2010
18,125
While you're pondering that, let's nail down how you will switch your loads. You mentioned using BD135 transistors. Those can handle a max current of 1.5A (per the data sheet) but realistically shouldn't be used for any load over 1A or so, and will need heat sinking for that.

Is that enough for your heater or fan?

Your BD135 is a BJT and requires a base current of about 5-10% of the load current, in order to be fully turned on. Can you get that much current to it? I'm hinting that you may want to consider a MOSFET. It can switch a large load with a tiny control signal (voltage, not current) and probably won't need a heat sink.
 

Thread Starter

Fatih Çalış

Joined Dec 3, 2016
15
While you're pondering that, let's nail down how you will switch your loads. You mentioned using BD135 transistors. Those can handle a max current of 1.5A (per the data sheet) but realistically shouldn't be used for any load over 1A or so, and will need heat sinking for that.

Is that enough for your heater or fan?

Your BD135 is a BJT and requires a base current of about 5-10% of the load current, in order to be fully turned on. Can you get that much current to it? I'm hinting that you may want to consider a MOSFET. It can switch a large load with a tiny control signal (voltage, not current) and probably won't need a heat sink.
Actually because it is a homework, we are not supposed to heat or cool the whole actual environment. Our aim is to make LM35 measure the ambient temp we wants to be only, I mean the room does not have to be at the temperature the LM35 measures. Therefore we can and will place cooler and heater very close to LM35 so I think BD135 will be enough. And unfortunately Mosfet is forbidden to use according to rules of this homework.
 

Thread Starter

Fatih Çalış

Joined Dec 3, 2016
15
As you have described things, you are setting up conflicting requirements. If the temperature is one degree above the desired temperature, should the fan be on or off?
Let me explain the way the circuit is supposed to work. First of all, circuit checks if the ambient temp is equal to the desired temp, if it is, neither cooler nor heater works. If it is different than the desired temp, then circuit starts to work to bring the ambient temp to the desired temp. When the desired temp is reached, both cooler and heater stops. Then, if the ambient temperature increase above the desired temp more than 2 degrees, the fan works until the desired temp is reached and when the desired temp is reached, fan stops. Similarly, if the ambient temp decrease below the desired temp more than 2 degrees, the heater starts to work till the desired temp is reached. When the desired temo is reached, heater stops.
Simply, circuit makes ambient temp equals to the desired temp first. Then both heater and cooler stops. If the ambient temp exits the +2C' -2C' interval, simultaneously the heater or cooler starts to work until the desired temp is reached.
 

WBahn

Joined Mar 31, 2012
32,942
Let me explain the way the circuit is supposed to work. First of all, circuit checks if the ambient temp is equal to the desired temp, if it is, neither cooler nor heater works. If it is different than the desired temp, then circuit starts to work to bring the ambient temp to the desired temp. When the desired temp is reached, both cooler and heater stops. Then, if the ambient temperature increase above the desired temp more than 2 degrees, the fan works until the desired temp is reached and when the desired temp is reached, fan stops. Similarly, if the ambient temp decrease below the desired temp more than 2 degrees, the heater starts to work till the desired temp is reached. When the desired temo is reached, heater stops.
Simply, circuit makes ambient temp equals to the desired temp first. Then both heater and cooler stops. If the ambient temp exits the +2C' -2C' interval, simultaneously the heater or cooler starts to work until the desired temp is reached.
Do you see what I am talking about? If the temperature is above the desired temp by 1 degree C, you can't answer the question of whether the fan should be on or off. You need additional information. Well, if YOU need additional information, then your circuit needs additional information, too. This is most easily done by introducing hysteresis. So you need to read up at least a bit about what hysteresis is and how it is used to do what you want to do. Then we are in a better position to discuss ways to implement a circuit that has the hysteresis you need.
 

Thread Starter

Fatih Çalış

Joined Dec 3, 2016
15
How is that different from what it does outside the ±2°C interval? :confused:
If the ambient temp is at outside the interval, then heater or cooler works till desired temp is reached. After reaching the desired temp, neither heater nor cooler works as long as the ambient temp is inside the interval. When it got out the interval, again the heater or cooler starts to work till desired temp is reached. And it keeps going like this.
 

Thread Starter

Fatih Çalış

Joined Dec 3, 2016
15
Do you see what I am talking about? If the temperature is above the desired temp by 1 degree C, you can't answer the question of whether the fan should be on or off. You need additional information. Well, if YOU need additional information, then your circuit needs additional information, too. This is most easily done by introducing hysteresis. So you need to read up at least a bit about what hysteresis is and how it is used to do what you want to do. Then we are in a better position to discuss ways to implement a circuit that has the hysteresis you need.
Thank you :)
 

wayneh

Joined Sep 9, 2010
18,125
Therefore we can and will place cooler and heater very close to LM35 so I think BD135 will be enough. And unfortunately Mosfet is forbidden to use according to rules of this homework.
It doesn't matter how near your loads are. What matters is the current draw, which you have not specified. I'm trying to warn you that your transistor controlled by the comparator output might not be able to control more than 100mA or so, and this may not be enough to run your loads.
 

crutschow

Joined Mar 14, 2008
38,550
If the ambient temp is at outside the interval, then heater or cooler works till desired temp is reached. After reaching the desired temp, neither heater nor cooler works as long as the ambient temp is inside the interval. When it got out the interval, again the heater or cooler starts to work till desired temp is reached. And it keeps going like this.
Then you just need the heater to come on when the temperature is more than 2°C below the desired value, and turn on the fan when it is more than 2°C above the desired value.
What problem is there with doing that?
 

WBahn

Joined Mar 31, 2012
32,942
Then you just need the heater to come on when the temperature is more than 2°C below the desired value, and turn on the fan when it is more than 2°C above the desired value.
What problem is there with doing that?
The problem is that it will not meet his specs. If the temperature is more than 2°C above the set point, his specs require the fan to come AND REMAIN ON until the temperate REACHES the set point (i.e., "till the desired temp is reached"). It is only AFTER the desired temperature is actually reached that the system goes into an idle mode pending an excursion outside the ±2°C limits.
 

crutschow

Joined Mar 14, 2008
38,550
The problem is that it will not meet his specs. If the temperature is more than 2°C above the set point, his specs require the fan to come AND REMAIN ON until the temperate REACHES the set point (i.e., "till the desired temp is reached"). It is only AFTER the desired temperature is actually reached that the system goes into an idle mode pending an excursion outside the ±2°C limits.
Okay.
So now I understand the need for hysteresis in the set point.
Thus the fan turns on if it goes 1 degree above the set-point and back off when it reaches the set point.
And the heater goes on if it goes 1 degree below the set-point and off when it again reaches the set point.
That sound right?
 

WBahn

Joined Mar 31, 2012
32,942
Okay.
So now I understand the need for hysteresis in the set point.
Thus the fan turns on if it goes 1 degree above the set-point and back off when it reaches the set point.
And the heater goes on if it goes 1 degree below the set-point and off when it again reaches the set point.
That sound right?
Close. I think you just have a couple typos and meant "2 degrees" in both places where you have "1 degree".
 

wayneh

Joined Sep 9, 2010
18,125
That's my read of it also. This means to me there is chance of both loads being on at the same time if there
LM35 has how big an error? +/- 1 °C?
I think the accuracy is generally better than that within "normal" ambient ranges, and the precision is quite a bit better. It's all in the data sheet, which I haven't looked at for a long time.
 

shteii01

Joined Feb 19, 2010
4,644
That's my read of it also. This means to me there is chance of both loads being on at the same time if there

I think the accuracy is generally better than that within "normal" ambient ranges, and the precision is quite a bit better. It's all in the data sheet, which I haven't looked at for a long time.
You are right.
 

wayneh

Joined Sep 9, 2010
18,125
Oops, that first sentence was not meant to there. But the point was that the cooling control and the heating control are independent except for the directionality. I mean, there could be a temperature at which either could be running. But it should never happen that the heater is at the top of its hysteresis while the fan is at the bottom of its hysteresis.
 

ericgibbs

Joined Jan 29, 2010
21,466
hi TC,
The LM35A has a 0.5C accuracy at 25C.
In my experience with the LM35 they have a good repeatable performance.

It is a good idea to consider your design by initially using example parameters, assume a single supply operation, +2C thru +150C.
Refer Fig #1 of the datasheet.
As you have a limited heating source and only a cooling fan, the original lower temperature range limit in your earlier post is unrealistic.
Required range is from -50C' to +50C'.

ie: say the target temperature is 20Cdeg with a +/-2Cdeg Upper and Lower limit.

So, 18C Lower and 22C Upper.
The LM35 Lower output will output 18C * 0.01v = 180mV and the Upper output 22C * 0.01v = 220mV [ Range 40mV ]

So the Upper and Lower limit SET point reference voltages to the comparators will have to be 180mV and 220mV.

Draw and post a circuit that will meet the above parameters.

E
 
Top