Arduino MAX31855 thermocouple

One of the most popular thermocouple amplifier ICs used is the MAX31855, which is a cold compensation thermocouple-to-digital converter. The MAX31855 is capable of accurately measuring temperature from a wide range of thermocouple types, including K, J, N, T, E, S, R, and B.

The MAX31855 communicates with the Arduino over SPI (Serial Peripheral Interface) and provides high-resolution temperature readings with low noise and high accuracy. It has built-in cold-junction compensation, which eliminates the need for additional circuitry to compensate for the reference junction temperature.

The MAX31855 also offers features such as multiple temperature data formats (e.g., Celsius, Fahrenheit, Kelvin), fault detection (e.g., open circuit, short circuit), and a wide operating temperature range. These features make it a popular choice among Arduino users for applications that require precise and reliable temperature measurements using thermocouples. 

In this thermocouple with Arduino tutorial we will explain and show how to use the MAX31855 thermocouple amplifier with Arduino. Following shows the circuit diagram of connecting thermocouple with MAX31855 IC and connecting MAX31855 to Arduino Uno.

Arduino MAX31855 circuit diagram

The following shows the pin-out of the MAX31855 integrated circuit(IC).


 In the circuit diagram, the thermocouple k-type +ve and -ve are connected to the T-(pin 2) and T+(pin 3) of the MAX31855 IC via a header connector J1. The Vcc of MAX31855 is connected to 3.3V supply and is a capacitor of 0.1uF is connected between Vcc and the ground. The SO, CS and SCK which are the SPI pins on MAX31855 are connected to pins 11,12 and 13 of Arduino. The Arduino is programmed to use these pins as SPI(Serial Peripheral Interface) pins. The DNC is no connect pin and so it is not required. Similarly an LCD is connected to Arduino Uno as shown in the circuit diagram.

The following is the Arduino program code to read temperature from MAX31855 and displaying it on LCD and serial monitor. 

#include <SPI.h>
#include <Wire.h>
#include "Adafruit_MAX31855.h"
#include <LiquidCrystal.h>

// Example creating a thermocouple instance with software SPI on any three
// digital IO pins.
#define MAXDO   11
#define MAXCS   12
#define MAXCLK  13

// Initialize the Thermocouple
Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // wait for MAX chip to stabilize

void loop() {
   double c = thermocouple.readCelsius();
   if (isnan(c)){
     lcd.print("T/C Problem");
     lcd.write(0xdf); // to display °
     Serial.print("Temperature.: ");
     Serial.write(0xdf); // to display °

Code Explanation

This Arduino code demonstrates how to use the Adafruit_MAX31855 library to interface with a MAX31855 thermocouple module and display the temperature readings on a 16x2 LCD screen.

The code begins by including the necessary libraries: SPI.h, Wire.h, Adafruit_MAX31855.h, and LiquidCrystal.h. It then defines the pins for the MAX31855 module (MAXDO, MAXCS, and MAXCLK) and creates an instance of the Adafruit_MAX31855 class named "thermocouple" with these pins.

In the setup() function, the code initializes the serial communication at 9600 baud, initializes the LCD with 16 columns and 2 rows, and displays "MAX31855" on the LCD. It also includes a delay of 500 milliseconds to allow the MAX31855 chip to stabilize.

In the loop() function, the code reads the temperature in Celsius from the thermocouple using the thermocouple.readCelsius() method, clears the LCD, and checks if the reading is valid using isnan(c) function. If the reading is valid, it displays "Thermocouple" on the first row of the LCD, and the temperature reading with the degree Celsius symbol on the second row. It also prints the temperature reading to the serial monitor. If the reading is not valid, it displays "T/C Problem" on the LCD.

The loop() function includes a delay of 1000 milliseconds (1 second) before repeating the process, providing a time delay between each temperature reading update.

The following video demonstrates how the Arduino Uno reads the thermocouple temperature using the MAX31855 IC.

References and Further Readings

[1] Arduino PID Controller - Temperature PID Controller

[2] Arduino AD8495 Thermocouple Amplifier 

[3] LM324 Instrumentation Amplifier

[4] LM35 Temperature Sensor with Arduino and LCD

[5] Display Temperature on Web with NodeMCU, LM35 and Node-Red


Previous Post Next Post