Home

Awesome

Micropython Generic Thermistor Library

Micropython Generic Thermistor Library is a basic software module designed to simplify temperature sensing using NTC thermistors within MicroPython-based projects. The library assumes a generic NTC thermistor on the ground side of a voltage divider. It provides functions for converting raw analog sensor readings into temperature values, taking into account the non-linear nature of thermistors using the β parameter equation.

Features

Installation - Hardware

Figure 1 demonstrates the expected wiring scheme. R1 and the thermistor cannot be swapped with this library; the code assumes the thermistor is on the ground side of the voltage divider.

Figure 1 - Wiring Diagram

Notes:

Installation - Software

  1. Have a Micropython environment set up on something; for example, an ESP32
  2. Upload the thermistor.py file onto the Micropython device; upload steps vary based on familiarity with the terminal, OS, and/or IDE. You can create a new file named thermistor.py on the embedded device and copy-paste the code into the file.
  3. Configure the object constructor "Thermistor" with your values. The below example uses pin 4 on an ESP32 with a 10k ohm NTC, beta=3435, thermistor, and 10k ohm voltage divider. Make sure you use your own values here!
therm = Thermistor(ADC(4, atten=ADC.ATTN_11DB), beta=3435, therm_ohm=10_000, divider_ohm=10_000)
  1. See the example main.py file

Warnings