Archive for November, 2011

Reading more precisly the temperature using a thermistor

November 30, 2011 Leave a comment

A thermistor is a resistor whose resistance modifies as the temperature modifies. Sometimes the variation is linear, but usually it is not. Since there is specified, into the thermistor datasheet, a table with values (correspondences between resistance and real temperature value) it is possible to make, in the most simple way, a linear approximation between 2 set of values. This type of approximation is ok but not really good when the precision is a very important thing.

We started to make some simple tests using a thermistor provided by Seeeduino (in the last time I become a fan of them šŸ˜€ ).

It is small in size and it could be easily inserted into the walls (of course, using some drilled holes) or placed on different surfaces (attachable with a glued band). The datasheet is attached bellow. The values are also available in CSV format: link (provided by Eric McKinley).

Using Matlab we have done the representation of the characteristic in 2 different ways: linear interpolation and spline interpolation. The spline interpolation should be much closer to real characteristic.

Into the figure below it is quite hard to distinguish the difference between them, but a zoom will reveal more details.

Anyway the difference between the 2 types of interpolationĀ  is small enough. And if we do the difference between them we get the next result. For normal values of the temperature (normal, for an office space) the maximum difference is approximated to 0.01 degree Celsius, a value which could be neglected at office spaces monitoring. For other monitoring applications it could be important.

Into an Arduino application it would be complicated to make the spline interpolation when it is necessary to compute the temperature. The simplest way is to do the linear interpolation, or a more sophisticated way is to have an equation which to represent the spline interpolation.

To determine the equation we have 2 ways:

  1. using the Steinhart-Hart equation format. A specific electrical circuit could be used to determine the equation. I just took the coeficients specified by Richard on Seeeduino website, and they are just fine (a=1.114482E-3, b=2.373524E-4, c=6.895445E-8). The coefficients values are correct only for this type of thermistor. For more correctness each independent thermistor should be tested separately, since the characteristic could differ slightly from one device to another.
  2. determine a logarithmic equation using Matlab environment (polyfit and polyval methods). The equation is more complex but is more simply to determine it if we have available the characteristic of the thermistor. For the Seeeduino thermistor the logarithmic polynomial equation should have the next coefficients: C4 = -0.0324,Ā  C3 = 1.2166,Ā  C2 = -15.4806, Ā  C1 = 53.5809,Ā  C0 = 127.5468Ā  (C4 * power(log(xx), 4) + C3 * power(log(xx), 3) + C2 * power(log(xx), 2) + C1 * log(xx) + C0).

The Steinhart-Hart equation:

To select one way or the other to determine the specific equation depends on the user possibilities and if the thermistor characteristic is available or not.

To connect the thermistor presented above to Arduino board the next connection should be done.

Categories: My research project