adafruit_thermistor

A thermistor is a resistor that varies with temperature. This driver takes the parameters of that resistor and its series resistor to determine the current temperature. To hook one up, connect an analog input pin to the connection between the resistor and the thermistor. Be careful to note if the thermistor is connected on the high side (from analog input up to high logic level/3.3 or 5 volts) or low side (from analog input down to ground). The initializer takes an optional high_side boolean that defaults to True and indicates if that the thermistor is connected on the high side vs. low side.

  • Author(s): Scott Shawcroft

Implementation Notes

Hardware:

Software and Dependencies:

Notes:

  1. Check the datasheet of your thermistor for the values.
class adafruit_thermistor.Thermistor(pin, series_resistor, nominal_resistance, nominal_temperature, b_coefficient, *, high_side=True)[source]
Parameters:
  • pin (Pin) – Analog pin used for the thermistor
  • series_resistor (int) – resistance in series between you analog input and the thermistor, normally a 10K resistor is placed between VCC and the analog pin
  • nominal_resistance (int) – nominal resistance of the thermistor. normally 10k
  • b_coefficient (int) – thermistor’s B coefficient. Typically this is a value in the range of 3000-4000
  • high_side (bool) – indicates if the thermistor is connected on the high side or low side of the resistor. Defaults to True

Quickstart: Importing and using the adafruit_thermistor library

Here is one way of importing the Thermistor class so you can use it with the name thermistor. First you will need to import the libraries to use the sensor

import board
import adafruit_thermistor

Once this is done you can define your Thermistor object and define your sensor object

thermistor = adafruit_thermistor.Thermistor(board.A0, 10000, 10000, 25, 3950)

Now you have access to the temperature with the temperature attribute. This temperature is in Celsius.

temperature = thermistor.temperature
temperature

The temperature of the thermistor in Celsius