Temperature, humidity and air

MAX31855 thermocouple with ESP32

A thermocouple measures where other sensors melt, such as in ovens, kilns and exhausts. The MAX31855 amplifier handles the difficult part: a K-type thermocouple gives only about 50 µV per °C, and it needs cold-junction compensation. The chip does both and returns a ready temperature over a read-only SPI link.

Thermocouple range depends on the probe, not just the chip. The common glass-braid K-type probe is rated from -100 to 500 °C, with ±2 °C precision. Above that, the insulation is what fails. Only three signal wires are used: clock, chip select and data out. Thermocouple wires have polarity, and swapped wires give readings that move the wrong way.

Wiring mistakes show up as fault codes. The chip reports an open circuit, or a short to ground or VCC. A probe with a metal tip that touches a grounded machine can trigger a short fault or give noisy results, so an isolated probe is the usual choice there. Keep the amplifier away from hot air, because its own temperature is the reference. Use real thermocouple extension wire for longer runs.

MAX31855 thermocouple wiring diagram for ESP32
Wiring diagram drawn by LCD Ultra Pro.

Specifications

Probe typeK-type
Typical glass-braid probe-100 to 500 °C, ±2 °C
Probe outputAbout 50 µV/°C
InterfaceRead-only SPI: CLK, CS, DO
Faults reportedOpen circuit, short to GND, short to VCC

Power and logic levels

3.3 V: safe to connect directly

SupplyChip 3–3.6 V, some modules have a regulator
Signal level3.3 V
On an ESP32Run it from 3V3.

ESP32 pins, including those on a display board's connectors, work at 3.3 V and are not 5 V tolerant. Modules differ, so if in doubt, measure the signal before you connect it.

Wiring

MAX31855 thermocoupleConnect toNote
VIN3V3
GNDGND
CLKGPIO 12
CSGPIO 10
DOGPIO 13

Arduino code

#include <Adafruit_MAX31855.h>

const int CLK_PIN = 12, CS_PIN = 10, DO_PIN = 13;
Adafruit_MAX31855 tc(CLK_PIN, CS_PIN, DO_PIN);

void setup() {
  Serial.begin(115200);
  tc.begin();
}

void loop() {
  double c = tc.readCelsius();
  if (isnan(c)) Serial.printf("Fault code %d\n", tc.readError());
  else Serial.printf("%.2f C (chip %.2f C)\n", c, tc.readInternal());
  delay(1000);
}

Needs the Adafruit MAX31855 library. Compiled for ESP32-S3 with arduino-esp32 3.x. Not yet tested by us on a physical sensor. Change the pins to match your board.

On a display

Read the value in your sketch and pass it to a label, or send it over MQTT and show it with an MQTT value in the editor.

Design a display for MAX31855 thermocouple

Good to know

  • Wires have polarity. Swap them if readings move the wrong way.
  • Grounded metal probes can cause faults. Use an isolated probe.
  • The probe's insulation limits the range.
  • Keep the amplifier away from heat.

What it is good for

  • Ovens and kilns
  • Exhaust and boiler temperature
  • Reflow and coffee roasting

FAQ

Why does my thermocouple read NaN?

The chip reports a fault: open circuit or a short. Check the probe and wiring.

Why does the reading fall when it gets hotter?

The thermocouple wires are swapped.

Why is it noisy on my machine?

A grounded probe can cause this. Try an isolated probe.

Sources

Related parts

Use this information at your own risk. It is for general guidance only: the example code compiles, but it has not been tested on every part, and modules differ between sellers. Check the manufacturer's data before you build. Product names belong to their owners, and LCD Ultra Pro is not affiliated with them. See our Terms.