How to compute thermistor temperature in Python using UliEngineering
You can easily compute the temperature from a thermistor’s resistance using the UliEngineering Python library:
from UliEngineering.Electronics.Thermistors import thermistor_temperature
# Compute temperature from resistance (10kΩ at 25°C reference, B=3950)
temp = thermistor_temperature("10k", "10k", 25.0, 3950)
print(f"Temperature (10kΩ, 10k@25°C, B=3950): {temp:.2f} °C")
# Compute temperature from resistance (1kΩ at 25°C reference, B=3950)
temp = thermistor_temperature("1k", "10k", 25.0, 3950)
print(f"Temperature (1kΩ, 10k@25°C, B=3950): {temp:.2f} °C")Example output
Temperature (10kΩ, 10k@25°C, B=3950): 25.00 °C
Temperature (1kΩ, 10k@25°C, B=3950): 84.97 °CThis calculation determines the temperature of an NTC thermistor based on its measured resistance. This is essential for temperature sensing applications, thermal monitoring systems, and any application where temperature needs to be derived from resistance measurements. The calculation uses the B parameter model which provides good accuracy over a limited temperature range.
The temperature is computed using the formula: $T = \frac{1}{\frac{1}{T_0} + \frac{1}{B} \ln(\frac{R}{R_0})}$, where $T$ is the temperature in Kelvin, $R$ is the measured resistance, $R_0$ is the reference resistance at reference temperature $T_0$, and $B$ is the B value in Kelvin. The result is then converted from Kelvin to Celsius.
Related posts
- How to compute thermistor B value in Python using UliEngineering
- How to compute thermistor resistance in Python using UliEngineering
- How to compute power factor by phase angle in Python using UliEngineering