View previous topic :: View next topic |
Author |
Message |
Jim90
Joined: 27 Apr 2013 Posts: 55
|
RTD PT100 |
Posted: Wed Feb 05, 2014 5:41 pm |
|
|
I recently bought a thin film pt100 temperature sensor and i am trying to measure the temperature value.
I built a voltage divider (100ohm + RTD PT100) and in the middle of the two i connect the received value which is going to the microcontroller (measure the temperature value).
The code which i am using is presented below:
Code: |
while(1)
{
float value;
value = read_adc();
printf("VALUE:%fl\n",value);
delay_ms(1000);
}
|
My problem is that i receiving very high values. I don't understand what is going wrong ? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Wed Feb 05, 2014 6:45 pm |
|
|
'very high values' is not a good description to go on.
Typical RTD PT100 devices are 100r@0*C, 138r@100*C, if we assume a Vref of the ADC section to be 5.000 ( PIC power supply), the range is 2.50 to 2.89 volts.
You should tell us the temperature of the sensor and the raw ADC bits.
Also be aware that actual wiring of the sensor, board layout, etc. have a very important part in accurate measurements. Also RTDs are NOT linear devices so you need to do some 'math' to get the best results.
http://www.picotech.com/applications/pt100.html is one quick random 'google' for more information that should be useful.
You don't tell us what PIC, which ADC setup (8 bit, 10 bit, ??), conversion rate, etc. All this is important to know....
hth
jay |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Thu Feb 06, 2014 5:15 am |
|
|
You don't tell us which way up your divider is wired.
I'm assuming RTD to GND, 100R to +5V.
Have you read the data sheet for the RTD?
If it's thin film it could be getting hot.
Give us more to go on.
Mike |
|
|
Jim90
Joined: 27 Apr 2013 Posts: 55
|
RTD PT100 |
Posted: Thu Feb 06, 2014 7:19 am |
|
|
I use dspic33fj128gp802 with voltage Supply equal to 3.3V and ADC: 10 bits
I put a 200ohm resistor in series with rtp and in the middle is connected it to the adc input.(At one side of the resistor i connect a supply and at one side of the rtp i connect ground).
I know that i need to do some maths so to receive the correct value but i have little confusion what exactly i need to do.
I am waiting for your respond. |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Thu Feb 06, 2014 9:31 am |
|
|
Is this what your circuit looks like? Code: | 100R 200R
+3V3 _______WWWWW__________WWWWW______ Analogue I/P
|
|
|
GND _______WWWWW______|
RTD |
If it is, 10 bit ADC max reading is 1023.
So if ADC gives ADC_reading. Then calculate RTD resistance from:-
RTD/100 = ADC_reading/(1023-ADC_reading)
Which rearranges to:-
RTD = 100 * ADC_reading/(1023-ADC_reading)
For most RTDs, resistance is approximately proportion to absolute temperature.
So Absolute_Temperature = 273*(RTD/100)
OR in Celsius
Temperature_in_Celsius = Absolute_Temperature - 273
= 273*(RTD/100) - 273
= 273*(RTD/100 -1 )
Job done
Mike
PS If you work in tenths/hundreths of a degree you can use integers throughout and avoid fp maths. |
|
|
Jim90
Joined: 27 Apr 2013 Posts: 55
|
RTD PT100 |
Posted: Thu Feb 06, 2014 12:15 pm |
|
|
My circuit is :
200R RTD
+3V3 _______WWWWW__________WWWWW______ GND
|
|
|
dspic33
What are the necessary calculations for the above circuit? |
|
|
Jim90
Joined: 27 Apr 2013 Posts: 55
|
RTD PT100 |
Posted: Thu Feb 06, 2014 12:16 pm |
|
|
200R RTD
+3V3 _______WWWWW__________WWWWW______ GND
|
|
|
dspic33
Now is clear . Sorry for the confusion. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Thu Feb 06, 2014 12:29 pm |
|
|
basic OHMs law voltage divider
Vout=(rtd/(rtd+200)) * Vin
rtd=+-100r@0*c
vin=3.3
Of course you must measure vin (it won't be 3.3), rtd value varies according to temperature obviously.
Simple test is to freeze the sensor then let it warm up, measure ADC input and record ADC bits on a chart, say every 10 seconds.
hth
jay |
|
|
Jim90
Joined: 27 Apr 2013 Posts: 55
|
RTD PT100 |
Posted: Tue Feb 11, 2014 5:03 pm |
|
|
I changed the circuit and I did it as Mike Walne presented.
My confusion is that the Mike Walne and the temtronic explained different ways to processing the input signal.
Can you make it more clear please? |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
Re: RTD PT100 |
Posted: Tue Feb 11, 2014 5:15 pm |
|
|
Jim90 wrote: | I changed the circuit and I did it as Mike Walne presented.
My confusion is that the Mike Walne and the temtronic explained different ways to processing the input signal.
Can you make it more clear please? |
Without having seen a clear schematic I was guessing at your voltage divider circuit.
I assumed your rdt was in series with 100R and calculated accordingly.
I also assumed that you're using the 3V3 supply as Vref for the ADC.
temtronic's maths is equivalent to mine but using the 200R which you later told us about.
In order to help you further we need to know exactly what you are doing.
Mike |
|
|
Jim90
Joined: 27 Apr 2013 Posts: 55
|
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
Re: RTD PT100 |
Posted: Sun Feb 16, 2014 6:01 pm |
|
|
Jim90 wrote: | I came back to continue the project. I use the following circuit:
The Vout = (RTD*VCC)/(RTD+R)
where VCC=3.3v and R=10K
According the following link :
for temperature : -10 c -->R=96.09 and with the use of the Vout equation V=2,98
for temperature: 110c -->R=-->V=3,083 |
There's something wrong with your calculator.
Mike |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sun Feb 16, 2014 8:42 pm |
|
|
i suggest using external analog processing of the sensor data, and
an external precision 2.5 volt ADC ref. like the lm4040, since if your last post were correct, it shows you are trying to map a 120 degree span into 127 bits. with a reasonable assumed uncertainty of any single ADC count,
of +/-1 bit, you won't resolve any less than 4 degrees on average.
unless your pic power supply is providing a highly accurate and compliant 3.3v, your accuracy is also never going to make you happy either.
your problem is in circuit design, or lack of.
Direct reading an RTD, unless the temp range is extremely wide, is tough with only 10 to 12 bits of conversion,..l..
analog processing is the cheaper way to get better resolution, rather than using a lot more expensive bits of external ADC to achieve the same ends. |
|
|
Jim90
Joined: 27 Apr 2013 Posts: 55
|
RTD PT100 |
Posted: Mon Feb 17, 2014 12:44 pm |
|
|
You are right Mike Walne,
the values are :
for temperature : -10 c -->R=96.09 and with the use of the Vout equation V=0.031
for temperature: 110c --->V=0.046.
asmboy i don't want to use an external adc.
these values look like ok?
(to be honest i expect to receive something like 0.3 instead of 0.03 ) |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Mon Feb 17, 2014 1:39 pm |
|
|
you might google this phase and look at the images:
rtd schematic
with a 10bit adc - you are simply not going to resolve the temperature range you hope for, or with a noise level in the readings you get, to want to brag about it . at least not with the simple circuit you hope to use.
to work well with so few bits you need a constant current source for the RTD and analog gain. Its just math.........
over and out
BTW: (1023) 120/1023 = 0,111.
actually there is general agreement on this forum anyway,
that 1024 is 10 bits worth not 12
i think 1024 is 12 bits only on ATMEL MCUS |
|
|
|