CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

KTY84 thermometer
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

KTY84 thermometer
PostPosted: Wed Feb 24, 2010 2:17 pm     Reply with quote

Hi all!

I am trying to make a digital thermometer with a KTY84 silicon sensor.
I have this from the datasheet:



and this is my hardware:



The Vref- is at 1volt and the Vref+ is at 3.3v. This way I ignore temperatures below 0 degrees and also I have better resolution.

In the pdf I have some given ohm values for known temperatures in steps of 10 as you see above. The problem is that I do not know how to calculate the temperature for these values and also for the values between them. Unfortunatelly the sensor output is not linear.

Any help appreciated Rolling Eyes


Last edited by georpo on Fri Feb 26, 2010 10:15 am; edited 3 times in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 24, 2010 2:31 pm     Reply with quote

Why did this require a new thread ? Why not post this question on to
the end of your existing KTY84 thread ?
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Wed Feb 24, 2010 3:41 pm     Reply with quote

there is no other KTY84 thread!

I gave more details here in case somebody could help. There is nothing wrong I guess...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 24, 2010 3:46 pm     Reply with quote

Quote:

there is no other KTY84 thread!

Look at the start of your thread here:
http://www.ccsinfo.com/forum/viewtopic.php?t=41797
It says:
Quote:

I am using a KTY84 temperature sensor to make a thermometer.
This changes its resistance according to the temperature.
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Wed Feb 24, 2010 4:12 pm     Reply with quote

mmm I guess you are right. I already mentioned this Rolling Eyes

Anyway the point here is to find the solution.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 24, 2010 6:16 pm     Reply with quote

The polynomial for the KTY84/130 is given in Figure 9-19 on page 211
of this document:
http://www.boschrexroth-us.com/country_units/america/united_states/en/products/brc/documentation_downloads/ProductDocumentation/CurrentProducts/Motors/IndraDyn_A/29578103.pdf
It says this:
Quote:

Tw = (A * R^3) + (B * R^2) + (C * R) + D

Tw: Winding temperature of the motor in °C

R: Resistance of the temperature sensor in Ohms

A: 3.039 * 10E-8
B: -1.44 * 10E-4
C: 0.358
D: -143.78

Fig. 9-19: Polynomial used for determining the temperature with a known
sensor resistance (KTY84)

Take that equation, make it into a test program, and run it for a sample
value of 1000 ohms. This gives a result of 100.6 degrees C, which is
reasonably accurate.
Code:

#include <18F452.h>
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

float get_kty_temp(float res)
{
float temp_C;

temp_C = (3.039E-8 * res * res * res) + (-1.44E-4 * res * res) + (0.358 * res) - 143.78;

return(temp_C);
}
//======================================
void main(void)
{
float result;

result = get_kty_temp(1000);  // Use 1000 ohms as a test
printf("%5.2f \r", result);

while(1);
}
 
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Thu Feb 25, 2010 8:56 am     Reply with quote

Thank you so much pcm programmer. You are the best!

But please tell me how did you find this?
I have been searching for more than a week for an example like this.

After a few tests I found that it is not accurate...

for example the result for 250 degrees (2166 ohms) is 264.88 degrees.
14.88 degrees error Crying or Very sad
jaimechacoff



Joined: 14 Feb 2010
Posts: 24
Location: Santiago, Chile

View user's profile Send private message

PostPosted: Thu Feb 25, 2010 9:24 am     Reply with quote

and did you try to use a LM35 temperature sensor?, or Is not enough for your project?

http://www.datasheetcatalog.org/datasheet/nationalsemiconductor/DS005516.PDF

its linear.

by the way, with how much power are you feeeding your sensor?, maybe, it is a self-heating problem.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Feb 25, 2010 9:40 am     Reply with quote

Quote:
After a few tests I found that it is not accurate...

Yes, you only need a pocket calculator to see this. The reason is simple, the polynominal was fitted for a 0 .. 170 °C
range, as with any polynominal, the error is increasing rapidly outside the intended range.

I suggest to use a spreadsheet program (e.g. MS Excel) and fit your own polynominal to the resistance table from
KTY84 datasheet. When you say 264°C isn't accurate, you may want to consider, that the possible error resulting
from KTY84/130 tolerance is larger than 14° at 250 °C. So if you are targetting to accuracy, you should think
about an industry standard thermocouple or Pt100/Pt1000 sensor.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 25, 2010 12:17 pm     Reply with quote

Quote:

But please tell me how did you find this?
I have been searching for more than a week for an example like this.

I just typed this into Google:
Quote:

KTY84 polynomial
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Thu Feb 25, 2010 12:34 pm     Reply with quote

The thermometer is for a home made reflow oven and the max temperature is about 250 degrees so LM35 is out of the question.

The sensor is not self heating because the test was done only in software with example resistor values as in pcm programmer's example.

The current through the sensor is about 1.65mA.

As for thermocouples, they need amplification. right?
I could do some tests with my multimeter's thermocouple but I found the KTY84 easier because the values can be measured by the ADC without extra hardware.
jaimechacoff



Joined: 14 Feb 2010
Posts: 24
Location: Santiago, Chile

View user's profile Send private message

PostPosted: Thu Feb 25, 2010 1:17 pm     Reply with quote

upload a TXT file or an Excel file with all the data you want to fit and i will do it for you.

but, I can't have it for today ... I am also in troubles with some software hahahaha : )
dyeatman



Joined: 06 Sep 2003
Posts: 1924
Location: Norman, OK

View user's profile Send private message

PostPosted: Thu Feb 25, 2010 1:34 pm     Reply with quote

Have you considered something like a DS1820 in the TO92 case?
It goes up to 250 degrees F and would give you much better accuracy and eliminate all the error calculations.
_________________
Google and Forum Search are some of your best tools!!!!
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Feb 25, 2010 3:27 pm     Reply with quote

The temperature in question was 250°C rather than 250°F. Clearly you can't use any Si based IC at these temperatures.

Si PTCs as KTY are fine, I use them since decades. I just wanted to mention their limited accuracy in wide
range operation, as indicated by the datasheet. But it's most likely sufficient for your purposes.

Up to 400 °C, platinum resistance thermometers are mostly preferred to thermocouples, except for applications,
where small size matters. They also don't necessarily need amplification, but the t.c. is lower, so have possibly an
unsufficient resolution with a 10-Bit ADC. You can say, that a KTY sensor fits the accuracy and price of a 10-Bit ADC
much better than a Pt1000 sensor, which rather demands a 12 to 16-Bit ADC.

If you use the KTY84 in an extended temperature range, you should observe datasheet Fig. 3 "Sensor resistance
as a function of ambient temperature and operating current", particularly the polarity sensitivity.

P.S.: A final remark. As said, fitting your own polynominal for a specified range is easy. But you can also calculate
a classical "rule of three" table interpolation with the exact data sheet resistance table.

P.P.S: MS. Excel calculated the below 3rd order filt for the 0..250°C range:
Code:
y = 0.0000000174598x3 - 0.0001046520x2 + 0.323308x - 135.9886
georpo



Joined: 18 Nov 2008
Posts: 278
Location: Athens, Greece.

View user's profile Send private message

PostPosted: Thu Feb 25, 2010 6:18 pm     Reply with quote

Thanks everybody for the support!

For now I use a table with the fixed values from the datasheet as a
reference and use a "rule of three" to find the values between them, the
result is more than 5°C error for temperatures over 100 °C.

What would be the best method to turn the ADC value directly to °C?

I use this:

Vref+ =3.3v
Vref- =1v

So, the resolution is 2.3v / 1023 = 0.002248 volts / ADC step

The pullup resistor of the sensor to 3.3v is 1Kohm

since Vout= (R2/(R1+R2))*Vin

for a 1000 ohm sensor value I have :

(1000/2000)*3.3 = 1.65 Volts - 1volt (Vref-) = 0.65volts

0.65volts / 0.002248 = 289.145. This is the ADC reading for 1000 ohm sensor value.

This method works, but I am sure there is a much more simple way to do it.


FvM, please tell me, what are the X and Y values in your Excel formula?

y= resistor and x= temperature?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group