Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Thermometer how to create it

Status
Not open for further replies.

Robbe

Newbie level 4
Joined
Feb 6, 2012
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,333
Hello,

I present myself I'm Roberto from Italy and I'm 18, I have some questions regarding how to "create" a thermometer, I didn't find any threads about my same problem but if there are any excuse me.
I've been studying microcontrollers for 3 years (From school), PIC 16f84a and especially 16f876a, used lcd 16x2 lm016, display 7 segment, and some other simple stuff (led, switch and so on), Proton plus for coding and Proteus for simulations.
Now I need to "create" a thermometer as written above, using a temp. sensor, a PIC 16f876a and a lm016, since I need to test it on Proteus, I found out I can't use a LM335 (it gives an error), I have to use the LP2901 that works properly.
So I coded it, designed it on Proteus, tested it and everything works correctly, but it only shows 1 °C ofcourse, here is the design: https://i43.tinypic.com/x1n0x5.jpg , and here when I run the simulation: https://i41.tinypic.com/2m346s1.jpg , as you can see it shows 1 °C , so the question is how can I change the temperature through the LP2901? Maybe connecting something to its 6 & 7 pins? Is the design correct?

P.S. I need to calculate the average temperature so I can't do it with 1 value only. To have the temperature in Celsius I had to multiply it for 1,96 (as you surely know already), so the source code is correct at least I think so.

Thanks in advance and sorry my english is not that perfect :p

Best regards,
Roberto
 

Hi,

Hi,

Why choose a Op Amp I'm afaid I do not know ? when there are so many true temp sensors out there designed to be inferfaced to micros.

The DS18B20, LM34, LM35,MCP9700, SHT11 to mention but a few , many of which will output either C or F and have resolutions down to a fraction of a degree.; all these are in ISIS.

Have used several of the above and all work well on a Pic.
 

LP2901 is a comparator , the output can be either high or low (you actually need a pull up resistor for high), I can not see how you can use it as a temperature sensor.
In addition you have a resistor in series with the positive supply , what is that?

LM335 is the way to go (or any other similar sensor) , the voltage changes according to the temperature so you have to measure it with an ADC and calculate the temperature that the measured voltage represents.

This is a nice tutorial , see if it helps: Temperature sensor tutorial - Using the TMP36 / LM35
 

LP2901 is a comparator , the output can be either high or low (you actually need a pull up resistor for high), I can not see how you can use it as a temperature sensor.
In addition you have a resistor in series with the positive supply , what is that?

LM335 is the way to go (or any other similar sensor) , the voltage changes according to the temperature so you have to measure it with an ADC and calculate the temperature that the measured voltage represents.

This is a nice tutorial , see if it helps: Temperature sensor tutorial - Using the TMP36 / LM35

Thanks for your answers, I saw on a forum (I don't remember which one) a guy answering with that lp2901 to solve the problem since the lm335 gives an error so I used it and furthermore some schematics with that resistor in series with the positive supply, just copied it.
However I need to test it on Proteus first of all so I can't use the lm335 (I will use it when I will build it), is there a way to make it working? Or is there another sensor that works on Proteus?
Thanks again
 

You can use any of the sensors than wp100 has mentioned like LM35.
lp2901 can only have two states in the output Vcc or GND so it can't provide any voltage that varies with temperature.
 

Yes I got that but the problem is when I use the lm335 Proteus gives the following error: "No model specified for U2" , U2 is the lm335, so I can't run the simulation and test it.
So I need a working sensor for Proteus if there is one.
 

I actually wrote LM35 the second time but LM335 is also included with a model in proteus as far as I know so maybe you have an old or limited version
 

let me help with some code in proton basic

Code:
Device 16F876A
Declare Xtal 4

Declare Adin_Res 10         ' 10-bit result required 
Declare Adin_Tad 8_FOSC     ' Set the ADC's clock source
Declare Adin_Stime 50       ' Allow 50us sample time

Declare LCD_Type 0          ' Type of LCD Used is Alpha
Declare LCD_DTPin PORTB.4   ' The control bits B4,B5,B6,B7
Declare LCD_RSPin PORTB.2   ' RS pin on B2
Declare LCD_ENPin PORTB.3   ' E pin on B3
Declare LCD_Interface 4     ' Interface method is 4 bit

Dim temperature As Float                        'temperature value
Dim result As Float                                ' adc value handler


ADCON1 = %10000000          ' Set all to analogue inputs (PORTA)

Print $FE,$40,$1C,$14,$1C,$07,$04,$04,$07,$00                             ' custom character for degree celsius

cls

Main:

  result  = ADin 0            , grab a sample from porta.0
  result = (result * 5000) / 1024 scale the result
 temperature = result / 10      ' remember 10mV = 1 degree when using LM35

print at 1, 1, "TEMPERATURE: ", dec2 temperature, 0

delayus 100

goto main


i beleive this should give you an idea of how it works but basically using LM35 and i am assuming u know how to connect it with the micro.

if u run into any problem let us know, i would have posted a model of the LM35 but u can PM me if u need one.
cheers
 
Last edited by a moderator:

Hi again, thanks for everything I finally got it, LM35 (and not lm335) is working fine I just misunderstood.
I will test it once again today and let you know, thanks!

---------- Post added at 15:15 ---------- Previous post was at 14:55 ----------

Just wondering how did you get this: result = (result * 5000) / 1024 ?
 

Ah yes sure, tested everthing but it's not so accurate, when i select for example 50 °C in the LM35, on lcd show 48,82 °C . How can I fix it if possible?
 

that's some floating point maths conversion. you can try and take the value for some number of times and do some averaging. then i guess u get a closer value
 

In my opinion if youwant to make simple, I think DS1621 is ideal, because it use I2C bus and no need to calibrate it.
 

Ah yes sure, tested everthing but it's not so accurate, when i select for example 50 °C in the LM35, on lcd show 48,82 °C . How can I fix it if possible?

Try to use digital sensor. Yes you are right LM35 with bad ADC resolution like 8-bit is bad choice for precise measurement of temp. All sensors have given precision tolerance for defined temperature range. Also there is several LM35 version with various temperature range.

LM35, LM35A −55°C to +150°C
LM35C, LM35CA −40°C to +110°C
LM35D 0°C to +100°C
 

It is converting,
10 bit ADC result -to-> 'output in mV' against 5V reference

Hi..
I'm new here...
Thank for reading.. (2 years post)

Need help with my 16F876 and LM335 project..
result = (result * 5000) / 1024

(25°C / 2.982V calibrated)
Give ~28°C when real temperature is 25°C.
-- ADIn counts is 590 to 600 when it's suppose to be 610.

Give ~24°C when real temperature is ~0°C. (on freezer)
-- ADIn counts is 508

Using 2K bias resistor and trimpot option for calibration.
result = ADIn 0
result = (result * 5000) / 1024

WEB
 

the code was meant for lm35 temperature sensor not lm335, and if its measuring negative temperature. u will need to add a diode 1n4148 the cathode facing donward between the ground pin (middle pin) of the lm35 and the ground of your power supply, then connect one of your adc pin to the anode of the diode.

hope dis helps

tunde
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top