# What's the simplest way to calibrate a thermistor?

As a hobbyist who don't have access to lab equipment, it really seems impossible to me to be able to calibrate the thermistor that i have.

Of course there are calibrated temperature sensors like DS18B20, but thermistors specially on slow MCUs like Aruino UNO (compared to new MCUs) are snappier.

What options do we have for calibrating a thermistor without using lab equipment?

• Use a calibrated sensor as the DS18B20 to take a characteristic of the thermistor. – Janka Aug 27 '19 at 22:06
• What do you mean by "snappier"? That doesn't sound like a good justification if you need to do software correction on the thermistor but you don't with a DS18B20. – Elliot Alderson Aug 27 '19 at 22:07
• If the one second delay of the DS18B20 on full resolution is your concern, use one of the battery monitor onewire sensors, e.g. the DS2438. It has a fast temperature sensor on chip. – Janka Aug 27 '19 at 22:08
• @newbie Calibration of temperature, for accuracy, is generally difficult. Some ranges are more difficult than others. Freeze-points of commonly available materials can help a lot, more so if your range includes more of those. But accurate references will be traceable to NIST or DIN (or similar group) standards kept in a lab somewhere and managed by a physicist or two. It would help your question if you specified the temperature range and the accuracy and precision you seek over that range. – jonk Aug 28 '19 at 0:51
• @newbie But at home? Look for purity and then create ice/liquid combinations or else pure condensing boilers. For example, ice mixed with water is very commonly used -- but whether or not it helps enough may depend on your accuracy figures and the work you are willing to go to. You can also use boiling water or sulfuric acid allowed to condense upon the bottom of a florence flask. (I've used both.) But the results also depend upon impurities and atmospheric pressure variations and other factors. Your requirements have a lot to bear on what can be suggested for homebrew attempts. – jonk Aug 28 '19 at 0:56

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.

• Thanks for well detailed and explained answer. side question; i used a DS18B20 sensor as my temperature reading source and noticed the thermistor reading is about 2.2 degrees off. i then added that 2.2 degrees in thermistor temperature calculation. now both readings from ds18b20 and thermistor are almost the same. i tested the temperature change within the range of 25 to 35 degrees and even though thermistor was more responsive to temperature changes but at the end result was almost the same. what's the down side of this method that i used? – ElectronSurf Aug 29 '19 at 13:21
• @newbie: I don't understand “the thermistor reading is about 2.2 degrees off”. A thermistor doesn't give a reading in degrees. Do you mean that you tried some calibration law (coming from where?) that gave readings 2.2 °C off? If this is the case, and this offset is strictly constant, you approach has the minor drawback of having a more complex conversion law with an extra arithmetic step. If the offset is not strictly constant, redoing the fit should give you better results. – Edgar Bonet Aug 29 '19 at 13:52

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.

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.

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.

• @newbie This is the right approach. If you can't follow the instructions, reply to me in a day or so and I'll look up my arduino code and look up the references it contains and write an answer here. – piojo Aug 28 '19 at 4:36
• Links die, and the ability of this answer to create a solution in the future is highly dependent on the link staying active. Can you add the steps to your answer? – Keeta - reinstate Monica Aug 28 '19 at 13:55
• I copy and paste the code section of the answer; //This is an example code on how to read a thermistor, the "Thermimistor.h" Lib out there only acepts Beta //coeficient and in my case yield to incorrects results, this a way more accuerrate way to read the //thermistor, in case you have odd or wrong meassurements please follow this steps: // //For get the acurrate results for this code you will need; //a multymeter, a NTC thermistor, another accurrate themperature //probe meter. //Step 1.- Set multimiter on resistance meassurement mode – Alejandro Santiago Aug 28 '19 at 14:52
• //Step 2.- Read and anotate the actual resistance of the thermistor //and the actual temperature (allow 1min to get stable meassurement). //Some Hot water and a cup. //Step 3.- place both sensors (Thermistor and temperature probe in a //recipient containing water at ambient temperature). //In another cup heat up some water. //Add hot water until you heat more than 10°C the temp probe, wait for //stable meassurement and anotate the temperature and the resistance. //Add more water to heat up the element 20° from the first meassurement. //Take note of the temperature and resist – Alejandro Santiago Aug 28 '19 at 14:53
• @newbie If you have a NTC thermistor, you need to calculate A, B, and C constants and plug them into the Steinhart­ Hart Equation to resolve a temperature from a resistance. You need three temperature/resistance measurements to find these constants. (The constants differ per thermistor, and finding the constants is your calibration.) This article shows how to do it, but since it uses matrix math, I suggest finding an online calculator. thinksrs.com/downloads/pdfs/applicationnotes/… – piojo Aug 30 '19 at 10:39

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.

simulate this circuit – Schematic created using CircuitLab

Figure 1. Simple linear calibration curve.

$$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.

• This will give you two points, which you can use to calculate beta for those two temps. The response in that range will be nowhere near linear (assuming the OP means it when s/he calls it a "thermistor"), – Scott Seidman Aug 27 '19 at 22:13
• @newbie: See the update. – Transistor Aug 27 '19 at 22:15
• @newbie As Transistor writes at the end, this approach may not be good enough. I can't imagine it would ever be good enough, frankly. The only thing this approach will get you is repeatability (supposed 40°C will always be the same supposed 40°C, but it may really be 20°C or 60°C). – piojo Aug 28 '19 at 4:34
• Pure water boils at 100 °C if the pressure is 1.01325 bar or 1013.25 millibar or hectopascal. The pressure at sea level depends on weather. – Uwe Aug 28 '19 at 14:55
• @newbie. That looks useful. If you get it to work then post some sample code into your question or as an answer. I'm sure others would find it more useful than my answer. – Transistor Aug 29 '19 at 11:50

Linearized thermometers have a gain & offset error.

• Bipolar supplies will likely have offset nulled at 0V.
• single supply bridges will have some Vref or R ratio of Vref or Vcc where offset is nulled at that deign temperature. Usually this is symmetrical, so that would correspond to the midpoint of your design range.
• thermistors are calibrated at 25’C with a specific sensitivity curve with 2 variables.

• to calibrate it you only need 2 measurements

• Null adjust where error voltage =null = 0 , Vt=Vref
• gain adjust at T max
• for a typical 4 R bridge, that is usually midpoint temp.
• use any better thermometer for calibration or
• use ice water and boiling water for 0, 100’C