Thermistor or Temperature Sensor With Arduino

Thermistor or Temperature Sensor:

A thermistor or temperature sensor is a resistor that changes its resistance with temperature. Technically, all resistors are thermistors since their resistance always changes slightly with temperature, but this change is usually very small and difficult to measure. Thermistors(temperature sensor) are made of so their resistance changes drastically, such that they can change 100 ohms or more per degree centigrade.

There are two types of thermistors(temperature sensor), called NTC (from the English “negative temperature coefficient ”) and PTC (for“ positive temperature coefficient ”). In the First, as the temperature increases, its resistance decreases; in the seconds, as the temperature increases, its resistance increases. Our projects will normally use NTCs to measure temperature; the PTCs are usually used more inside resettable fuses (where if the temperature rises, increase their resistance to “choke” the current and thus protect from a possible overheating to circuits).

Thermistor or Temperature Sensor are much cheaper than other types of temperature sensors. temperature; In addition, they are resistant to water (they are only resistors after all) and they work at any voltage. They are difficult to spoil due to their simplicity and are incredibly accurate in measurements. For example, a 10 KΩ thermistor (value nominal, taken at 25 ° C as a standard reference) can measure temperature with a margin of error of ± 0.25 ° C (assuming that the analog-digital converter is accurate enough too). However, they do not usually withstand temperatures beyond 100 and a few degrees, and its time constant (that is, the seconds that the thermistor needs to reduce the difference between its temperature by 63% initial and final) is normally longer than ten seconds.

To measure the resistance of a thermistor or temperature sensor you can use a multimeter, such as any other resistance. The value we obtain will depend on the temperature of where we are.

If what we want is to measure the temperature itself with a plate Arduino, we must first measure with it the resistance of the thermistor, and from she deduce the corresponding temperature. But our Arduino board doesn’t have a built-in resistance meter, so, as we already did with the photoresistors, we will have to use the analog inputs of the board to detect voltage variations and deduce from these the desired value of the voltage-current resistance. Thus, the connection diagram is identical to the one we already use with photoresistors (and photodiodes): we must connect one terminal of the thermistor to the power (for example, the 5V pin of the Arduino board) and the other connect it to a series to a terminal of a fixed value resistor (which will act as a “pulldown” resistor); the other terminal of this “pull-down” resistor must be connected to ground. In addition, we must connect an analog input from our Arduino board to an intermediate point between both resistors to obtain a reading of the drop in potential between that point and ground.

By means of the circuit just described, when we detect that this voltage measured is increasing, we can deduce, by pure Ohm’s Law, that the resistance of the NTC thermistor(temperature sensor)  is decreasing and therefore the temperature is increasing (and vice versa: if the voltage decreases, the resistance increases and the temperature decreases as well). The exact relationship between the measured voltage and the resistance of the thermistor can be calculated in the same way that we already saw when we study photoresistors, using the formula

Vmed = (Rpull / (Rpull + Rtermistor)) · Vsource

We also know that, in reality, Vmed is not the voltage with which we work on our Arduino board, because it always uses a converter analog-digital with which it performs a “mapping”. This mapping converts the values analogs read (which can oscillate between 0 V and 5V if we assume that the voltage supplied by the source is 5V) to digital values ​​(ranging between 0 and 1023). These digital values ​​are what the Arduino board actually understands and with those that we will work on in our sketches. Converting from analog values ​​to digital can be expressed by the same rule of proportionality that we saw with the photoresistors:

Vconverted = Vmedx1023/5

From here, just as we did with them, if we substitute this expression in the formula of the previous paragraph, and we clear from there Rtermistor we arrive at the following expression:

 Rtermistor = (Rpull1023 / Vconverted) – Rpull

This allows us to finally know what is the current value of the thermistor resistance starting from the digitized voltage obtained by the Arduino board. The above expression shows, as we already knew, that Rtermistor is inversely proportional to Vconverted.

But what value does Rpull have to have? The most commonly used value for the pull-down resistance that accompanies our thermistor is 10 KΩ, although sometimes 1KΩ is also used. Both are widely used values, but if we want to have greater control of the sensitivity of the thermistor, we would have to choose its value with a little more discretion. To do this, the procedure would be to substitute in the same already known formula Vmed = (Rpull / (Rpull + Rtermistor)) Vsource different values concrete R-thermistor numerical values ​​corresponding to known temperatures (this is you can check in the datasheet equivalency table) and choose a value determined of Rpull: observing what values ​​of Vmed we are obtaining we can choose the Rpull value that allows us to have a wider range of Vmed without saturating it.

The next natural step, once the resistance value of the thermistor, would be to find out what temperature it corresponds to. The easiest way to achieve this is to consult the equivalence table that always comes in the datasheet, where for certain values ​​of Rtermistor it is already specified directly the corresponding temperature.

This system will be good for us if all we want is to design a circuit that makes quick comparisons like “if the temperature is below such do this and if it is superior to such do the other ”. If what we want, however, is to obtain the values accurate and real temperature values, we are fortunate to have equation mathematics that does this to a very good approximation (in fact, it achieves errors of only ± 0.02 centigrade in a range of 100 centigrade).

Steinhart-Hart equation:     

1/T=   A + B   · ln(R) + C  ·  (ln(R)3, where R is the value in ohms of the thermistor in a given moment, T is the temperature measured in degrees Kelvin (one degree Kelvin is equal to one centigrade + 273.15) and A, B and C are coefficients that are different depending on the type and model of the thermistor (and that they are valid only for a certain temperature range, specified in the datasheet).

However, as this formula is somewhat complex and requires knowledge of the value of various coefficients that we may not know, in general, we can use a simplified equation:

1/T = 1/T0 + 1/B x ln(R/R0)

where T0 is the call nominal temperature (almost always 25 ° C = 298.15 K), R0 is the resistance of the thermistor at that temperature (the so-called “nominal resistance”, data available in the datasheet) and B is the only coefficient we need to know, which can be consulted in the datasheet always.

thermistor or Temperature sensor with Arduino:

I connected one terminal of the thermistor with 5V and the other terminal of the thermistor I connected with pull-down resistor and the other terminal of the resistor I connected to the ground. For analog value receiving, I take a wire from the middle of the thermistor and pull-down resistor and connect with Arduino A0 as you can see in below circuit diagram.

Thermistor Sensor circuit diagram

Thermistor or Temperature Sensor

Thermistor Sensor Programming:



Recommended For You

About the Author: Fawad

My name is Shahzada Fawad and I am a Programmer. Currently, I am running my own YouTube channel "Expertstech", and managing this Website. My Hobbies are * Watching Movies * Music * Photography * Travelling * gaming and so on...

Leave a Reply

%d bloggers like this: