MAX31865是一款易于使用的电阻-数字转换器,针对铂电阻温度检测器(RTD)进行了优化。外部电阻器设置所用RTD的灵敏度,精密Δ-∑ADC将RTD电阻与参考电阻的比率转换为数字形式。MAX31865的输入受到保护,不会出现Q45V的过电压故障。包括RTD和电缆开路和短路条件的可编程检测。
使用Adafruit_MAX31865库
/*************************************************** This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865Designed specifically to work with the Adafruit RTD Sensor----> https://www.adafruit.com/products/3328This sensor uses SPI to communicate, 4 pins are required to interfaceAdafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, all text above must be included in any redistribution****************************************************/#include // Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 max = Adafruit_MAX31865(10, 11, 12, 13);
// use hardware SPI, just pass in the CS pin
//Adafruit_MAX31865 max = Adafruit_MAX31865(10);// The value of the Rref resistor. Use 430.0!
#define RREF 430.0void setup() {Serial.begin(115200);Serial.println("Adafruit MAX31865 PT100 Sensor Test!");max.begin(MAX31865_3WIRE); // set to 2WIRE or 4WIRE as necessary
}void loop() {uint16_t rtd = max.readRTD();Serial.print("RTD value: "); Serial.println(rtd);float ratio = rtd;ratio /= 32768;Serial.print("Ratio = "); Serial.println(ratio,8);Serial.print("Resistance = "); Serial.println(RREF*ratio,8);Serial.print("Temperature = "); Serial.println(max.temperature(100, RREF));// Check and print any faultsuint8_t fault = max.readFault();if (fault) {Serial.print("Fault 0x"); Serial.println(fault, HEX);if (fault & MAX31865_FAULT_HIGHTHRESH) {Serial.println("RTD High Threshold"); }if (fault & MAX31865_FAULT_LOWTHRESH) {Serial.println("RTD Low Threshold"); }if (fault & MAX31865_FAULT_REFINLOW) {Serial.println("REFIN- > 0.85 x Bias"); }if (fault & MAX31865_FAULT_REFINHIGH) {Serial.println("REFIN- < 0.85 x Bias - FORCE- open"); }if (fault & MAX31865_FAULT_RTDINLOW) {Serial.println("RTDIN- < 0.85 x Bias - FORCE- open"); }if (fault & MAX31865_FAULT_OVUV) {Serial.println("Under/Over voltage"); }max.clearFault();}Serial.println();delay(1000);
}
MAX31865模块当使用三线制时,必须要进行一下硬件跳线的配置,否则会出现采样数据错误的问题。
1、当仅仅焊接2/3 Wire线时,采样的数据会偏高,导线较长时,会出现温度较高的问题。
2、当焊接2/3 Wire,并连接右侧跳线时,会出现采样值为0,报警短路的情况
当使用三线制时,需要按以下方式进行配置:
1、首先将左侧2/3 Wire跳线焊接上
2、三段选择的位置24部分的连接线分开,焊接中间引脚和3的位置
处理后:
正常配置后,可以得到正常的采样值:
在手册中,可以看到,FORCE2引脚在2/4线模式下,是需要接地的,而在三线制模式下,是需要接到PT100的一个正极的。所以必须将PT100的负极两根线短接外,还需要配置FORCE2脚的模式