adafruit_max31865
CircuitPython module for the MAX31865 platinum RTD temperature sensor. See examples/simpletest.py for an example of the usage.
Author(s): Tony DiCola
Implementation Notes
Hardware:
Adafruit Universal Thermocouple Amplifier MAX31856 Breakout (Product ID: 3263)
Adafruit PT100 RTD Temperature Sensor Amplifier - MAX31865 (Product ID: 3328)
Adafruit PT1000 RTD Temperature Sensor Amplifier - MAX31865 (Product ID: 3648)
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- 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.
- Parameters:
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 sensorimport board from digitalio import DigitalInOut, Direction import adafruit_max31865
Once this is done you can define your
board.SPI
object and define your sensor objectspi = 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
attributetemperature = 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).
- 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:HIGHTHRESH
LOWTHRESH
REFINLOW
REFINHIGH
RTDINLOW
OVUV
- read_rtd()[source]
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.