Projects / Four-channel thermocouple logger

Four-channel thermocouple logger

Intermediate2.5 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. ESP32

    Test one probe

    Print its temperature.

  2. ESP32

    Add the other three

    Give each its own chip select.

  3. ESP32

    Add the display

    Show four readings.

  4. ESP32MICROSSANDIS

    Add the SD card

    Create a CSV with a header.

  5. ESP32

    Log every second

    Write the seconds and four values.

  6. ESP32

    Test with warm water

    Check against a thermometer.

  7. ESP32

    Plot

    Open the CSV on a PC and chart it.

In short

How do you build a four-channel thermocouple logger?

Four K-type thermocouples log temperatures to SD, for reflow ovens, heatsinks or cooking. You need ESP32 DevKit V1, MAX31855 thermocouple amplifier × 4, MicroSD Card Module, SanDisk microSD card 32 GB (A1, Class 10) and SSD1306 OLED Display. It takes 7 steps and about 150 minutes.

Level
Intermediate
Time
About 150 min
Parts
5

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
MAX31855 modules VCC and GNDESP32 3V3 and GNDPower (all four)
MAX31855 CLK (all four)ESP32 GPIO18Shared SPI clock
MAX31855 DO (all four)ESP32 GPIO19Shared SPI data out
MAX31855 CSESP32 GPIO5, GPIO17, GPIO16, GPIO4One chip select each
SD module CSESP32 GPIO13Chip select
SD module MOSIESP32 GPIO23SPI data in
SD module MISO and SCKESP32 GPIO19 and GPIO18Shared with the thermocouple chips
SD module VCC and GNDESP32 5V and GNDPower (use a module with a level shifter)
OLED SDA and SCLESP32 GPIO21 and GPIO22Display

Code

Each MAX31855 chip amplifies a K-type thermocouple signal, adds cold-junction compensation and sends the temperature over SPI; four chips share the clock and data pins and each has its own chip select. The SD card shares the clock and data-out lines too, with its own chip select. K-type probes measure from below zero to over 1000 °C, but the chip's accuracy is about 2 °C. A reading of NaN means the probe is not connected or shorted. Use only on low-voltage, non-live objects. Never touch a thermocouple to mains wiring or a live conductor: many probes have exposed tips connected to the metal sheath, and a short to a live conductor is lethal. Reflow ovens, soldering irons and cooking surfaces are hot enough to burn, so keep fingers and the electronics away from them, and keep the board and cables away from direct heat. Use glass-braid or PTFE-insulated probe leads for hot work. Arduino IDE with the ESP32 boards package, board "ESP32 Dev Module".

Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

// Four-channel thermocouple logger. Libraries: Adafruit MAX31855, Adafruit SSD1306, Adafruit GFX, SD. Board: ESP32 Dev Module.
#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include <Adafruit_MAX31855.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

const int CS[4] = {5, 17, 16, 4};
Adafruit_MAX31855 tc[4] = { Adafruit_MAX31855(CS[0], &SPI), Adafruit_MAX31855(CS[1], &SPI), Adafruit_MAX31855(CS[2], &SPI), Adafruit_MAX31855(CS[3], &SPI) };
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const int SD_CS = 13;
unsigned long last = 0, started;

void setup() {
  Serial.begin(115200);
  for (int i = 0; i < 4; i++) tc[i].begin();
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); oled.setTextColor(SSD1306_WHITE);
  SD.begin(SD_CS);
  File f = SD.open("/TCLOG.CSV", FILE_APPEND);
  if (f && f.size() == 0) f.println("seconds,t1,t2,t3,t4");
  if (f) f.close();
  started = millis();
}

void loop() {
  if (millis() - last < 1000) return;
  last = millis();
  double t[4];
  for (int i = 0; i < 4; i++) t[i] = tc[i].readCelsius();      // NaN if the probe is open or shorted
  oled.clearDisplay(); oled.setTextSize(1);
  for (int i = 0; i < 4; i++) {
    oled.setCursor(0, i * 14); oled.print("T"); oled.print(i + 1); oled.print(": ");
    if (isnan(t[i])) oled.print("no probe"); else { oled.print(t[i], 1); oled.print(" C"); }
  }
  oled.display();
  File f = SD.open("/TCLOG.CSV", FILE_APPEND);
  if (f) {
    f.print((millis() - started) / 1000);
    for (int i = 0; i < 4; i++) { f.print(","); if (isnan(t[i])) f.print("NaN"); else f.print(t[i], 1); }
    f.println(); f.close();
  }
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Probes in room airAll near the room temperature
Hold one probe tip in your handThat channel rises
Unplug one probeShows no probe, others carry on
After a runCSV has one line per second

If it does not work

All channels read NaN

Check the shared clock and data wires.

Only one channel works

Check each chip select pin.

SD fails

Format as FAT32 and check the SD chip select.

Readings noisy

Keep probe leads away from motors and mains cables.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the four-channel thermocouple logger?

ESP32 DevKit V1, MAX31855 thermocouple amplifier × 4, MicroSD Card Module, SanDisk microSD card 32 GB (A1, Class 10) and SSD1306 OLED Display.

How long does the four-channel thermocouple logger take to build?

About 150 minutes for a intermediate maker, in 7 steps.

How do I know the four-channel thermocouple logger works?

Probes in room air: All near the room temperature. Hold one probe tip in your hand: That channel rises. Unplug one probe: Shows no probe, others carry on.

All channels read NaN: what should I check?

Check the shared clock and data wires.

Only one channel works: what should I check?

Check each chip select pin.

SD fails: what should I check?

Format as FAT32 and check the SD chip select.

Readings noisy: what should I check?

Keep probe leads away from motors and mains cables.