-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInverse_Problem_Main.ino
More file actions
73 lines (60 loc) · 1.83 KB
/
Inverse_Problem_Main.ino
File metadata and controls
73 lines (60 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <Adafruit_MAX31865.h>
// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 thermo = Adafruit_MAX31865(10, 11, 12, 13);
// The value of the Rref resistor.
#define RREF 4300.0
// The 'nominal' 0-degrees-C resistance of the sensor
#define RNOMINAL 1000.0
unsigned long CurrentTime;
unsigned long StartTime;
bool start_clock;
void setup() {
// Define the baud rate(UART)
Serial.begin(115200);
// Initialize 3 wire interfacing RTD sensor
thermo.begin(MAX31865_3WIRE);
start_clock = true;
Serial.println("Time [ms] \t Temp [C]");
}
void loop() {
uint16_t rtd = thermo.readRTD();
// Serial.print("RTD value: "); Serial.println(rtd);
float ratio = rtd;
ratio /= 32768;
if(start_clock)
{
StartTime = millis();
CurrentTime = StartTime;
start_clock = false;
}
else CurrentTime = millis();
Serial.print(CurrentTime - StartTime);
Serial.print("\t");
Serial.print(thermo.temperature(RNOMINAL, RREF));
Serial.print("\n");
// Check and print any faults
uint8_t fault = thermo.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");
}
thermo.clearFault();
}
for(int i = 0; i < 10; i++) delay(1000);
}