I am trying to measure the temperature and for the same, I am using Arduino UNO, K-type thermocouple, and MAX31856.
I am using MAX31856 library code:
#include <SPI.h>
#include <Adafruit_MAX31856.h>
// Create the MAX31856 thermocouple object with the defined pins
Adafruit_MAX31856 max = Adafruit_MAX31856(10, 11, 12, 13); // CS, SDI, SDO, SCK
void setup() {
Serial.begin(115200);
while (!Serial) delay(10); // wait for serial port to open
// Initialize the MAX31856 sensor
if (!max.begin()) {
Serial.println("Could not initialize MAX31856. Check your wiring!");
while (1);
}
// Set thermocouple type
max.setThermocoupleType(MAX31856_TCTYPE_K);
// Print the thermocouple type
Serial.print("Thermocouple type: ");
switch (max.getThermocoupleType()) {
case MAX31856_TCTYPE_B: Serial.println("B Type"); break;
case MAX31856_TCTYPE_E: Serial.println("E Type"); break;
case MAX31856_TCTYPE_J: Serial.println("J Type"); break;
case MAX31856_TCTYPE_K: Serial.println("K Type"); break;
case MAX31856_TCTYPE_N: Serial.println("N Type"); break;
case MAX31856_TCTYPE_R: Serial.println("R Type"); break;
case MAX31856_TCTYPE_S: Serial.println("S Type"); break;
case MAX31856_TCTYPE_T: Serial.println("T Type"); break;
case MAX31856_VMODE_G8: Serial.println("Voltage x8 gain mode"); break;
case MAX31856_VMODE_G32: Serial.println("Voltage x32 gain mode"); break;
default: Serial.println("Unknown"); break;
}
}
void loop() {
// Read and print the temperature
// Serial.print("Cold Junction Temperature: ");
// Serial.print(max.readCJTemperature());
// Serial.println(" °C");
//Serial.print("Thermocouple Temperature: ");
Serial.print(max.readThermocoupleTemperature());
Serial.println(" °C");
delay(1000);
}
But the output is showing 30.37, 30.74 etc, even after changing the temperature the output value is not being changed.