You cannot wire a thermocouple directly to an Arduino's analog pins. Thermocouples generate microvolt-level signals that require cold-junction compensation (CJC) and amplification. To read a thermocouple with Arduino, you must use a dedicated SPI amplifier chip. For 95% of hobbyist, kiln-monitoring, and prosumer builds, pairing a K-type probe with a MAX31855 breakout board is the definitive, most reliable approach.
The Decision Path: MAX6675 vs MAX31855 vs MAX31856
Before buying parts, you need to select the right amplifier IC. The market is dominated by three Maxim/Analog Devices chips. Use this decision matrix to select the correct board for your thermal range and resolution requirements.
| Condition / Requirement | Recommended Chip | Resolution & Temp Range | Approx. Cost (2026) |
|---|---|---|---|
| Budget is strictly under $5; max temp is 700°C; no negative temps needed. | MAX6675 | 12-bit (0.25°C), 0°C to +700°C | $3.50 (Clone) |
| Need to read sub-zero temps, require 14-bit resolution, and need hardware fault detection. | MAX31855 | 14-bit (0.25°C), -270°C to +1370°C | $10.95 (Adafruit) |
| Using J, T, or N type probes; require 19-bit resolution and internal linearization. | MAX31856 | 19-bit (0.015°C), -270°C to +1760°C | $14.50 (Adafruit) |
Parts List and Pin Mapping
This guide targets the Arduino Uno R3 (or Nano V3). The code and wiring rely on the Adafruit MAX31855 library, which handles the 32-bit SPI bit-shifting and fault-parsing for you.
Required Components
- Microcontroller: Arduino Uno R3 (ATmega328P)
- Amplifier: Adafruit MAX31855 Breakout Board (Product ID: 269) or equivalent clone with onboard 3.3V logic regulation.
- Sensor: K-Type Thermocouple Probe (Stainless steel tip, fiberglass insulated wire, ANSI color code).
- Wiring: 5x jumper wires (F-M or M-M depending on your breakout headers).
Pin Mapping Table
The MAX31855 uses SPI communication. While hardware SPI is faster, we will use the software SPI constructor in the code below. This allows you to route the pins to any digital I/O, making the code universally copy-pasteable across Uno, Nano, and Mega boards.
| MAX31855 Breakout Pin | Arduino Uno R3 Pin | Function / Notes |
|---|---|---|
| VIN (or VCC) | 5V | Powers the onboard 3.3V LDO regulator on the Adafruit board. |
| GND | GND | Common ground reference. |
| SCK (CLK) | Digital Pin 13 | SPI Clock. (Can be changed in software). |
| MISO (DO) | Digital Pin 12 | Master In Slave Out / Data Out. (Can be changed in software). |
| CS | Digital Pin 10 | Chip Select. Must be unique if daisy-chaining multiple sensors. |
Step-by-Step Wiring Procedure
- De-energize the Arduino: Unplug the USB cable before making connections to prevent accidental shorts on the SPI bus.
- Wire the SPI Bus: Connect SCK to Pin 13, MISO to Pin 12, and CS to Pin 10. Connect VIN to 5V and GND to GND.
- Prepare the Thermocouple Leads: Strip exactly 1/4 inch (6mm) of insulation from the thermocouple wires. Twist the stranded fiberglass-insulated copper tightly.
- Terminate the Probe: Insert the wires into the screw terminals on the MAX31855 breakout.
WARNING: ANSI Color Code Trap! In standard DC electronics, Red is positive. In ANSI-standard thermocouples, Red is NEGATIVE (-) and Yellow is POSITIVE (+). Wire Yellow to the '+' terminal and Red to the '-' terminal. If you wire it backwards, your temperature readings will drop when you heat the probe.
- Secure the Connections: Tighten the terminal screws firmly. A loose connection here introduces thermal EMF errors and triggers 'Open Circuit' faults.
Complete Compilable Code with Error Handling
This code uses the Adafruit MAX31855 Library. Install it via the Arduino IDE Library Manager before compiling. The code includes robust fault-checking to prevent your serial monitor from flooding with NAN (Not a Number) errors.
#include <SPI.h>
#include <Adafruit_MAX31855.h>
// Define Software SPI pins (can be changed to any digital pins)
#define MAXCS 10
#define MAXCLK 13
#define MAXDO 12
// Initialize the MAX31855 using Software SPI
Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);
void setup() {
Serial.begin(115200);
Serial.println("MAX31855 K-Type Thermocouple Test");
// Wait for MAX31855 to stabilize
delay(500);
}
void loop() {
// Read the internal CJC (Cold Junction Compensation) temperature
float internalTemp = thermocouple.readInternal();
Serial.print("Internal CJC Temp = ");
Serial.print(internalTemp);
Serial.println(" *C");
// Read the thermocouple tip temperature
double celsius = thermocouple.readCelsius();
// Error Handling: Check for NAN and specific fault bits
if (isnan(celsius)) {
Serial.println("ERROR: Thermocouple reading is NAN!");
uint8_t fault = thermocouple.readError();
if (fault & MAX31855_FAULT_OPEN) {
Serial.println("Fault = 0x1: OPEN CIRCUIT (Check wire connections)");
}
if (fault & MAX31855_FAULT_GND) {
Serial.println("Fault = 0x2: SHORT TO GND (Check probe sheath grounding)");
}
if (fault & MAX31855_FAULT_VCC) {
Serial.println("Fault = 0x4: SHORT TO VCC (Check for crossed wires)");
}
if (fault == 0) {
Serial.println("Fault = 0x0: SPI Timing Error or CS pin floating.");
}
} else {
Serial.print("Thermocouple Temp = ");
Serial.print(celsius);
Serial.println(" *C");
// Optional: Convert to Fahrenheit
float fahrenheit = celsius * 9.0 / 5.0 + 32.0;
Serial.print("Fahrenheit = ");
Serial.print(fahrenheit);
Serial.println(" *F");
}
Serial.println("-----------------------");
delay(1000);
}
Debugging: Fixing "NAN" and Fault Codes
When a thermocouple circuit fails, the MAX31855 returns NAN to the Arduino. This is not a software bug; it is the chip's hardware protection telling you the physical circuit is compromised. According to the NIST ITS-90 thermocouple database, K-type alloys are highly susceptible to ground loops and oxidation. If your serial monitor outputs ERROR: Thermocouple reading is NAN!, execute these first three checks.
The First 3 Things to Check
- Verify ANSI Polarity and Continity (Fixes Fault 0x1): Disconnect the Arduino. Set your multimeter to continuity mode. Probe the two exposed wires at the screw terminal. You should read near 0 ohms. If it reads OL (Open Loop), the wire is broken inside the fiberglass sheath, or the screw terminal is loose. Also, verify Yellow is (+) and Red is (-).
- Check for Grounded Tip Shorts (Fixes Fault 0x2 / 0x4): Many stainless-steel K-type probes are "grounded tip" style, meaning the thermocouple junction is physically welded to the metal sheath. If that metal sheath touches a grounded chassis (like a metal oven rack or a grounded 3D printer frame), it shorts the microvolt signal to earth ground. Fix: Wrap the probe sheath in high-temp Kapton tape or ceramic cement to isolate it from the chassis.
- Check SPI Timing and CS Pin (Fixes Fault 0x0): If the chip returns
NANbutreadError()returns 0, the MAX31855 is failing to clock out the 32-bit register. This happens if your jumper wires are too long (over 6 inches) or if you are using hardware SPI on a board where Pin 13 is tied to an onboard LED causing capacitance issues. Fix: Switch to shorter wires or move SCK to Pin 6 and MISO to Pin 5 using the software SPI constructor.
Fault Code Reference Matrix
| Serial Output String | Hex Bitmask | Physical Cause | Hardware Fix |
|---|---|---|---|
| Fault = 0x1 | 0x01 (OPEN) | Thermocouple wires are disconnected or broken. | Tighten screw terminals; replace frayed probe. |
| Fault = 0x2 | 0x02 (GND) | Thermocouple wires shorted to ground. | Isolate grounded probe sheath from metal chassis. |
| Fault = 0x4 | 0x04 (VCC) | Thermocouple wires shorted to VCC. | Check for solder bridges on the breakout board. |
Extending and Simplifying the Build
Once you have a single probe reading reliably, you will likely want to adapt the system to your specific project constraints.
How to Extend: Reading Multiple Thermocouples
The SPI bus is designed to be shared. You do not need multiple Arduinos to read multiple probes. To read up to four K-type thermocouples on a single Uno R3, wire the SCK and MISO pins of all MAX31855 breakouts together in parallel. Then, route a unique CS (Chip Select) pin from the Arduino to each breakout (e.g., CS1 to Pin 10, CS2 to Pin 9, CS3 to Pin 8). In your code, instantiate multiple objects: Adafruit_MAX31855 tc1(MAXCLK, CS1, MAXDO); and poll them sequentially in the loop().
How to Simplify: When to Ditch the Thermocouple
If your application only requires measuring ambient room temperature, water boiling points, or 3D printer bed temperatures (0°C to 120°C), a thermocouple is overkill. The MAX31855 adds $11 to your BOM and requires SPI wiring. Simplify the build by switching to a 10k NTC Thermistor (like the Vishay NTCLE100E3103) paired with a 10k pull-up resistor. You can wire an NTC directly to an Arduino analog pin (A0) and use the Steinhart-Hart equation in software, cutting your hardware cost to under $0.50 and eliminating SPI debugging entirely.






