You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Adafruit MAX31865 library with the busio.SPI interface on a Raspberry Pi 5, I am receiving inconsistent and erratic temperature and resistance readings from the RTD sensor. The temperatures alternate between extremely high (988.79°C), extremely low (-242.02°C), and correct values (~19°C). Additionally, the resistance readings sometimes show 0 ohms, suggesting an issue in communication or measurement handling.
Hardware Setup:
Board: Raspberry Pi 5
SPI Communication: Using busio.SPI (with manual Chip Select handling via gpiod)
RTD Sensor: 100-ohm PT100 3-wire RTD
Adafruit MAX31865 Library
Adafruit Blinka
Issue Details:
Erratic Temperature Readings: Temperature readings fluctuate between valid values (~19°C) and extreme values such as -242.02°C and 988.79°C. The extreme values appear in a pattern, and the valid readings are rare.
Zero Resistance Readings: At times, the raw resistance returned by the MAX31865 library is 0 ohms, which is not expected for a PT100 sensor.
Correct Readings Are Sporadic: Occasionally, the sensor returns a correct reading, but this is inconsistent.
Expected Behavior:
The temperature readings should be stable and consistent with the actual environment temperature.
The raw resistance readings from the RTD sensor should be in the expected range (close to 100 ohms at room temperature for a PT100 sensor).
Code Example:
Here is the code I used for interfacing with the MAX31865:
python
import gpiod
import time
import board
import busio
from adafruit_max31865 import MAX31865
chip = gpiod.Chip('gpiochip0') # Use gpiochip0 for GPIO lines
cs_line = chip.get_line(8) # GPIO8 (Pin 24) for Chip Select
cs_line.request(consumer='MAX31865_CS', type=gpiod.LINE_REQ_DIR_OUT, default_vals=[1])
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
while not spi.try_lock():
pass
spi.configure(baudrate=100000, phase=1, polarity=0)
spi.unlock()
def select_chip():
cs_line.set_value(0) # CS low to start communication
def deselect_chip():
cs_line.set_value(1) # CS high to end communication
rtd = MAX31865(spi, cs=None, rtd_nominal=100.0, wires=3)
def read_temperature():
select_chip()
temperature = rtd.temperature
deselect_chip()
return temperature
def read_raw_resistance():
select_chip()
resistance = rtd.resistance
deselect_chip()
return resistance
while True:
temperature = read_temperature()
resistance = read_raw_resistance()
print(f"Temperature: {temperature:.2f} °C, Resistance: {resistance:.2f} ohms")
time.sleep(1)`
Observed Behavior:
Temperature:
988.79 °C
-242.02 °C
Correct value: ~19°C
Resistance:
0.00 ohms (several times)
429.99 ohms (occasional)
Correct value (approx. 100 ohms) observed infrequently
Steps to Reproduce:
Set up the Raspberry Pi with gpiod and busio.SPI.
Connect a PT100 3-wire RTD to the MAX31865 breakout board.
Run the provided code to read temperature and raw resistance values.
Observe erratic readings.
Additional Information:
I suspect there may be issues with how the SPI communication is being handled within the MAX31865 library or potentially timing issues related to busio.SPI.
Lowering the SPI speed (e.g., to 100 kHz) did not resolve the issue.
Request:
Could you please review the SPI and communication handling in the MAX31865 library? There may be issues with handling the RTD sensor correctly under certain conditions, especially when using manual Chip Select control or specific Raspberry Pi models.
Description
No response
Additional information
No response
The text was updated successfully, but these errors were encountered:
Board Name
Raspberry Pi 5
Steps
When using the Adafruit MAX31865 library with the busio.SPI interface on a Raspberry Pi 5, I am receiving inconsistent and erratic temperature and resistance readings from the RTD sensor. The temperatures alternate between extremely high (988.79°C), extremely low (-242.02°C), and correct values (~19°C). Additionally, the resistance readings sometimes show 0 ohms, suggesting an issue in communication or measurement handling.
Hardware Setup:
Board: Raspberry Pi 5
SPI Communication: Using busio.SPI (with manual Chip Select handling via gpiod)
RTD Sensor: 100-ohm PT100 3-wire RTD
Adafruit MAX31865 Library
Adafruit Blinka
Issue Details:
Erratic Temperature Readings: Temperature readings fluctuate between valid values (~19°C) and extreme values such as -242.02°C and 988.79°C. The extreme values appear in a pattern, and the valid readings are rare.
Zero Resistance Readings: At times, the raw resistance returned by the MAX31865 library is 0 ohms, which is not expected for a PT100 sensor.
Correct Readings Are Sporadic: Occasionally, the sensor returns a correct reading, but this is inconsistent.
Expected Behavior:
The temperature readings should be stable and consistent with the actual environment temperature.
The raw resistance readings from the RTD sensor should be in the expected range (close to 100 ohms at room temperature for a PT100 sensor).
Code Example:
Here is the code I used for interfacing with the MAX31865:
python
Observed Behavior:
Temperature:
988.79 °C
-242.02 °C
Correct value: ~19°C
Resistance:
0.00 ohms (several times)
429.99 ohms (occasional)
Correct value (approx. 100 ohms) observed infrequently
Steps to Reproduce:
Set up the Raspberry Pi with gpiod and busio.SPI.
Connect a PT100 3-wire RTD to the MAX31865 breakout board.
Run the provided code to read temperature and raw resistance values.
Observe erratic readings.
Additional Information:
I suspect there may be issues with how the SPI communication is being handled within the MAX31865 library or potentially timing issues related to busio.SPI.
Lowering the SPI speed (e.g., to 100 kHz) did not resolve the issue.
Request:
Could you please review the SPI and communication handling in the MAX31865 library? There may be issues with handling the RTD sensor correctly under certain conditions, especially when using manual Chip Select control or specific Raspberry Pi models.
Description
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: