CircuitPython module for the MAX31865 platinum RTD temperature sensor. See examples/ for an example of the usage.

  • Author(s): Tony DiCola

Implementation Notes


Software and Dependencies:

class adafruit_max31865.MAX31865(spi, cs, *, polarity=0, rtd_nominal=100, ref_resistor=430.0, wires=2, filter_frequency=60)[source]

Driver for the MAX31865 thermocouple amplifier.

  • spi (SPI) – SPI device

  • cs (DigitalInOut) – Chip Select

  • rtd_nominal (int) – RTD nominal value. Defaults to 100

  • ref_resistor (int) – Reference resistance. Defaults to 430.0

  • wires (int) – Number of wires. Defaults to 2

  • filter_frequency (int) – . Filter frequency. Default to 60

  • polarity (int) – set to 1 if controller clock idles high. Default 0.

Quickstart: Importing and using the MAX31865

Here is an example of using the MAX31865 class. First you will need to import the libraries to use the sensor

import board
from digitalio import DigitalInOut, Direction
import adafruit_max31865

Once this is done you can define your board.SPI object and define your sensor object

spi = board.SPI()
cs = digitalio.DigitalInOut(board.D5)  # Chip select of the MAX31865 board.
sensor = adafruit_max31865.MAX31865(spi, cs)

Now you have access to the temperature attribute

temperature = sensor.temperature
property auto_convert

The state of the sensor’s automatic conversion mode (True/False).

property bias

The state of the sensor’s bias (True/False).


Clear any fault state previously detected by the sensor.

property fault

The fault state of the sensor. Use clear_faults() to clear the fault state. Returns a 6-tuple of boolean values which indicate if any faults are present:






  • OVUV


Perform a raw reading of the thermocouple and return its 15-bit value. You’ll need to manually convert this to temperature using the nominal value of the resistance-to-digital conversion and some math. If you just want temperature use the temperature property instead.

property resistance

Read the resistance of the RTD and return its value in Ohms.

property temperature

Read the temperature of the sensor and return its value in degrees Celsius.