Measure cold
Measure cold
Hello everyone,
I've fixed a small thermostat which I will measure cold.
lm335 which does the job.
But when I put it in the fridge so it does not indicate below zero.
The show +16, not sure what it showed but they were not below freezing.
tempratur true when measuring the room tempratur
pic16f690
crystal 4MHZ
Display 2 * 16
lm335
conversion formula "temp = temp * 5 * 100 / 1024"
Something I missed
Foppa
I've fixed a small thermostat which I will measure cold.
lm335 which does the job.
But when I put it in the fridge so it does not indicate below zero.
The show +16, not sure what it showed but they were not below freezing.
tempratur true when measuring the room tempratur
pic16f690
crystal 4MHZ
Display 2 * 16
lm335
conversion formula "temp = temp * 5 * 100 / 1024"
Something I missed
Foppa
Last edited by foppa on Sun Apr 18, 2010 8:00 pm, edited 1 time in total.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Measure cold
Hello foppa.
If I have worked this out correctly.
Since o/p = 10mV per deg K
then
Read_ADC = Read_ADC*10/102*5-273
So long as Read_ADC = int variable
E.g. at 0 deg C Read_ADC is approx 559.
So temperature=559*10/102*5-273 = 1
1 instead of 0 is due to rounding errors
Not sure if this will work but it it does will be a bit more accurate:
Read_ADC= Read_ADC*500/1024-273
Hope this helps.
If I have worked this out correctly.
Since o/p = 10mV per deg K
then
Read_ADC = Read_ADC*10/102*5-273
So long as Read_ADC = int variable
E.g. at 0 deg C Read_ADC is approx 559.
So temperature=559*10/102*5-273 = 1
1 instead of 0 is due to rounding errors
Not sure if this will work but it it does will be a bit more accurate:
Read_ADC= Read_ADC*500/1024-273
Hope this helps.
Martin
Re: Measure cold
Ok will try this tonight
I will come back and talk about how it goes.
Thanks for your help
Foppa
I will come back and talk about how it goes.
Thanks for your help
Foppa
Re: Measure cold
Ok have tried it now.
Did not that good.
The display shows the -297 C
What do
Foppa
Did not that good.
The display shows the -297 C
What do
Foppa
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Measure cold
Hiya foppa
Sorry, I did not take into account with int you cannot go above 32767 or below -32768 at any time during calculations. The Flowcode simulator does not take that into account either .
Here is a revised formula, verified 100% working using a different real time simulator.
Temperature =((Read_ADC*10/(1023/100)*5)+5)/10-280
Note: using -280 and not -273 due to rounding errors.
Alos resolution accuracy will not be that good (but im working on that), unless floating point maths is used.
Will only work If sampled in 10bit mode (0-1023) = (0V to 5V).
If you still are having problems then measure your i/p voltage to port you have connected to LM335. At 0 deg you should be measuring 2.73V:
Expected Voltage = (Temperature in C + 273.15 )/100
Are you using Flowcode?
If so what version?
Sorry, I did not take into account with int you cannot go above 32767 or below -32768 at any time during calculations. The Flowcode simulator does not take that into account either .
Here is a revised formula, verified 100% working using a different real time simulator.
Temperature =((Read_ADC*10/(1023/100)*5)+5)/10-280
Note: using -280 and not -273 due to rounding errors.
Alos resolution accuracy will not be that good (but im working on that), unless floating point maths is used.
Will only work If sampled in 10bit mode (0-1023) = (0V to 5V).
If you still are having problems then measure your i/p voltage to port you have connected to LM335. At 0 deg you should be measuring 2.73V:
Expected Voltage = (Temperature in C + 273.15 )/100
Are you using Flowcode?
If so what version?
Martin
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Measure cold
The simplest formula that appears to work is:
Temperature = Read_ADC*5/10-280
It also appears to be fairly accurate (i would guess =/- 1 deg C)
Temperature = Read_ADC*5/10-280
It also appears to be fairly accurate (i would guess =/- 1 deg C)
Martin
Re: Measure cold
Hello medelec35 First thanks for all your help.
I tested the simple solution and then show the -54 in the room tempratur.
I attach the file to lm335.
The difficult solution I do not know how to get to because it requires them these symbols (()) and do not know how to incorporate them.
I copied the difficult solution and pasted into flowcode.
no dissatisfaction from flowcode about that.
tempraturen is wrong there too
but it may be due to paste it into the flowcode from your posts
I have plugged in a resistor of 4.7Kohm from - to output on lm335
can you make a hex file for me to file that I attached in this post.
curious if there is someone setting that is wrong.
running with pickit2
Foppa
I tested the simple solution and then show the -54 in the room tempratur.
I attach the file to lm335.
The difficult solution I do not know how to get to because it requires them these symbols (()) and do not know how to incorporate them.
I copied the difficult solution and pasted into flowcode.
no dissatisfaction from flowcode about that.
tempraturen is wrong there too
but it may be due to paste it into the flowcode from your posts
I have plugged in a resistor of 4.7Kohm from - to output on lm335
can you make a hex file for me to file that I attached in this post.
curious if there is someone setting that is wrong.
running with pickit2
Foppa
- Attachments
-
- Analog 690.fcf
- (8.5 KiB) Downloaded 383 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Measure cold
Your welcome.
Your flowcode file is fine including the formula, and must be working OK since you have got a temperature showing on the display.
The best thing to do is measure the real temperature where the sensor is, and post that along with the voltage measured going into pin 19 of 16F690.
I looked at the data sheet and at 25 deg C the o/p from LM335 should be 2.982V. (-54C = approx 2.19V ). So you can confirm if that is the case with your hardware. Don't for get if you have not calibrated your sensor there could be a temperature error between 1 and 5C depending on temperature measured and reverse current.
Perhaps you can post a circuit diagram. Have you checked the sensor is connected the right way round (although if you are getting -54C then thats not likely to be wrong way), this again can be confirmed by measuring the i/p to pin 19 as previously stated.
Edit: Also try changing your supply resistor to something like 2k2 - 2K7, if your using 5V to supply sensor.
With 4K7: At 25 deg C, current through sensor = (5 -2.98)/4700 = 429 uA = too close to minimum current limit.
Also you need to take two other things into account:
1) For every 1 deg C change, the voltage at the pin of uc is only changing by 10mV = two counts (using 10 bit)
2) The accuracy is also totally dependent on the reference supply accuracy, which is the 5V supply to uc (if not changed internal supply reference). So a small ripple on supply will cause the temperature reading to fluctuate.
Hope this helps.
Your flowcode file is fine including the formula, and must be working OK since you have got a temperature showing on the display.
The best thing to do is measure the real temperature where the sensor is, and post that along with the voltage measured going into pin 19 of 16F690.
I looked at the data sheet and at 25 deg C the o/p from LM335 should be 2.982V. (-54C = approx 2.19V ). So you can confirm if that is the case with your hardware. Don't for get if you have not calibrated your sensor there could be a temperature error between 1 and 5C depending on temperature measured and reverse current.
Perhaps you can post a circuit diagram. Have you checked the sensor is connected the right way round (although if you are getting -54C then thats not likely to be wrong way), this again can be confirmed by measuring the i/p to pin 19 as previously stated.
Edit: Also try changing your supply resistor to something like 2k2 - 2K7, if your using 5V to supply sensor.
With 4K7: At 25 deg C, current through sensor = (5 -2.98)/4700 = 429 uA = too close to minimum current limit.
Also you need to take two other things into account:
1) For every 1 deg C change, the voltage at the pin of uc is only changing by 10mV = two counts (using 10 bit)
2) The accuracy is also totally dependent on the reference supply accuracy, which is the 5V supply to uc (if not changed internal supply reference). So a small ripple on supply will cause the temperature reading to fluctuate.
Hope this helps.
Martin
Re: Measure cold
Hello
Ok've drawn a bit on my connection.
Not the best but I hope you understand.
And I have measure the output of the lm335 and the value 2.040 V and the display shows -69
And the formula for conversion is the "Temperature = ((Read_ADC * 10 / (1023/100) * 5) +5) / 10-280
"
if this fails to work you should replace the sensor against someone else.
I have made sure that +5 V is stable.
Has had problems with not having a stable +5 V before.
Which gave me many problems.
But now it's okay
in the coming days to obtain the right of resistance that you write
I saw that I have 4Mhz crystal instead of 8Mhz.
VDD goes to plus
Foppa
Ps I use google translate which may explain my English
Ok've drawn a bit on my connection.
Not the best but I hope you understand.
And I have measure the output of the lm335 and the value 2.040 V and the display shows -69
And the formula for conversion is the "Temperature = ((Read_ADC * 10 / (1023/100) * 5) +5) / 10-280
"
if this fails to work you should replace the sensor against someone else.
I have made sure that +5 V is stable.
Has had problems with not having a stable +5 V before.
Which gave me many problems.
But now it's okay
in the coming days to obtain the right of resistance that you write
I saw that I have 4Mhz crystal instead of 8Mhz.
VDD goes to plus
Foppa
Ps I use google translate which may explain my English
- Attachments
-
- 16F690.JPG (46.37 KiB) Viewed 10653 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Measure cold
That is correct if o/p = 2.04V then temperature should be -69 deg C. Since the sensor won't be at that temperature, then the problem is the o/p is at the wrong voltage, not with the software.foppa wrote:And I have measure the output of the lm335 and the value 2.040 V and the display shows -69
Your diagram is not clear enough to check connections. To connect LM335 Adj is not used. + of lm335 goes to RA0 and to the supply resistor the other end of resistor goes to +5V supply. - of lm335 goes to 0V. Just as a reminder:
The simplest formula that appears to work is:
Temperature = Read_ADC*5/10-280
Martin
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Measure cold
If you are going to change your sensor. I have used a AD22100 which works well. Instead of 10mV per deg C, resolution is 22.5 mV per deg C. It would be more accurate, since there is a built in constant current source.
Martin
Re: Measure cold
Hello medelec35
Well now it starts to work as I want.
Should tomorrow calibrate the sensor.
I will come and talk about how it goes.
Thanks for the help
Well I know that my drawing was not good.
Must do a better drawing next time
Curious about what you draw with
Foppa
Well now it starts to work as I want.
Should tomorrow calibrate the sensor.
I will come and talk about how it goes.
Thanks for the help
Well I know that my drawing was not good.
Must do a better drawing next time
Curious about what you draw with
Foppa
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Measure cold
Great! Glad you got it working. What was the problem with your circuit ?
Unfortunately the drawing package is not mine, some kind person let me use it on their PC. It is called Proteus. Too expensive for me I am looking around for a cheaper schematic package I can use.
Unfortunately the drawing package is not mine, some kind person let me use it on their PC. It is called Proteus. Too expensive for me I am looking around for a cheaper schematic package I can use.
Martin
Re: Measure cold
Hold the horses medelec35
I was wrong
Since I am a novice in this, I need a bit more assists
How do I know where I will connect ADJUST or should not be connected
And what is o / p.
crap and I thought that this was ok
Foppa
I was wrong
Since I am a novice in this, I need a bit more assists
How do I know where I will connect ADJUST or should not be connected
And what is o / p.
crap and I thought that this was ok
Foppa
- Attachments
-
- lm335.jpg (33.12 KiB) Viewed 10627 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Measure cold
As stated in my previous post:
Take a look at the datasheet, it should help.
You only connect AJD if you are calibrating the device, then a trimmer stays connected to ADJ. Otherwise Leave ADJ open circuit.medelec35 wrote: To connect LM335 Adj is not used.
+ of lm335 goes to RA0 and to the supply resistor the other end of resistor goes to +5V supply. - of lm335 goes to 0V
Take a look at the datasheet, it should help.
Martin
Re: Measure cold
Hello.
Now I understand what I have done wrong all the time.
I was sure that adj on lm335 was the outout to RA0.
So now it should be okay,.
Differ to some degree but I can fix it.
now that I know what it should be done.
Foppa
Now I understand what I have done wrong all the time.
I was sure that adj on lm335 was the outout to RA0.
So now it should be okay,.
Differ to some degree but I can fix it.
now that I know what it should be done.
Foppa