In the world of sensing, there are many sensors that change their resistance value based on the environment. Knowing the sensor resistance provides a measurement of the environment being measured. These variable resistor sensors include:

**Thermistor**– a variable resistor that changes value with the surrounding temperature changes. There are two types: negative temperature coefficient (NTC) and positive temperature coefficient (PTC). The NTC thermistor decreases in value when the temperature increases the the PTC thermistor increases in value when the temperature increases.**Magneto Resistor**– a variable resistor that changes value when a magnetic field is applied. When the magnetic fields increases, the resistance increased. When the magnetic field decreases, the resistance decreases.**Photoresistor**– a variable resistor that changes value based on light energy. The photoresistor resistance decreases when light energy is increased and increases when light energy is decreased.**Humistor**– a variable resistor that changes value based on humidity.**Force Sensitive Resistor**– a variable resistor that changes values based on the force that is applied.

Thermistors are variable resistors that are more sensitive to temperature changes then a standard circuit resistor. The simple first order thermistor relationship between resistance and temperature is:

ΔR = kΔT, where

ΔR is change in resistance (in ohms)

Δ is change in temperature (in kelvin)

k is first-order temperature coefficient (in ohms/kelvin)

In general the first order approximation is only accurate over a limited temperature range. The Steinhart-Hart equation is a widely used third order approximation that improves accuracy to less than 0.02 ^{o}C over a much wider temperature range.

where

T is absolute temperature (in kelvins)

R is the resistance (in ohms)

a, b, and c are coefficients

NTC thermistors can also be characterized with the Β (beta) parameter equation, which is just a specialized case of the Steinhart-Hart equation.

where

T is absolute temperature in kelvins

T_{0} is 298.15 K (25 ^{o}C)

R_{0} is resistance at T_{0}

R is the resistance

Having the B parameter and measuring the thermistor resistance, the temperature can be determined. But most embedded systems don’t measure the resistance directly. So the question is how do we measure the thermistor resistance. The answer is to use a voltage divider. Measuring the voltage divider voltage, which is common using analog to digital converters, gives us a way to get the thermistor resistance.

Remember that a voltage divider is two series resistors in this case connecting power and ground. The voltage between the two resistors is given by:

V_{OUT} = V_{IN} x (R1 / (R1 + R2))

R2 = R1 x (V_{IN}/V_{OUT} – 1), where

R2 = unknown thermistor resistance (in ohms)

R1 = known resistance (in ohms)

V_{IN} = known input voltage (in V)

V_{OUT} = measured voltage between resistors (in V)

Generally NTC thermistors have a nominal resistance at 25^{o}C. Most common is either 10K or 100K ohms. When picking the known resistor R1, the value should match the nominal thermistor resistance, e.g. for a 100K thermistor, R1 should be 100K.

Using an embedded controller like an Arduino UNO or Nano, the code is very simple to convert the sensed input voltage to the thermistor resistance, to a temperature as shown in following code segment.

```
// in setup, one time calculation
Rinf = NTCRESISTOR * exp(-1*BETA/298.15);
// in Arduino loop
tempIn = analogRead(TEMPPIN); // 0 to 1023 values
// find thermistor R
// SERIESRESISTOR = R1, 1023.0 = VIN, tempIn = VOUT
Rth = SERIESRESISTOR * ((1023.0/tempIn) - 1);
// calculate temp in K and convert to C
tempC = BETA/(log(Rth/Rinf)) - 273.15;
```

One final item to consider with a voltage divider is the input impedance of the measuring device. To limit the impact of input impedance on circuit performance, generally you want the input impedance to be at least 10 times the value of R1 in the circuit above. The input impedance is in parallel with R1 so if the input impedance is only 100K, then the effective value of R1 in our circuit is only 50K, which greatly affects the measurement and calculations.

One way to solve this problem is to use a voltage follower op amp circuit. This circuit provides unity gain (voltage divider Vout equal op amp Vout), has a low output impedance, and very large input impedance. It is important to select an op amp that has stable unity gain.