TDK Electronics · TDK Europe

How to read out and trimm NTC thermistors digitally using Python3

The combination of low power consumption, high sensitivity and signal stability makes NTC thermistors the most popular temperature sensor choice in automotive battery management, motor and climate control as well as factory automation and field instruments. 

In the following application note the basic circuit design considerations will be explained to convert the NTC’s resistance change into a digital temperature readout.

Alternative resistance to temperature calculations will be compared: Exponential curves, lookup tables and Steinhart Hart equation. For all cases Python 3 code is available for download below that can be adapted for other applications and other NTC curves in own projects on platforms like RaspberryPi or microcontrollers using CircuitPython.

The Python class definitions for NTC thermistors enable developers to calculate temperatures from resistance readings and vice versa. Four different classes are available in three independent libraries: 

1.)    NTC.py: A Simple B-Value based calculation and a two-point definition of R/T curves
2.)    NTC_SH.py: The  Steinhart Hart model with three data points 
3.)    NTC_LT.py: a lookup table class using multiple data points

All class definitions include a class function for a single point software trimming of a given NTC. One code example is included that shows, how the csv output from our NTC R/T Calculation 5.0 - Web-based Application can be used to define the classes for a specific NTC. A second code example demonstrates the class usage in a typical circuit with NTC and analog to digital converter. All class definitions include a class function for a single point software trimming of a given NTC.

 Appnote Image

Read detailed information in the Application note and download now

PDF - 952.1 KB Download
 Class Lib image

Download the Python 3 classes tool here

ZIP - 13.8 KB Download