Reading Temp using a 10K Thermistor

Started by Jim Fouch June 14, 2002
I was wondering if someone would give me some hints on how to hook up a
Radio Shack 271-110A thermistor.

It for a motorcycle application and I only need temps in the range of 0 -
125.

I would like to use one of the ADC ports, but not really sure how to convert
the resistance into a value I can work with inside the BX24.

I have know how to read a 100K pot using an ADC port and get a # from
0-1023. But just not sure how to work out the math for this .7579 Kohm -
320.2 Kohm thermistor.

Once I'm able to get the value of the thermistor I was going to use a lookup
table to convert it into a Temp reading on a LCD.

Tmp F Tmp C Ohms (K's)
-58 -50 320.2
-49 -45 247.5
-40 -40 188.4
-31 -35 144
-22 -30 111.3
-13 -25 86.39
-4 -20 67.74
5 -15 53.39
14 -10 42.45
23 -5 33.89
32 0 27.28
41 5 22.05
50 10 17.96
59 15 14.68
68 20 12.09
77 25 10
86 30 8.313
95 35 6.941
104 40 5.826
113 45 4.912
122 50 4.161
131 55 3.537
140 60 3.021
149 65 2.589
158 70 2.229
167 75 1.924
176 80 1.669
185 85 1.451
194 90 1.366
203 95 1.108
212 100 0.9375
221 105 0.8575
230 110 0.7579

Jim Fouch
FOUCH SOFTWARE
www.fouchsoftware.com
(814) 455-1294



Jim,

This might work for you, it converts the reading into degrees F and
returns that value as a single which you could CInt to get a whole
number if needed. You can also change how many reading are used to
calculate the temperature in an attemp to smooth out the data if
necessary. The input for the function is the pin number (13-21?) of
the built-in a/d converter. This was hacked up for the Radio Shack
271-110A thermistor. Function ReadThermistor(ByVal pin As Byte) As Single

Dim RT As Single, TF As Single, Band As Single, i As Byte
Dim Readings as byte

Readings = 2
TF = 0#
For i = 1 To Readings
Band = CSng(GetADC(pin))
RT = (10000# * Band) / (1024# - Band)
RT = (1# / (A + B * Log(RT))) - 273.15
TF = TF + (RT * 1.8 + 32#)
Next
ReadThermistor = (TF / CSng(Readings) )
End Function --- In basicx@y..., "Jim Fouch" <fouch.soft@g...> wrote:
> I was wondering if someone would give me some hints on how to hook
up a
> Radio Shack 271-110A thermistor.
>
> It for a motorcycle application and I only need temps in the range
of 0 -
> 125.
>
> I would like to use one of the ADC ports, but not really sure how
to convert
> the resistance into a value I can work with inside the BX24.
>
> I have know how to read a 100K pot using an ADC port and get a #
from
> 0-1023. But just not sure how to work out the math for this .7579
Kohm -
> 320.2 Kohm thermistor.
>
> Once I'm able to get the value of the thermistor I was going to use
a lookup
> table to convert it into a Temp reading on a LCD.
>
> Tmp F Tmp C Ohms (K's)
> -58 -50 320.2
> -49 -45 247.5
> -40 -40 188.4
> -31 -35 144
> -22 -30 111.3
> -13 -25 86.39
> -4 -20 67.74
> 5 -15 53.39
> 14 -10 42.45
> 23 -5 33.89
> 32 0 27.28
> 41 5 22.05
> 50 10 17.96
> 59 15 14.68
> 68 20 12.09
> 77 25 10
> 86 30 8.313
> 95 35 6.941
> 104 40 5.826
> 113 45 4.912
> 122 50 4.161
> 131 55 3.537
> 140 60 3.021
> 149 65 2.589
> 158 70 2.229
> 167 75 1.924
> 176 80 1.669
> 185 85 1.451
> 194 90 1.366
> 203 95 1.108
> 212 100 0.9375
> 221 105 0.8575
> 230 110 0.7579
>
> Jim Fouch
> FOUCH SOFTWARE
> www.fouchsoftware.com
> (814) 455-1294





Sorry, in my previous post A and B should be defines as -

Const A As Single = 0.0006217335
Const B As Single = 0.0002972154

--- In basicx@y..., "Jim Fouch" <fouch.soft@g...> wrote:
> I was wondering if someone would give me some hints on how to hook
up a
> Radio Shack 271-110A thermistor.
>
> It for a motorcycle application and I only need temps in the range
of 0 -
> 125.
>
> I would like to use one of the ADC ports, but not really sure how
to convert
> the resistance into a value I can work with inside the BX24.
>
> I have know how to read a 100K pot using an ADC port and get a #
from
> 0-1023. But just not sure how to work out the math for this .7579
Kohm -
> 320.2 Kohm thermistor.
>
> Once I'm able to get the value of the thermistor I was going to use
a lookup
> table to convert it into a Temp reading on a LCD.
>
> Tmp F Tmp C Ohms (K's)
> -58 -50 320.2
> -49 -45 247.5
> -40 -40 188.4
> -31 -35 144
> -22 -30 111.3
> -13 -25 86.39
> -4 -20 67.74
> 5 -15 53.39
> 14 -10 42.45
> 23 -5 33.89
> 32 0 27.28
> 41 5 22.05
> 50 10 17.96
> 59 15 14.68
> 68 20 12.09
> 77 25 10
> 86 30 8.313
> 95 35 6.941
> 104 40 5.826
> 113 45 4.912
> 122 50 4.161
> 131 55 3.537
> 140 60 3.021
> 149 65 2.589
> 158 70 2.229
> 167 75 1.924
> 176 80 1.669
> 185 85 1.451
> 194 90 1.366
> 203 95 1.108
> 212 100 0.9375
> 221 105 0.8575
> 230 110 0.7579
>
> Jim Fouch
> FOUCH SOFTWARE
> www.fouchsoftware.com
> (814) 455-1294




This looks like a truncated version of the Steinhart-Hart equation,
but where's the reference voltage, what's the divider R value, and
where did you get the coefficients?

Thanks ... Marc
Marc Hult
www.hydrologist.com --- In basicx@y..., "ipodicode" <ipodicode@y...> wrote:
> Jim,
>
> This might work for you, it converts the reading into degrees F and
> returns that value as a single which you could CInt to get a whole
> number if needed. You can also change how many reading are used to
> calculate the temperature in an attemp to smooth out the data if
> necessary. The input for the function is the pin number (13-21?) of
> the built-in a/d converter. This was hacked up for the Radio Shack
> 271-110A thermistor. > Function ReadThermistor(ByVal pin As Byte) As Single
>
> Dim RT As Single, TF As Single, Band As Single, i As Byte
> Dim Readings as byte
>
> Readings = 2
> TF = 0#
> For i = 1 To Readings
> Band = CSng(GetADC(pin))
> RT = (10000# * Band) / (1024# - Band)
> RT = (1# / (A + B * Log(RT))) - 273.15
> TF = TF + (RT * 1.8 + 32#)
> Next
> ReadThermistor = (TF / CSng(Readings) )
> End Function > --- In basicx@y..., "Jim Fouch" <fouch.soft@g...> wrote:
> > I was wondering if someone would give me some hints on how to
hook
> up a
> > Radio Shack 271-110A thermistor.
> >
> > It for a motorcycle application and I only need temps in the
range
> of 0 -
> > 125.
> >
> > I would like to use one of the ADC ports, but not really sure how
> to convert
> > the resistance into a value I can work with inside the BX24.
> >
> > I have know how to read a 100K pot using an ADC port and get a #
> from
> > 0-1023. But just not sure how to work out the math for this .7579
> Kohm -
> > 320.2 Kohm thermistor.
> >
> > Once I'm able to get the value of the thermistor I was going to
use
> a lookup
> > table to convert it into a Temp reading on a LCD.
> >
> > Tmp F Tmp C Ohms (K's)
> > -58 -50 320.2
> > -49 -45 247.5
> > -40 -40 188.4
> > -31 -35 144
> > -22 -30 111.3
> > -13 -25 86.39
> > -4 -20 67.74
> > 5 -15 53.39
> > 14 -10 42.45
> > 23 -5 33.89
> > 32 0 27.28
> > 41 5 22.05
> > 50 10 17.96
> > 59 15 14.68
> > 68 20 12.09
> > 77 25 10
> > 86 30 8.313
> > 95 35 6.941
> > 104 40 5.826
> > 113 45 4.912
> > 122 50 4.161
> > 131 55 3.537
> > 140 60 3.021
> > 149 65 2.589
> > 158 70 2.229
> > 167 75 1.924
> > 176 80 1.669
> > 185 85 1.451
> > 194 90 1.366
> > 203 95 1.108
> > 212 100 0.9375
> > 221 105 0.8575
> > 230 110 0.7579
> >
> > Jim Fouch
> > FOUCH SOFTWARE
> > www.fouchsoftware.com
> > (814) 455-1294




The BX-24's 10-bit resolution is very marginal for what you want to
do, but if you don't need high accuracy and you condition the input
both with a capacitor and by "stacking" values (taking the average of
several measurements) to filter noise, you *may* get away with it.

At the highest temperature of interest, a reference voltage of
10.0vdc and a divider resistor of 27280 ohms (Rt at your lowest temp
of interest), you will have only about one count (out of 1024) per
degree C. Very slim ....

Alternately, if you must use thermistors for some reason, use two
thermistors on two AD channels -- one for high and one for low
temperatures.

First, check/correct your data table. By inspection, your value for
85 C looks high -- should be 1266?

then, with a spread sheet,

Enter a reference voltage, Vref, into a cell. Choose 10.0 vdc for
starters.

Enter a divider resistor value, Rd, into a cell. For starters, choose
the value of the thermistor resistance at the lowest temperature of
interest which is 27280 ohms in your case.

Make and populate columns for

Tc, Temperature in C
Rt = Resistance of thermistor at Tc degrees
Rt/(Rt+Rd) *Vref = output voltage at given Tc
Rt/(Rt+Rd) *Vref * 1023/5 = number of ADC counts (the value of 5
assumes Vref and Rd were chosen as above).

You can also play with the spreadsheet to see the effect of adding
additional parallel resistances and other Rd and Vref. Another trick
is to linearize with a second thermistor.

*DO* protect the input to the BX-24 from overvoltage with a 5.1 volt
zener.

HTH ... Marc
Marc Hult
www.hydrologist.com

--- In basicx@y..., "Jim Fouch" <fouch.soft@g...> wrote:
> I was wondering if someone would give me some hints on how to hook
up a
> Radio Shack 271-110A thermistor.
>
> It for a motorcycle application and I only need temps in the range
of 0 -
> 125.
>
> I would like to use one of the ADC ports, but not really sure how
to convert
> the resistance into a value I can work with inside the BX24.
>
> I have know how to read a 100K pot using an ADC port and get a #
from
> 0-1023. But just not sure how to work out the math for this .7579
Kohm -
> 320.2 Kohm thermistor.
>
> Once I'm able to get the value of the thermistor I was going to use
a lookup
> table to convert it into a Temp reading on a LCD.
>
> Tmp F Tmp C Ohms (K's)
> -58 -50 320.2
> -49 -45 247.5
> -40 -40 188.4
> -31 -35 144
> -22 -30 111.3
> -13 -25 86.39
> -4 -20 67.74
> 5 -15 53.39
> 14 -10 42.45
> 23 -5 33.89
> 32 0 27.28
> 41 5 22.05
> 50 10 17.96
> 59 15 14.68
> 68 20 12.09
> 77 25 10
> 86 30 8.313
> 95 35 6.941
> 104 40 5.826
> 113 45 4.912
> 122 50 4.161
> 131 55 3.537
> 140 60 3.021
> 149 65 2.589
> 158 70 2.229
> 167 75 1.924
> 176 80 1.669
> 185 85 1.451
> 194 90 1.366
> 203 95 1.108
> 212 100 0.9375
> 221 105 0.8575
> 230 110 0.7579
>
> Jim Fouch
> FOUCH SOFTWARE
> www.fouchsoftware.com
> (814) 455-1294




After much work and play with thermistors, RTDs and other resistive
devices I finally settled down on a K-thermoucouple + MAX 6674(5).
The reason - I have not found a simple way to use the resistive
devices without adding "tons" of other components like op-amps,
resistors, capacitors...
MAX6674 is simple 3-wire serial IC giving you 10 bits in 0-128 degC
(0.125degC resolution)and 6675 - 12 bits in 0-1024 degC.
But if you need to do better - then yes, resistive devices are the
way to go. Alex.