ESP32 - MAX6675 Thermocouple Module

Most of the temperature sensors we cover in other tutorials - the DS18B20, DHT22, LM35, and the like - top out somewhere around 100-150°C. That is plenty for a room, a fridge, or a garden bed, but it is useless if you need to know how hot a furnace, a soldering iron tip, or the inside of a pizza oven really gets. For jobs like that, hobbyists reach for a thermocouple instead, paired with a small digitizer chip called the MAX6675.

In this tutorial we will hook up an ESP32 to a MAX6675 breakout board and a Type-K thermocouple probe, then read out the temperature on the Serial Monitor in both Celsius and Fahrenheit.

ESP32 MAX6675 thermocouple module

What Exactly Is a Thermocouple?

A thermocouple is simply two different metal wires welded together at one end, forming what's called the hot junction. Once that junction gets hot (or cold), a tiny voltage appears across the wires, and that voltage rises and falls with the temperature. Because it is just two bits of wire rather than a delicate silicon sensor, a thermocouple can survive - and measure - places that would instantly kill a normal sensor. The Type-K version, made from Chromel and Alumel wire, is by far the most common and can handle roughly -328°F to +2300°F.

Introduction to the MAX6675 Module

On its own, the millivolt-level signal from a thermocouple is too small and too messy for a microcontroller to read directly. The MAX6675 module solves that: it is a small breakout board built around the MAX6675 IC, sold together with a Type-K probe already wired to it.

MAX6675 Module Pinout

MAX6675 module pinout
image source: diyables.io

The MAX6675 chip on the breakout continuously samples the probe's signal, cold-junction compensates it internally, and hands the ESP32 a ready-to-use 12-bit temperature reading over a simple 3-wire bus. Its pins are:

  • VCC: power input, 3.0V to 5.5V.
  • GND: ground.
  • SCK: serial clock input, driven by the ESP32.
  • CS: chip select - the ESP32 pulls this low while it is reading a sample.
  • SO: serial data output only (there is no data-in pin; the module never receives commands, it only talks).

A small screw-terminal block on the opposite edge of the board is where the probe plugs in, marked + and -; the probe's red lead goes to + and the blue lead to -.

Rounding out the specs: the breakout itself can digitize temperatures from 0°C up to 1024°C, holds about ±3°C of accuracy, and resolves readings down to roughly 0.25°C - although the bundled probe, described next, is the real limiting factor.

The Bundled Type-K Probe

The probe that ships with the module is a thin stainless-steel-tipped cable, around 18 inches long, and it is only rated from 0°C to 80°C - fine for a cup of coffee or a terrarium, but you'd want a higher-rated probe before pointing this at a kiln. Look for the red (positive) and blue (negative) wires at the end that plugs into the breakout's terminal block.

Wiring Diagram

Power the module from the ESP32: VCC to 5V (3.3V also works) and GND to GND. The remaining three pins - SCK, CS, and SO - each go to any spare GPIO on the ESP32, since the library drives them with simple bit-banging rather than the hardware SPI peripheral. Last, seat the thermocouple probe's red and blue leads into the module's + and - terminals.

ESP32 MAX6675 thermocouple module wiring diagram

This image is created using Fritzing. Click to enlarge image

Wiring table between MAX6675 Module and ESP32

MAX6675 Module ESP32
VCC → 5V
GNDGND
SCK → GPIO19
CS → GPIO18
SO → GPIO5

If you're unfamiliar with how to supply power to the ESP32 and other components, you can find guidance in the following tutorial: The best way to Power ESP32 and sensors/displays.

ESP32 Code

/* * This ESP32 code is created by esp32io.com * * This ESP32 code is released in the public domain * * For more detail (instruction and wiring diagram), visit https://esp32io.com/tutorials/esp32-max6675-thermocouple-module */ #include "max6675.h" const int SCK_PIN = 19; // ESP32's pin GPIO19 connected to SCK pin of the MAX6675 module const int CS_PIN = 18; // ESP32's pin GPIO18 connected to CS pin of the MAX6675 module const int SO_PIN = 5; // ESP32's pin GPIO5 connected to SO pin of the MAX6675 module // create a MAX6675 thermocouple object using the pins above MAX6675 thermocouple(SCK_PIN, CS_PIN, SO_PIN); void setup() { Serial.begin(9600); delay(500); // give the MAX6675 module time to power up before the first read } void loop() { // read the temperature and print it to the Serial Monitor Serial.print("Temperature: "); Serial.print(thermocouple.readCelsius()); Serial.print("C / "); Serial.print(thermocouple.readFahrenheit()); Serial.println("F"); delay(1000); // MAX6675 updates at most once every ~220ms, so pace the reads }

Quick Instructions

  • Wire the MAX6675 module and thermocouple probe to the ESP32 as shown in the diagram above.
  • Plug the ESP32 into your computer with a USB cable.
  • Open the Arduino IDE.
  • Under Tools, pick the matching ESP32 board (e.g. ESP32 Dev Module) and the correct COM port.
  • Open the Libraries panel from the left-hand icon bar.
  • Type "MAX6675" into the search box and find the library published by Adafruit.
  • Press Install.
  • Search for MAX6675 library created by Adafruit and click the Install button.
Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32 Dev Module
Library Manager
Type:
All
Topic:
All
MAX6675 library by Adafruit
Arduino library for interfacing with MAX6675 thermocouple amplifier More info
1.1.2
INSTALL
Newbiely.ino
···
1 void setup() {
Output
Serial Monitor
Ln 1, Col 1
ESP32 Dev Module on COM15
1
  • Paste the code above into the IDE.
  • Hit Upload to flash the sketch onto the ESP32.
  • Warm the thermocouple tip up (hold it, breathe on it, dip it in warm water) or let it cool down.
  • Open the Serial Monitor to watch the readings roll in.
Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32 Dev Module' on 'COM15')
New Line
9600 baud
Temperature: 23.50C / 74.30F Temperature: 23.75C / 74.75F Temperature: 24.25C / 75.65F Temperature: 26.00C / 78.80F Temperature: 29.50C / 85.10F Temperature: 34.75C / 94.55F Temperature: 38.25C / 100.85F
Ln 11, Col 1
ESP32 Dev Module on COM15
2

※ NOTE THAT:

Seeing a frozen or clearly wrong reading? Re-check the SCK/CS/SO wiring first, then confirm the thermocouple's red and blue leads are seated firmly in the module's screw terminals - a loose lead is the most common cause of a stuck or nonsensical reading.

Code Explanation

The sketch starts by pulling in the MAX6675 library header, which gives the ESP32 sketch access to the MAX6675 class.

#include "max6675.h"

Three constants record which ESP32 GPIOs the module's SCK, CS, and SO pins are wired to.

const int SCK_PIN = 19; // clock pin const int CS_PIN = 18; // chip select pin const int SO_PIN = 5; // serial data out pin

A single MAX6675 object, thermocouple, is then constructed with those three pins - this is what the rest of the sketch will call to take a reading.

MAX6675 thermocouple(SCK_PIN, CS_PIN, SO_PIN);

setup() only needs to bring up the serial port so we have somewhere to print the results, plus a brief delay to let the MAX6675 finish powering up before the first read.

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

Inside loop(), the two library calls that matter are:

  • Thermocouple.readCelsius(): fetches the latest reading in degrees Celsius.
  • Thermocouple.readFahrenheit(): fetches the same reading converted to Fahrenheit.
Serial.print("Temperature: "); Serial.print(thermocouple.readCelsius()); Serial.print("C / "); Serial.print(thermocouple.readFahrenheit()); Serial.println("F");

A one-second delay() closes out the loop so the readings scroll by at a comfortable pace instead of flooding the Serial Monitor.

Video Tutorial

Making video is a time-consuming work. If the video tutorial is necessary for your learning, please let us know by subscribing to our YouTube channel , If the demand for video is high, we will make the video tutorial.

※ OUR MESSAGES