To read a Type K thermocouple with an Arduino, you must use a dedicated SPI amplifier IC like the MAX31855. A raw thermocouple generates roughly 41 microvolts per degree Celsius, which is entirely invisible to the Arduino’s 10-bit analog-to-digital converter (ADC). The MAX31855 handles the cold-junction compensation, amplifies the microvolt signal, and digitizes it into a 14-bit temperature reading via the SPI bus, giving you 0.25°C resolution across a -270°C to +1350°C range.
This guide covers the exact hardware stack, SPI pin mapping, and complete C++ code required to get reliable readings, alongside a debugging framework for the specific fault codes the IC throws when things go wrong on the bench.
Thermocouple Amplifier Comparison: MAX31855 vs Alternatives
Before wiring your board, verify you have the right amplifier for your temperature range and required precision. Hobbyists frequently buy the cheaper MAX6675, only to realize later that it lacks fault detection and tops out at 1024°C. Here is how the common SPI thermocouple amplifiers compare for embedded projects in 2026.
| IC Model | Resolution | Temp Range | Supported Types | Fault Detection | Avg Price |
|---|---|---|---|---|---|
| MAX6675 | 12-bit (0.25°C) | 0°C to 1024°C | Type K only | Open circuit only | $6 - $8 |
| MAX31855 | 14-bit (0.25°C) | -270°C to 1350°C | Type K only | Open, Short to GND/VCC | $12 - $16 |
| MAX31856 | 19-bit (0.0078°C) | -210°C to 1800°C | All (B, E, J, K, N, R, S, T) | Advanced (Open, Short, Over/Under voltage) | $22 - $30 |
Verdict: For 90% of maker projects (kilns, reflow ovens, exhaust gas monitoring), the MAX31855 is the sweet spot. It provides the necessary fault detection to prevent runaway heating if the probe disconnects, without the $25+ premium of the MAX31856.
Parts List and SPI Pin Mapping
This build assumes you are using an Arduino Uno R3 or Arduino Nano v3 (ATmega328P architecture). If you are using an ESP32, the SPI pins change, and you must account for 3.3V logic natively.
Required Hardware
- Microcontroller: Arduino Uno R3 or Nano v3 (5V logic, 16MHz).
- Amplifier: Adafruit MAX31855 Breakout Board (Product ID: 269) or a generic equivalent with an onboard 3.3V LDO and logic level shifters. Warning: Raw generic MAX31855 modules without level shifters will output 3.3V on the MISO pin, which is fine for the Uno, but feeding 5V into the module's VCC/GND pins without an LDO will fry the IC.
- Sensor: Type K Thermocouple probe with fiberglass insulation (rated to 480°C) or stainless steel sheath (rated to 1200°C).
- Wiring: 22 AWG solid core jumper wires for SPI; high-temp wire if routing near the heat source.
SPI Pin Mapping Table (Uno / Nano)
| MAX31855 Pin | Arduino Uno/Nano Pin | Function |
|---|---|---|
| VIN / VCC | 5V | Power (if breakout has LDO) or 3.3V for raw IC |
| GND | GND | Common Ground |
| SCK | 13 | SPI Clock |
| MISO / DO | 12 | Master In, Slave Out (Data) |
| CS / SS | 10 | Chip Select (Active Low) |
Note: The MAX31855 does not use MOSI (Master Out, Slave In) because it is a read-only device. Pin 11 remains unused for this specific sensor.
Step-by-Step Wiring Procedure
- Connect Power: Wire the breakout board's VIN to the Arduino's 5V pin, and GND to GND. If using a raw surface-mount module without an LDO, connect VCC strictly to the Arduino's 3.3V pin.
- Wire the SPI Bus: Connect SCK to Pin 13, MISO (or DO) to Pin 12, and CS to Pin 10. Keep these SPI traces under 15cm (6 inches) to prevent clock signal degradation and stray EMI pickup.
- Terminate the Thermocouple: Strip 5mm of insulation from the thermocouple wires. Insert them into the screw terminals on the MAX31855 board.
- ANSI Standard (US): Yellow is Positive (+), Red is Negative (-).
- IEC Standard (EU/Global): Green is Positive (+), White is Negative (-).
- Verify Connections: Use a multimeter to check continuity between the probe tip and the screw terminals before applying power.
Complete Arduino Code with Fault Handling
This code targets the Arduino Uno R3 / Nano and uses the standard Adafruit_MAX31855 library (install via Arduino Library Manager). It includes robust error handling to catch the exact fault codes the IC generates, preventing your system from acting on NAN (Not a Number) values if the probe fails.
#include <SPI.h>
#include <Adafruit_MAX31855.h>
// Pin definitions for Arduino Uno/Nano hardware SPI
#define MAXCS 10
#define MAXDO 12
#define MAXCLK 13
// Initialize the library using hardware SPI
Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);
void setup() {
Serial.begin(115200);
while (!Serial) delay(10); // Wait for serial port (Leonardo/Micro)
Serial.println("MAX31855 Thermocouple Test");
// Wait for MAX31855 to stabilize
delay(500);
}
void loop() {
// Read the internal temperature (cold junction)
double internalTemp = thermocouple.readInternal();
Serial.print("Internal (Cold Junction) Temp = ");
Serial.print(internalTemp);
Serial.println(" *C");
// Read the thermocouple temperature
double tempC = thermocouple.readCelsius();
// Check for NaN (Not a Number) which indicates a hardware fault
if (isnan(tempC)) {
uint8_t fault = thermocouple.readFault();
if (fault) {
Serial.print("FAULT DETECTED: 0x");
Serial.println(fault, HEX);
if (fault & MAX31855_FAULT_OPEN)
Serial.println("ERROR: FAULT_OPEN - Probe disconnected or broken wire.");
if (fault & MAX31855_FAULT_SHORT_GND)
Serial.println("ERROR: FAULT_SHORT_GND - Probe shorted to ground.");
if (fault & MAX31855_FAULT_SHORT_VCC)
Serial.println("ERROR: FAULT_SHORT_VCC - Probe shorted to power.");
// Clear the fault register for the next read
thermocouple.clearFault();
} else {
Serial.println("ERROR: Read returned NaN but no fault register flags set. Check SPI wiring.");
}
} else {
Serial.print("Thermocouple Temp = ");
Serial.print(tempC);
Serial.println(" *C");
// Optional: Convert to Fahrenheit
double tempF = thermocouple.readFahrenheit();
Serial.print("Thermocouple Temp = ");
Serial.print(tempF);
Serial.println(" *F");
}
Serial.println("-----------------------");
delay(1000);
}
Debugging: First Three Checks and Exact Fault Codes
When the serial monitor outputs FAULT DETECTED or reads NAN, do not immediately assume the IC is dead. The MAX31855 is highly sensitive to SPI timing and physical probe integrity. Refer to the Analog Devices MAX31855 Datasheet for the exact bit-level fault register mapping.
The First Three Things to Check When It Fails
- Verify Chip Select (CS) State: The CS pin is active LOW. If Pin 10 is left floating or accidentally configured as an INPUT in your code, the IC will not drive the MISO line, resulting in all zeros or
NAN. Ensure Pin 10 is explicitly driven HIGH when idle, and LOW only during the read transaction (the Adafruit library handles this, but custom SPI code often misses it). - Check Thermocouple Polarity and Continuity: Disconnect power. Set your multimeter to continuity mode. Measure across the two screw terminals. You should read near 0 ohms (a dead short) because the thermocouple junction is physically welded together. If you read OL (open loop), the probe wire is broken internally. If it reads open, you will get a
MAX31855_FAULT_OPENerror. - Inspect for Sheath Grounding (Short to GND): If you are using a stainless steel sheathed probe in a metal enclosure or kiln, the internal mineral insulation (MgO) can break down at high temperatures or absorb moisture, causing the internal thermocouple wire to short to the metal sheath. If the sheath is earthed, the IC reads this as
MAX31855_FAULT_SHORT_GND. Test by isolating the probe from the metal enclosure.
Ranked Cause List for Specific Error Strings
| Exact Error String | Most Likely Cause | Secondary Cause | Fix / Action |
|---|---|---|---|
FAULT_OPEN |
Probe unplugged or wire snapped at the junction. | Screw terminals not tightened down on the bare wire. | Reseat wires; check continuity with DMM. |
FAULT_SHORT_GND |
Metal probe sheath touching a grounded chassis. | Moisture ingress in the probe insulation. | Isolate probe; bake probe at 100°C to dry out. |
FAULT_SHORT_VCC |
Thermocouple wire pinched against a live heater wire. | Solder bridge on the MAX31855 breakout PCB. | Inspect routing; check PCB under magnification. |
NaN (No Fault) |
SPI Clock (SCK) wiring disconnected or wrong pin. | Using software SPI on pins that don't support it. | Verify SCK is on Pin 13; check jumper continuity. |
Simplifying or Extending Your Sensor Build
To Simplify: If your project only requires monitoring a 3D printer hotend or a food smoker (0°C to 300°C), and you do not care about fault detection, swap the MAX31855 for a MAX6675. It is cheaper, uses the exact same SPI pinout, and requires minimal code changes (just swap the library to max6675.h). However, be aware that the MAX6675 will silently output 0°C or 1024°C if the probe disconnects, which can be dangerous in unattended heating applications.
To Extend: For data logging or remote monitoring, migrate the microcontroller to an ESP32 DevKit v1. The ESP32 natively runs at 3.3V, which perfectly matches the raw MAX31855 IC without needing logic level shifters. You can pair the SPI thermocouple read with the ESP32's WiFi stack to push temperature telemetry via MQTT to a Home Assistant dashboard. When moving to the ESP32, update your pin definitions to the ESP32's default VSPI pins: SCK = 18, MISO = 19, CS = 5. Ensure you add a 100nF decoupling capacitor across the VCC and GND pins of the sensor to filter out WiFi RF noise that can otherwise cause sporadic SPI bit-flips in the temperature register.






