To get started with the MAX31865 driver on a MicroPython system, follow these simple steps.
- Download the
max31865.py
file from the repository. - Copy the
max31865.py
file to your MicroPython device. You can use tools likeampy
or a file transfer method suitable for your device.
- Connect the MAX31865 thermocouple amplifier to your Raspberry Pi Pico or any other MicroPython-supported board.
- Include the
max31865.py
module in your MicroPython script together with themachine
module for configuring the SPI bus and chip select pin:
import machine
from max31865 import MAX31865
- Configure the SPI bus and chip select pin:
# Define SPI bus and chip select pin
spi = machine.SPI(0, baudrate=5000000, phase=1, sck=machine.Pin(2), mosi=machine.Pin(3), miso=machine.Pin(4))
cs = machine.Pin(machine.Pin.board.GP5)
- Create an instance of the
MAX31865
class:
sensor = MAX31865(spi, cs)
- The current temperature can by retrieved by accessing the
temperature
attribute of the sensor instance:
temperature = sensor.temperature
print(f"Current Temperature: {temperature} °C")
Distributed under the MIT License. See LICENSE.txt
for more information.