PT100是指温度为0时电阻值为100的高精度温度传感器, 它的电阻变化很小,因此需要做一个外接增益板才能读取数据,max31865就是集成了增益的芯片,将数据直接转化为SPI信号传输到板子上,本次采用了esp32进行读取数据
本次采用的是三线PT100,其接法如下图片是官方的,如果你是两蓝一红的线,就按照这个图片反着接就好了,两颗蓝线接RTD+,红线接RTD-.然后记得按照图片上的把触点焊起来。
然后关键的来了,如果你没有刮掉24连接,上电测量会发现PT100的比正常值电阻少一半!!没上电测量为112,上电测量发现只有60多了,这是因为24之间有连接地,然后还有一个并联电阻就会出现电阻变小的情况。具体如下图原理图及其PCB
原理图是我参照官方的画的没画触点,直接接三线的,PCB是管方的,通过PCB将以下位置用小刀刮断
将蓝色标记处刮断,具体如下这样才能正常使用
esp32代码如下
/***************************************************
This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865
Designed specifically to work with the Adafruit RTD Sensor
----> https://www.adafruit.com/products/3328
This sensor uses SPI to communicate, 4 pins are required to
interface
Adafruit 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 <Adafruit_MAX31865.h>
// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 max = Adafruit_MAX31865(15, 23, 19, 18);
// 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.0
void 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 faults
uint8_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);
}
我接的CS是15 ,MOSI是23,MISO接19,SCLK接18,最后就可以成功读取了,库的话再这个github地址GitHub - adafruit/Adafruit_MAX31865: Arduino Library for Adafruit MAX31865 RTD Sensor