Arduino ESP8266读取MAX31855热电偶温度不准确的问题
读取到的室温为40摄氏度,冷端却只有3摄氏度。(温度计测出实际室温为20摄氏度左右)
目前已经换过Arduino Nano进行测试,也换过其他MAX31855模块,测试的结果不变。
下面是我用的代码,采用的是Adafruit_MAX31855库的官方示例代码。
```c
#include "Adafruit_MAX31855.h"
#define MAXDO 4
#define MAXCS 0
#define MAXCLK 2
// initialize the Thermocouple
Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);
void setup() {
Serial.begin(9600);
while (!Serial) delay(1); // wait for Serial on Leonardo/Zero, etc
Serial.println("MAX31855 test");
// wait for MAX chip to stabilize
delay(500);
Serial.print("Initializing sensor...");
if (!thermocouple.begin()) {
Serial.println("ERROR.");
while (1) delay(10);
}
Serial.println("DONE.");
}
void loop() {
// basic readout test, just print the current temp
Serial.print("Internal Temp = ");
Serial.println(thermocouple.readInternal());
double c = thermocouple.readCelsius();
if (isnan(c)) {
Serial.println("Thermocouple fault(s) detected!");
uint8_t e = thermocouple.readError();
if (e & MAX31855_FAULT_OPEN) Serial.println("FAULT: Thermocouple is open - no connections.");
if (e & MAX31855_FAULT_SHORT_GND) Serial.println("FAULT: Thermocouple is short-circuited to GND.");
if (e & MAX31855_FAULT_SHORT_VCC) Serial.println("FAULT: Thermocouple is short-circuited to VCC.");
} else {
Serial.print("C = ");
Serial.println(c);
}
delay(1000);
}
```