What's the simplest way to calibrate a thermistor?

Reading Thermistor is a little tricky. The above method of calibration, wield no yield to an error detection, It would create two points of a logarithmic curve (the thermistor response curve.

This means, for every 0.1°C of changue of temperature, the correspondent changue on resistance will vary, depending on the range of the temperature. enter image description here

At first, you might look an error about 2 to 5°C off the real temperature, yet no error, only a bad reading.

You dont post any details on how are you reading this thermistor, Arduino May be? I must say, some libraries dont work at all, so you must create a especial function to do so.

Post on detailed explanation on how to characterize and read an thermistor. The post is in spanish, but in the code tags, all explanation in in plain English.

Once you have obtain you ABC coeficients, your error will be about 0.1°C from another measurement, even in a 6m long run of LAN wire.

A test on 4 thermistors This test read at the same time the 4 thermistors, You can see a small difference in temperature from 2 of them I was holding briefly in my fingers.


Fill a cup with ice cubes and pour in water to fill up to the brim. Give it the occasional stir. When the ice is starting to melt you'll be at 0°C. Stick the sensor into the water and take a reading.

If your sensor can tolerate it, drop it into a kettle of boiling water. At sea-level that will give you a 100°C reference reading.

If you need to heatshrink your sensor for waterproofing you will have to allow some time for the reading to stabilise.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. Simple linear calibration curve.

  • y1 is the resistance, voltage or ADC reading at 0°C.
  • y2 is the resistance, voltage or ADC reading at 100°C.

$$ T = 100 \frac{y - y1}{y2-y1} $$ where y = reading at temperature T.

As pointed out in the comments, if you are using a thermistor you will need to check the datasheet for linearity. If this simple approach isn't good enough you will have to use a polynomial calculation or a look-up table in a micro-controller.


Calibrating a thermistor (or mostly any sensor for that matter) is a two step process:

  1. measure the calibration data
  2. devise a calibration law that fits that data

The first step is the hardest, and unfortunately the one I have the least experience with. I will then only describe it in very general terms. The second step is mostly math.

Measuring the calibration data

You have to fill a table with (T, R) pairs, i.e. with resistance values measured at know temperatures. Your calibration data should cover the whole range of temperatures that you will need in actual use. Data points way out of this range are not very useful. Otherwise, the more data points you have, the better.

In order to measure the resistance of the thermistor, I advise you against using an ohmmeter. Use instead the same setup you will be using for the actual post-calibration measurements. This way, any systematic errors in the resistance measurement (like ADC offset and gain errors) will be calibrated out.

For knowing the temperature, you have two options: either use fixed temperature points (like, e.g., boiling water or melting ice) or use an already calibrated thermometer. Fixed points are the gold standard of temperature calibration, but it's hard to get them right, and you will likely not find many of them within the range of temperatures you care about.

Using a known-good thermometer will likely be easier, but there are still a few caveats:

  • you should make sure the thermistor and the reference thermometer are at the same temperature
  • you should keep that temperature stable long enough for both to reach thermal equilibrium.

Putting both close together, within an enclosure with high thermal inertia (a fridge or oven) may help here.

Obviously, the accuracy of the reference thermometer is a very important factor here. It should be significantly more accurate that the requirements you have on your final measurement accuracy.

Fitting a calibration law

Now you need to find a mathematical function that fits your data. This is called an “empirical fit”. In principle, any law can do as long as it lies close enough to the data points. Polynomials are a favorite here, as the fit always converges (because the function is linear relative to its coefficients) and they are cheap to evaluate, even on a lowly microcontroller. As a special case, a linear regression may be the simplest law you can try.

However, unless you are interested in a very narrow range of temperatures, the response of a NTC thermistor is highly non-linear and not very amenable to low-degree polynomial fits. However, a strategic change of variables can make your law almost linear and very easy to fit. For this, we will take a diversion through some basic physics...

The electric conduction in an NTC thermistor is a thermally-activated process. The conductance can then be modelled by an Arrhenius equation:

G = G exp(−Ea/(kBT))

where G is called the “pre-exponential factor”, Ea is the activation energy, kB is the Boltzmann constant, and T is the absolute temperature.

This can be rearranged as a linear law:

1/T = A + B log(R)

where B = kB/Ea ; A = B log(G) ; and log() is the natural logarithm.

If you take your calibration data and plot 1/T as a function of log(R) (which is basically an Arrhenius plot with the axes swapped), you will notice it is almost, but not quite, a straight line. The departure from linearity comes mainly from the fact that the pre-exponential factor is slightly temperature dependent. The curve is nevertheless smooth enough to be very easily fitted by a low-degree polynomial:

1/T = c0 + c1 log(R) + c2 log(R)2 + c3 log(R)3 + ...

If the range of temperatures you are interested in is short enough, a linear approximation may be good enough for you. You would then be using the so-called “β model”, where the β coefficient is 1/B. If you use a third degree polynomial, you may notice that the c2 coefficient can be neglected. If you do neglect it, you then have the famous Steinhart–Hart equation.

In general, the higher the degree of the polynomial, the better it should fit the data. But if the degree is too high you will end up overfitting. In any case, the number of free parameters in the fit should never exceed the number of data points. If these numbers are equal, then the law will fit the data exactly, but you have no way to assess the goodness of fit. Note that this thermistor calculator (linked to in a comment) uses only three data points to provide three coefficients. This is god for a preliminary approximate calibration, but I would not rely on it if I needed accuracy.

I will not discuss here how to actually perform the fit. Software packages for making arbitrary data fits abound.