Simple Digital Thermometer
Introduction
My earlier temperature projects have all used the LM35 device.
This is a 3 pin device in either a TO-92 or TO-202 style package.
The device comes in a few different accuracies, but all operate with the same basic 10 mV/°C output.
The main problem with the LM35 is it only reads positive temperatures
(without external signal conditioning circuitry.)
This project uses the LM335 type device.
It comes in the same TO-92 package, but it has an output of 10mV/K
This allows it to read negative temperatures.
The device selected here reads from -40°C to 100°C (233.15K to 373.15K)
K = Kelvin
This is the absolute thermodynamic temperature scale, where 0K = absolute zero = -273.15°C
It is not referred to as degrees Kelvin, as in degrees Celsius, but just Kelvin.
Therefore
0°C = 273.15 K
100°C = 373.15 K
The output from the device is converted to temperature as follows
Remember to use the floating point calculations in Flowcode and not the standard mathematical operators.
First Convert The ADC voltage to Kelvin (Read ADC as float)
Temp = fmul ( ADC_Voltage, 100)
Now convert to °C from Kelvin
Temp2 = fsub( Temp , 273.15)
Example ADC Voltage = 2.1115 V
Temp = 2.9818 * 100
Temp = 298.18
Temp2 = Temp - 273.15
Temp2 = 298.18 - 273.15
Temp2 = 25.03
Temp2 is then converted to a string to be displayed on the LCD
Equipment :
EB-006 Programmer with PIC 16F877A
EB-005 LCD Display
EB-016 Prototype Board
LM335Z Temperature Sensor - Connected to ADC5 (Port E Bit 0)
10k-ohm Preset Pot (Multi Turn preferred)
1k8 Resistor
The 10k-ohm pot is used to calibrated the sensor. It is adjusted until the display shows the ambient temperature in the room measured as close to the LM335 as possible.
Once set is should not need to be adjusted again.
Simple Digital Thermometer
Moderator: Benj
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Simple Digital Thermometer
Hi John
This will be handy in a quiet a few applications
Thanks for sharing.
Martin
This will be handy in a quiet a few applications
Thanks for sharing.
Martin
Martin
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
- Contact:
Re: Simple Digital Thermometer
To simplfy the circuit even more the variable resistor can be left out and the adj pin left unconnected.
The output is then taken between the 1k8 resistor and the V+ connection on the device.
The output is then taken between the 1k8 resistor and the V+ connection on the device.
1 in 10 people understand binary, the other one doesn't !
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: Simple Digital Thermometer
Hi John,
In your experience, what is the best device for calibration? I've tried digital thermometers but after having three of them within a couple of centimeters and all showing different temperatures (1.8 degree centigrade between highest and lowest) I've got reservations about using them as a reference.
Regards,
Jac
In your experience, what is the best device for calibration? I've tried digital thermometers but after having three of them within a couple of centimeters and all showing different temperatures (1.8 degree centigrade between highest and lowest) I've got reservations about using them as a reference.
Regards,
Jac
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
- Contact:
Re: Simple Digital Thermometer
Hi Jac
My thoughts on these semiconductor temperature sensors.
The LM35 can normally be between 0.5°C and 1.5°C depending on which version you are using.
Dont think any are highly accurate. If you look at my Touch Screen Temp Monitor, im using 4 LM35's in that one and they are all reading the same. I have the sensors in a matix protoboard, so they are all fairly close together.
Ive only just started to look at the LM335 device. Having the trim pot does seem to make it more accurate. Not tried seeing how it changes over a range. Want to wait till I can leave it in the sun for a while (quite a rare thing in England at the moment ) after setting it at about 20°C and compare it to an accurate thermometer.
Have just tried freezer spray and took it down to -40°C,although no way of knowing how accurate this is.
Even the LM335 only claims 0.5°C accuracy though.
Other options are the DS18S20 one wire bus device, or another device I have used in the past is the AD594/595 thermocouple amplifier, which gives a direct linear dc output from a thermopcouple, but again I seem to remember these dont allow negative temperatures.
They all work fairly well, just depends how much accuracy you need for you application. If you need more than 1 device you may need to select on test to get a couple of devices to read the same.
My thoughts on these semiconductor temperature sensors.
The LM35 can normally be between 0.5°C and 1.5°C depending on which version you are using.
Dont think any are highly accurate. If you look at my Touch Screen Temp Monitor, im using 4 LM35's in that one and they are all reading the same. I have the sensors in a matix protoboard, so they are all fairly close together.
Ive only just started to look at the LM335 device. Having the trim pot does seem to make it more accurate. Not tried seeing how it changes over a range. Want to wait till I can leave it in the sun for a while (quite a rare thing in England at the moment ) after setting it at about 20°C and compare it to an accurate thermometer.
Have just tried freezer spray and took it down to -40°C,although no way of knowing how accurate this is.
Even the LM335 only claims 0.5°C accuracy though.
Other options are the DS18S20 one wire bus device, or another device I have used in the past is the AD594/595 thermocouple amplifier, which gives a direct linear dc output from a thermopcouple, but again I seem to remember these dont allow negative temperatures.
They all work fairly well, just depends how much accuracy you need for you application. If you need more than 1 device you may need to select on test to get a couple of devices to read the same.
1 in 10 people understand binary, the other one doesn't !
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: Simple Digital Thermometer
Hi John!
Another good project from you. Nice of you to share with us.
Regard
Jorgen.
Another good project from you. Nice of you to share with us.
Regard
Jorgen.
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: Simple Digital Thermometer
Hi John!
A question!
I have now tried to make your fine project with lm 335 but only with a potentiometer. I can see, depending on the voltage of the analog input, skips the decimals after the decimal between 0 and 3 decimal places. Is it not possible to keep it constant at 1 or 2 decimal places. If, how do you do it.
Thank´s in advance.
Jorgen.
A question!
I have now tried to make your fine project with lm 335 but only with a potentiometer. I can see, depending on the voltage of the analog input, skips the decimals after the decimal between 0 and 3 decimal places. Is it not possible to keep it constant at 1 or 2 decimal places. If, how do you do it.
Thank´s in advance.
Jorgen.
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
- Contact:
Re: Simple Digital Thermometer
Hi Jorgen
It does need you to edit one of the flowcode files, so for this application Im happy with it changing between 2 & 3 places of decimals depending on how many digits are in the integer part. (Think it was set to a string length of 5 places)
http://www.matrixmultimedia.com/mmforum ... gth#p24361
It is posible to fix the length of the decimals when converting a float to string for printing. See this thread.Is it not possible to keep it constant at 1 or 2 decimal places. If, how do you do it.
It does need you to edit one of the flowcode files, so for this application Im happy with it changing between 2 & 3 places of decimals depending on how many digits are in the integer part. (Think it was set to a string length of 5 places)
http://www.matrixmultimedia.com/mmforum ... gth#p24361
Do you mean you are not using the 1k8 resistor in the 5V line? Not sure what effect that will have on the operation.I have now tried to make your fine project with lm 335 but only with a potentiometer
1 in 10 people understand binary, the other one doesn't !
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: Simple Digital Thermometer
Hi John!
I will look at it,thank´s
Concerning the potentimeter. It was insted of LM335 the analog input. I am waiting for a LM335.
Regard
Jorgen
I will look at it,thank´s
Concerning the potentimeter. It was insted of LM335 the analog input. I am waiting for a LM335.
Regard
Jorgen
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
- Contact:
Re: Simple Digital Thermometer
Ahh Ok I see what you mean now.
1 in 10 people understand binary, the other one doesn't !