Skip to main content

Section 4.2 Thermocouples

A thermocouple is made by mechanically joining two dissimilar metals. Thanks to a fun physical phenomenon known as the Seebeck effect, this results in a very small temperature-dependent voltage across the junction. With a sufficiently sensitive voltage measurement and appropriate calibration, it is possible to deduce the temperature at the thermocouple junction.

The MAX6675 and MAX31855 thermocouple amplifiers are small chips designed to make it easy to use thermocouples. They include an amplifier which boosts the tiny voltage signal up to a range that can be easily read, and ADC to convert that voltage to a digital value, a small amount of logic to calculate the temperature, and a simple digital interface to connect to a microcontroller.

The primary difference between the parts is the temperature range: the MAX6675 can read from 0 to 1023.75 ° C, while the MAX31855 can theoretically read from -270 °C up to 1800 °C  1 .

Subsection 4.2.1 Wiring the thermocouple

  • GND connects to ground

  • VCC connects to 3.3V

  • DO is the Data Output pin; connect it to any digital input

  • CS is a Chip Select pin which the microcontroller uses to tell the chip when to send data. Connect it to any digital output.

  • CLK is a clock signal which is used to synchronize the transmission of data. Connect it to any digital output.

Subsection 4.2.2 Reading the temperature in MiroPython

First, download the library from the course website, and copy it to your ESP32 like other libraries.

Then use the example code below to take a reading from the sensor:

from machine import Pin

# You'll need to make sure the library is copied to your ESP32
from thermocouple import MAX6675

# Now initialize the thermocouple object with the correct pins
# Change the pin numbers to match your setup
therm = MAX6675(cs=Pin(15), sck=Pin(2), so=Pin(4))

# Take a single reading and print it

The code for the MAX31855 is the same; just make sure to import MAX31855 instead.

The alloys in a Type K thermocouple will actually melt around 1400 °C, so most of this extra range is not very useful!