Learn

Read a K-type thermocouple with an Arduino and a MAX6675

Beginner

Or see every lesson.

  • 455parts on the bench
  • 43boards running now
  • 1.00xreal time, on every board
Arduino Uno: MAX6675 thermocouplelive0.000 s 0.00x
Click to open it in the editor
A K-type thermocouple on a MAX6675, read by a simulated ATmega328P. Drag the temperature slider on the board.

A thermocouple is the temperature probe for hot things: ovens, kilns, soldering irons, smokers and 3D printer hot ends. A K-type one reads up to about 1000 °C, where a TMP36 or a DHT22 would melt. The catch is that its signal is tiny, a few microvolts per degree, so it needs a chip like the MAX6675 to read it.

The circuit above is an Arduino Uno with a MAX6675 board and a K-type probe. Drag the temperature slider and the serial monitor prints the reading in °C and °F twice a second. It runs in your browser on the sketch below, which uses the calls from Adafruit’s max6675 library.

What you need

  • An Arduino Uno
  • A MAX6675 board with its K-type thermocouple
  • Five jumper wires

Wiring

Part and pinGoes toNote
MAX6675 SOPin 4Data from the chip to the Uno
MAX6675 CSPin 5Chip select
MAX6675 SCKPin 6Clock
MAX6675 VCC5 V
MAX6675 GNDGND
Thermocouple + and -The screw terminalsRed to -, yellow to + on most K-type probes

Why a thermocouple needs its own chip

A thermocouple is two different metals joined at the tip. Heat the tip and the junction makes a small voltage, about 41 microvolts per degree for a K-type. One step of the Uno’s ADC is about 4,900 microvolts, so the Uno alone cannot see a change of a hundred degrees.

The MAX6675 amplifies that voltage, measures the temperature of its own terminals to correct for them, and turns the result into a 12-bit number at a quarter of a degree a step. It sends it as 16 bits over three wires when you pull CS low.

The sketch, step by step

The line MAX6675 thermocouple(SCK_PIN, CS_PIN, SO_PIN) names the three pins. Any three digital pins work, because the library clocks the bits out itself. setup() waits half a second so the chip can finish its first reading.

loop() calls readCelsius() every 500 milliseconds. At the starting 25 °C it prints "C = 25.00 F = 77.00". Drag the slider to 250 °C and it prints "C = 250.00 F = 482.00". The sketch prints the numbers as whole hundredths to keep the float printing code out of the Uno’s memory.

The loop, from the thermocouple example
#include <max6675.h>

const int SCK_PIN = 6;
const int CS_PIN = 5;
const int SO_PIN = 4;

MAX6675 thermocouple(SCK_PIN, CS_PIN, SO_PIN);

void loop() {
  float celsius = thermocouple.readCelsius();
  if (isnan(celsius)) {
    Serial.println("No thermocouple");
  } else {
    Serial.print("C = ");
    printHundredths((long)(celsius * 100));
    Serial.print("  F = ");
    printHundredths((long)(celsius * 180) + 3200);
    Serial.println();
  }
  delay(500);
}

Wait between reads

The MAX6675 starts a new measurement each time CS goes high, and one takes up to 0.22 seconds. Read it again before that and you get the last number back. So a sketch that reads in a tight loop sees a value that never seems to change. Read no faster than about four times a second; this sketch reads twice a second.

Two wiring habits matter on a real build. Only the probe goes into the heat: keep the MAX6675 board itself near room temperature, because it measures its own terminals to correct the reading. And if the probe’s leads are too short, extend them with K-type thermocouple wire, not ordinary copper wire, or every joint adds an error of its own.

Try it in the editor

Open the board’s properties and untick probe. That is a thermocouple with a broken or loose wire, and readCelsius() returns NAN, so the serial monitor says "No thermocouple". Tick it again and the readings return.

Add a relay on pin 7 and switch it off above a set temperature, and you have the start of an oven or a kiln controller. The 3D printer firmware guide on this site goes further, with PID control and thermal runaway protection.

Common mistakes

Wiring SO to the Uno’s MOSI. SO is the chip’s output, so it goes to an input pin, here pin 4.

Reading too fast. The value only changes every 0.22 seconds.

Expecting temperatures below freezing. The MAX6675 reads 0 °C and up only. In Mokxi, set the slider below zero and it reads 0.00. For cold temperatures, use a MAX31855, which is also on the bench.

The probe wires swapped. A reversed K-type probe reads the wrong way as it heats. Swap the two wires at the terminals.

Questions

How do I connect a MAX6675 to an Arduino?

SO to pin 4, CS to pin 5, SCK to pin 6, VCC to 5 V and GND to GND, then MAX6675 thermocouple(6, 5, 4) and readCelsius(). Any three digital pins work if you change the numbers to match.

Why does my MAX6675 read NAN?

The chip sees no thermocouple: a loose screw terminal, a broken probe, or the probe not connected. You can see the same thing here by unticking the board’s probe property.

How accurate is the MAX6675?

The datasheet gives about plus or minus 2 °C, with a resolution of 0.25 °C. Mokxi does not model that error: the reading is exactly the slider’s value, rounded to a quarter of a degree.

MAX6675 or MAX31855?

The MAX31855 reads below zero and has a finer 14-bit result; the MAX6675 is cheaper and enough for ovens and kilns. Both have models on the Mokxi bench.

Build this for real

Open the editor, change a value and watch the number move with it. Nothing to install, and no account needed.