MAX6675 thermocouple converter

The MAX6675 board reads a K-type thermocouple up to 1023 degrees C and sends it over a read-only SPI line, a quarter degree a count.

Aliases: MAX6675 module, K-type thermocouple amplifier, thermocouple sensor. It is the sensor of kiln, smoker and 3D printer builds: a thermocouple makes a few microvolts a degree, far too little for a board's ADC, and the MAX6675 measures it, corrects for the temperature of its own terminals and hands back a number.

Pins

Pin What it does
GND, VCC Supply, 3.0 to 5.5 V.
SCK The clock, from the board.
CS Low to read. Its rising edge starts the next conversion.
SO The data out, high-Z while CS is high.

Reading it on an Arduino

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

#include <max6675.h>
MAX6675 thermocouple(6, 5, 4);   // SCK, CS, SO

void setup() {
  Serial.begin(9600);
  delay(500);
}

void loop() {
  Serial.println(thermocouple.readCelsius());
  delay(250);
}

readCelsius() returns NAN when no thermocouple is on the terminals.

While it runs

Drag the slider to set the temperature at the probe's tip, 0 to 1000 degrees C. The probe property, when cleared, takes the thermocouple off the terminals.

What the model gets right

From the MAX6675 datasheet: CS low puts bit 15 on SO and each falling edge of SCK the next bit, sixteen in all; the temperature in bits 14 to 3 at 0.25 degrees a count; bit 2 set for an open thermocouple; SO high-Z while deselected. A conversion takes 0.22 s after CS rises, and a read before it finishes returns the last result, so reading faster than about four times a second repeats the same number.

What it does not model

The thermocouple's own voltage and the chip's accuracy (plus or minus 2 degrees), temperatures below 0 (the chip reads 0), and the 4.3 MHz clock limit.

Common mistakes

Reading it in a tight loop: the value only changes every 0.22 s. Wiring SO to the board's MOSI: it is the chip's output, so it goes to MISO or any input pin.

See it in action

Thermocouple prints the temperature twice a second. Open it at /templates.