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

termistor

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

In this way, by means of a simple formula, knowing the voltage and the intensity to which it is subjected, the resistance can be analysed to determine the 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 according to its temperature, as a protection element against current excesses, etc.

The choice of the type of sensor you will use for your project will depend on your needs. 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 termistors 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 their internal resistance.

Types

Among the types of thermistor we can highlight two groups:

  • NTC Thermistor (Negative Temperature Coefficient): these thermistors with a negative temperature coefficient, as the temperature increases, the concentration of load carriers also increases, thus reducing their resistance. This makes them practical to use as:
    • Temperature sensors quite common in many circuits as a low temperature resistive detector, in automotive for measurements in engines, 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 progressively decrease. This avoids that at the beginning, the current flow to the circuit is very high.
  • PTC (Positive Temperature Coefficient) thermistors: These 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 is produced. For that reason, they can be used as fuses to protect overcurrent circuits, as timers to demagnetize cathode ray tube or CRT screens, to regulate the current of motors, etc.
NTC thermistor graph
NTC temperature resistance curve graph

The thermistor should not be confused with the RTD (Resistance Temperature Detector), because unlike them, thermistors do NOT change the resistance in an almost linear way. The RTD is a type of thermistor 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 disperse the electrons and reduce their average speed (increasing the resistance). Therefore, the higher the temperature, the greater the resistance, as is the case with NTC.

Both RTDs, NTCs and PTCs are quite common, especially NTCs. The reason is that they can perform their function with a very small size and a very cheap price. You can buy NTC thermistors like the popular MF52 for a small price in shops like Amazon, as well as , as well as in other specialized electronic shops.

As for the pinout, it only has two pins, like normal resistors. The way it is connected is the same as any resistance, only the resistance value will not remain stable, as you must know. For more information about the accepted temperature ranges, the maximum supported voltage, etc., you can check the data of the component you have bought.

Integration with Arduino

Arduino scheme with thermistor

To integrate a thermistor with your Arduino plate, the connection couldn’t be easier. You only need to adapt that theory and calculations to the code 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 you use another thermistor model, you have to 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 ambient temperature value (you can calibrate it according to your interests, like 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 additional resistance I have added to the circuit), and the B or Beta coefficient can be found in the manufacturer’s datasheet.

The code would therefore look like this:


#{i1}includes{i0}
 
const int Rc = 10000; //Value of thermistor resistance MF52
const int Vcc = 5;
const int SensorPIN = A0;

//Values calculated for this model with Steinhart-Hart
float A = 1.11492089e-3;
float B = 2.372075385e-4;
float C = 6.954079529e-8;
 
float K = 2.5; //F dissipation factor in 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("Temperature = ");
  Serial.print(celsius);
  Serial.print("ºCn");
  delay(3000);
}

I hope this tutorial was helpful to you…

Leave a Comment

*

*