How to compute thermistor resistance in Python using UliEngineering

You can easily compute the resistance of a thermistor at a given temperature using the UliEngineering Python library:

thermistor_resistance.py
from UliEngineering.Electronics.Thermistors import thermistor_resistance
from UliEngineering.EngineerIO import *

# Compute resistance at 50°C (10kΩ at 25°C reference, B=3950)
resistance = thermistor_resistance("10k", 25.0, 50.0, 3950)
print(f"Resistance at 50°C: {format_value(resistance, 'Ω')}")

# Compute resistance at 0°C (10kΩ at 25°C reference, B=3950)
resistance = thermistor_resistance("10k", 25.0, 0.0, 3950)
print(f"Resistance at 0°C: {format_value(resistance, 'Ω')}")

Example output

thermistor_resistance_output.txt
Resistance at 50°C: 3.60 kΩ
Resistance at 0°C: 32.6 kΩ

This calculation determines the expected resistance of an NTC thermistor at a specific temperature. This is essential for sensor calibration, circuit design, and predicting thermistor behavior in temperature sensing applications. The calculation uses the B parameter model which provides good accuracy over a limited temperature range.

The resistance is computed using the formula: $R = R_0 \cdot e^{B(\frac{1}{T} - \frac{1}{T_0})}$, where $R$ is the resistance at temperature $T$ in Kelvin, $R_0$ is the reference resistance at reference temperature $T_0$ in Kelvin, and $B$ is the B value in Kelvin. For NTC thermistors, resistance decreases as temperature increases.


Check out similar posts by category: Electronics, Python