Tesmistor: everything you need to know to measure temperature in your projects

thermistor

Different temperature sensors have been analyzed in other articles. One of the elements or devices that you can use to measure said temperature is precisely the thermistor, in English thermistor (thermally sensitive resistor or temperature sensitive resistance). As its name suggests, it is based on a material that changes its electrical resistance according to the temperature to which it is subjected.

In this way, by means of a simple formula, knowing the voltage and the intensity to which it is subjected, the resistance can be analyzed to determine temperature according to its scale. But it is not only used as a temperature sensor, it can also be used to alter some characteristics of the circuit based on its temperature, as a protection element against excess current, etc.

La choice of sensor type What you are going to use for your project will depend on the needs you have. Other articles that may interest you about temperature sensors:

  • LM35: temperature and humidity sensor.
  • DS18B20: temperature sensor for liquids.
  • DHT22: precision temperature and humidity sensor.
  • DHT11: cheap temperature and humidity sensor.

Introduction to the thermistor

thermistor symbol

In the market you can find a lot of thermistors with different encapsulations and of different types. All of them are based on the same principle, their semiconductor material (nickel oxide, cobalt oxide, ferric oxide, ...) will be altered when the temperature varies, thus altering its internal resistance.

PREMIUM QUALITY

Between the types of thermistor we can highlight two groups:

  • NTC (Negative Temperature Coefficient) Thermistor: these thermistors with a negative temperature coefficient, as the temperature increases, the concentration of charge carriers also increases, therefore, their resistance is reduced. This makes them practical so that they can be used as:
    • Temperature sensors quite frequent in many circuits as a resistive detector of low temperatures, in the automotive sector for measurements in motors, in digital thermostats, etc.
    • Starting current limiter, when using a material with a high initial resistance. When the current passes through them when the circuit is turned on, this device heats up due to the resistance it presents and as the temperature increases, the resistance will gradually decrease. This prevents that at the beginning, the current flow that passes to the circuit is very high.
  • PTC (Positive Temperature Coefficient) Thermistors: they are other thermistors with a positive temperature coefficient, with very high dopant concentrations that give them the opposite effect to NTCs. That is, instead of lowering the resistance with increasing temperature, the opposite effect occurs in them. For this reason, they can be used as fuses to protect overcurrent circuits, as a timer to demagnetize CRT or cathode ray tube displays, to regulate the current of motors, etc.
NTC thermistor graph

Graph of the resistance curve with respect to the temperature of a NTC

Do not confuse the thermistor with the RTD (Resistance Temperature Detector)Since unlike them, thermistors DO NOT change resistance almost linearly. RTD is a type of resistance thermometer to detect temperature based on the variation of the resistance of the conductor. The metal of these (copper, nickel, platinum, ...), when heated, has a greater thermal agitation that will scatter the electrons and reduce their average speed (increases resistance). Therefore, the higher the temperature, the greater the resistance, as with the NTC.

Both RTDs, NTCs, and PTCs are quite common, especially NTCs. The reason is that they can perform their role with a very small size and a very cheap price. You acquire NTC thermistors like the popular MF52 for little price in stores like Amazon, just like No products found., as well as in other specialized electronics stores.

As to Pinout, it only has two pins, just like normal resistors. Its way of connecting it is the same as that of any resistor, only the resistance value will not remain stable, as you should already know. For more information on the accepted temperature ranges, the maximum supported voltage, etc., you can consult the data of thedatasheet of the component you have purchased.

Integration with Arduino

Arduino schematic with thermistor

For integrate a thermistor with your Arduino board, the connection couldn't be easier. It is only necessary to adapt that theory and calculations for the code that you have to generate in your Arduino IDE. In our case, I have assumed the use of an NTC thermistor, specifically the MF52 model. In case of using another thermistor model, you must vary the values ​​A, B and C to adapt them according to the Steinhart-Hart equation:

Steinhart-Hart model equation

Being T the measured temperature, T0 is the environmental temperature value (you can calibrate it as you are interested, such as 25ºC), R0 would be the value of the resistance of the NTC thermistor (in our case the one provided by the MF52 datasheet, and you should not confuse it with the resistance I have added to the circuit), and the coefficient B or Beta can be found in the manufacturer's technical sheet.

El bar code it would therefore be like this:

#include <math.h>
 
const int Rc = 10000; //Valor de la resistencia del termistor MF52
const int Vcc = 5;
const int SensorPIN = A0;

//Valores calculados para este modelo con Steinhart-Hart
float A = 1.11492089e-3;
float B = 2.372075385e-4;
float C = 6.954079529e-8;
 
float K = 2.5; //Factor de disipacion en mW/C
 
void setup()
{
  Serial.begin(9600);
}
 
void loop() 
{
  float raw = analogRead(SensorPIN);
  float V =  raw / 1024 * Vcc;
 
  float R = (Rc * V ) / (Vcc - V);
  
 
  float logR  = log(R);
  float R_th = 1.0 / (A + B * logR + C * logR * logR * logR );
 
  float kelvin = R_th - V*V/(K * R)*1000;
  float celsius = kelvin - 273.15;
 
  Serial.print("Temperatura = ");
  Serial.print(celsius);
  Serial.print("ºC\n");
  delay(3000);
}

I hope this tutorial has helped you ...


Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.