, ,

I use a thermistor to calculate the temperature of a bath.  I started testing in a prior post, but ran into an issue because I was using a 10K resistor for R15.  See this link for more details.

The Goal

The goal of this post is to do a litmus test on the temperature that would be calculated prior to conversion of the voltage to digital through the ADC.  While I don’t expect the temperature to be spot on, I do expect the reading to be within the ballpark.  If needed, further improvements will be done to improve readings.

Thanks to Those That Went Before

Thanks to Gerald Rectenwald for his excellent class notes on thermistors.  They were easy to read and useful.

As always – a huge thank you to Chris Gammell.  His Contextual Electronics and additional guidance has made it possible for me to even attempt this effort.

Thanks to the people behind the Wikipedia entry on Thermistors.  The article was very helpful.

The Test

Due to lack of soldering skill on my part, I managed to tear off the pads from R15 – the resistor that acts with the thermistor to divide the voltage.  The kicad files are located at this GitHub location.  OshPark provides 3 boards so I was able to only solder what was needed.  This time, I used a 1K resistor for R15.  Using 1K instead of 10K should read voltage values that can be digitized by the MCP3901 – which can handle voltage values between +/-.79V.

YIPPEE! Simple:


Measuring Temperature

I noted in the previous post (link), going from a voltage reading to a temperature reading (either in C or F) is a three step process:

1. The thermistor (Rtherm) is a variable resistor.  What is it’s current value?

2. The temperature has a linear relationship with Rtherm.  Use the B parameter method to solve for the temperature in Kelvins.

3. Convert from Kelvins to either C and/or F.

Solving for Rtherm

From the previous post, I first solve for the value of Rtherm (plugged into holes 3 and 4 of the holes for the 8 position terminal block).  In order to do this, I need to measure Vo then use the formula:

Rtherm = R15/(Vs/Vo – 1)

I measured Vs = 5.18V and Vo = .42V relative to AGND.  Plugging into the above equation, Rtherm = 1000/(5.18/.42 – 1) = 11,333.  At least the calculated value was not completely out of range – say if it had been 113,330…

Solving for Temperature in Kelvins

Perhaps you have become friendly with formulas.  Frankly, formulas intimidate me.  But if I take it r-e-a-l SSSSSLLLLLLLOOOOWWWW …..

As noted in the Wikipedia article on thermistors:

T = B/ln(Rtherm/r∞)

It also notes r∞ to be:

r∞ = Roe^(-B/To)

Where Ro = the thermistor value that the thermistor is spec’d at.  Mine is a 10K thermistor.

To = 298.15K (25˚C in Kelvin)

B comes from the data sheet.  For the thermistor I am using (link), B  = 3977.

Plugging in, I get:

r∞ = 10000*e^(-3977/298.15) = 0.029259

T (Kelvins) = 3977/ln(11333/298.15) = 295.25

Solving for Temperature in ˚C or ˚F

To go from Kelvins to C, just subtract 273.15.  This gets to: 295.25 – 273.15 = 22.1˚C.

The formula to go from C to F is ˚C*2 – 30, 74.2˚F

While this is not extremely accurate, the temperature where I am at is about 70˚F.  This makes the reading I got with the thermistor about 4˚F higher.  I feel this is good enough to pass my litmus test.  Now I need to better understand:

  • resistor values vary.  How important is precision of R15 or the thermistor?  It seems that thermistor tutorials suggest 5% – which is what I am using.  Should I pay more for 1% precision?  How much do small changes in temperature affect the pH value measurement?
  • How accurate are the voltage measurements for Vs and Vo?  Is there enough noise to cause inaccurate results?  I need to get a better feel for the noise on the voltage line.

Next Time

For this pass, I am focusing on knowing if the results I measure are within a litmus test of expected results.  I am not as concerned with accuracy.  And in this case, I am not sure how accurate I want to be.  Because of the relationship between the pH value and temperature, accuracy will depend on the affect of a small (say 1˚F) change of temperature on the pH value.



Thanks for reading this far.  Please find many things to smile about.