Measuring temperature in range -55C +150C with Duinomite and KTY81,110


ImageKTY81,110 is low cost PTC thermistor from NXP. it changes the resistance dependant on the temperature positively i.e. increase with the temperature increase. It’s very nice solution for not so precisely temperature measurement and it’s very cheap.

I evaluate it as potential candidate for Solar Water Heating controller temperature sensor as it works in nice teperature range -55C to +150C.

The NXP datasheet for KTY181,110 is at NXP site as you can see there is table with approximate values at different temperature, the resistance / temperature is not linear but can be easily calculated with DuinoMite.

To measure the temperatuere we connect KTY181.110 in series with 3300 ohm resistor to +3.3V and will measure the temperature with PIN(1) analog input.

Here is the table with the temperature, KTY81.110 resistance and measured voltage

t R V
———————–
-55 490 0.42665
-50 515 0.44548
-40 567 0.48386
-30 624 0.52477
-20 684 0.56657
-10 747 0.60912
0 815 0.65358
+10 886 0.69847
+20 961 0.74426
+25 1000 0.76744
+30 1040 0.79078
+40 1122 0.83731
+50 1209 0.88483
+60 1299 0.93209
+70 1392 0.97903
+80 1490 1.02651
+90 1591 1.07346
+100 1696 1.12026
+110 1805 1.16680
+120 1915 1.21179
+125 1970 1.23359
+130 2023 1.25416
+140 2124 1.29226
+150 2211 1.32395

the code is pretty simple, we store the table in DATA and read it to T() and V() arrays which hold the temperature and voltage at the reference points

5 OPTION BASE 0
10 DATA -55,0.42665,-50,0.44548,-40,0.48386,-30,0.52477,-20,0.56657,-10,0.60912,0,0.65358,+10,0.69847
20 DATA +20,0.74426,+25,0.76744,+30,0.79078,+40,0.83731,+50,0.88483,+60,0.93209,+70,0.97903,+80,1.02651
30 DATA +90,1.07346,+100,1.12026,+110,1.16680,+120,1.21179,+125,1.23359,+130,1.25416,+140,1.29226,+150,1.32395
40 DIM T(23),V(23)
50 FOR I = 0 TO 23: READ T(I): READ V(I): NEXT I

then we setup PIN(1) as analog input:

60 SETPIN 1,1

as the temperature is read pretty fast and we don’t need so fast measurement we read the temperature 1000 times then average it for better precision ;)

70 NRD = 1000 ‘number of times to read
100 ‘read temperature
110 VOL = 0
120 FOR I = 1 TO NRD: VOL = VOL + PIN(1): NEXT I: VOL = VOL / NRD

then check if the voltage is in the range we expect i.e. -55 +150C and if not generate error

130 IF VOL < V(0) OR VOL > V(23) THEN 180

then we search in the table for near higher temperature reference point

140 I = 0
150 DO
160 IF VOL > V(I) THEN I = I + 1 ELSE GOTO 200
170 UNTIL (I=23)
180 PRINT “ALARM – TEMPERATURE OUTSIDE -55+150C”

then calculate exact temperature

200 TEMP = T(I)-(V(I)-VOL)*(T(I)-T(I-1))/(V(I)-V(I-1))
210 PRINT “TEMPERATURE IS:”; TEMP
220 GOTO 100

here you can see screenshot of the program running in my office

Image

2 Comments (+add yours?)

  1. Her Edie
    Jan 11, 2012 @ 21:08:31

    Thanks interested in array method for my present recording of flows.
    Herb

    Reply

  2. Trackback: Olimex DuinoMite Mini | Wizard From Oz

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 456 other followers

%d bloggers like this: