MAX31855 thermocouple converter

The MAX31855K reads a K-type thermocouple from -270 to 1800 degrees C, with its own cold-junction temperature and fault bits, over read-only SPI.

Aliases: MAX31855 module, Adafruit MAX31855, K-type thermocouple amplifier. It is the MAX6675's successor: 32 bits instead of 16, below-zero temperatures, the board's own temperature, and separate faults for an open probe and a probe shorted to either rail.

Pins

Pin What it does
VCC, GND Supply, 3 to 5 V on the board.
DO The data out, high-Z while CS is high.
CS Low to read.
CLK The clock, from the board.

Properties

temperature is the probe tip, ambient the board (the cold junction); the two sliders change them while the circuit runs.

Reading it on an Arduino

With Adafruit's library, which Mokxi ships as Adafruit_MAX31855.h:

#include <Adafruit_MAX31855.h>
Adafruit_MAX31855 thermocouple(5, 4, 3);   // CLK, CS, DO

void setup() {
  Serial.begin(9600);
  thermocouple.begin();
}

void loop() {
  double c = thermocouple.readCelsius();
  if (isnan(c)) Serial.println("Fault");
  else Serial.println(c);
  delay(1000);
}

Rob Tillaart's MAX31855.h reads it too, with read() returning a status.

How it talks

CS low stops the conversion and puts bit 31 on DO; each falling edge of CLK the next, 32 in all. Bits 31 to 18 are the tip in quarter degrees (two's complement), bit 16 a fault, bits 15 to 4 the board in sixteenths of a degree, and bits 2, 1 and 0 a short to VCC, a short to GND and an open probe. With CS high the chip converts continuously, 100 ms a conversion.

What it does not model

The K-type's nonlinearity (the chip assumes a straight line, and so does the model, so the tip reads exactly the slider), and the accuracy figures.

Common mistakes

Reading faster than ten times a second: the value only changes every 100 ms. Wiring DO to the board's MOSI: it is the chip's output.