Datasheet
CircuitPython Installation of MAX31865 Library
Next you'll need to install the Adafruit CircuitPython MAX31865 (https://adafru.it/Cbp) library on your CircuitPython
board.
First make sure you are running the latest version of Adafruit CircuitPython (https://adafru.it/tBa) for your board.
Next you'll need to install the necessary libraries to use the hardware--carefully follow the steps to find and install these
libraries from Adafruit's CircuitPython library bundle (https://adafru.it/zdx). For example the Circuit Playground Express
guide has a great page on how to install the library bundle (https://adafru.it/Bf2) for both express and non-express
boards.
Remember for non-express boards like the Trinket M0, Gemma M0, and Feather/Metro M0 basic you'll need to
manually install the necessary libraries from the bundle:
adafruit_max31865.mpy
adafruit_bus_device
Before continuing make sure your board's lib folder or root filesystem has
the adafruit_max31865.mpy, and adafruit_bus_device files and folders copied over.
Next connect to the board's serial REPL (https://adafru.it/Awz) so you are at the CircuitPython >>> prompt.
Python Installation of MAX31865 Library
You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This may also
require enabling I2C on your platform and verifying you are running Python 3. Since each platform is a little different,
and Linux changes often, please visit the CircuitPython on Linux guide to get your computer
ready (https://adafru.it/BSN)!
Once that's done, from your command line run the following command:
sudo pip3 install adafruit-circuitpython-max31865
If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use
CircuitPython on Python 2.x, it isn't supported!
CircuitPython & Python Usage
To demonstrate the usage of the sensor we'll initialize it and read the range and more from the board's Python REPL.
Run the following code to import the necessary modules and initialize the SPI connection with the sensor:
Notice you need to explicitly define the chip select digital I/O pin--be sure to use the same pin as your wiring (D5 if
import board
import busio
import digitalio
import adafruit_max31865
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)
© Adafruit Industries https://learn.adafruit.com/adafruit-max31865-rtd-pt100-amplifier Page 26 of 31










