Introduction

Documentation Status Discord Build Status

CircuitPython module for the MAX31865 thermocouple amplifier.

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-max31865

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-max31865

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install adafruit-circuitpython-max31865

Usage Example

See examples/max31865_simpletest.py for a demo of the usage.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Documentation

For information on building library documentation, please check out this guide.

Table of Contents

Simple test

Ensure your device works with this simple test.

examples/max31865_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

# Simple demo of the MAX31865 thermocouple amplifier.
# Will print the temperature every second.
import time

import board
import busio
import digitalio

import adafruit_max31865


# Initialize SPI bus and sensor.
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
cs = digitalio.DigitalInOut(board.D5)  # Chip select of the MAX31865 board.
sensor = adafruit_max31865.MAX31865(spi, cs)
# Note you can optionally provide the thermocouple RTD nominal, the reference
# resistance, and the number of wires for the sensor (2 the default, 3, or 4)
# with keyword args:
# sensor = adafruit_max31865.MAX31865(spi, cs, rtd_nominal=100, ref_resistor=430.0, wires=2)

# Main loop to print the temperature every second.
while True:
    # Read temperature.
    temp = sensor.temperature
    # Print the value.
    print("Temperature: {0:0.3f}C".format(temp))
    # Delay for a second.
    time.sleep(1.0)

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:

Software and Dependencies:

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

Driver for the MAX31865 thermocouple amplifier.

auto_convert

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

bias

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

clear_faults()[source]

Clear any fault state previously detected by the sensor.

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.

resistance

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

temperature

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

Indices and tables