# MAX31855 Thermocouple

## Overview

A thermocouple is a kind of temperature sensor.

Unlike [semiconductor temperature sensors such as the TMP36](http://learn.adafruit.com/tmp36-temperature-sensor) , thermocouples have no electronics inside them, they are simply made by welding together two metal wires. Because of a physical effect of two joined metals, there is a slight but measurable voltage across the wires that increases with temperature. The type of metals used affect the voltage range, cost and sensitivity, which is why we have a few different kinds of thermocouples. The main improvement of using a thermocouple over a semiconductor sensor or thermistor is that the temperature range is very much increased. For example, the TMP36 can go from -50 to 150°C, after that the chip itself can be damaged. Common thermocouples on the other hand, can go from -200°C to 1350°C (K type) and there are ones that can go above 2300°C!

![](https://cdn-learn.adafruit.com/assets/assets/000/000/364/medium800/temperature_thermocouple_LRG.jpg?1396762464)

Thermocouples are often used in HVAC systems, heaters and boilers, kilns, etc. There are a few different kinds but this tutorial will discuss K type, which are very common and easier to interface with.

One difficulty in using them is that the voltage to be measured is very small, with changes of about 50 uV per °C (a uV is 1/1000000 Volts). While it is possible to read these voltages using a clean power supply and nice op-amps, there are other complications such as a non-linear response (its not always 50uV/°C) and cold-temperature compensation (the effect measured is only a differential and there must be a reference, just as ground is a reference for voltage). For that reason, we suggest only using an interface chip that will do the heavy lifting for you, allow you to easily integrate the sensor without as much pain. In this tutorial we will use a MAX6675 K-thermocouple interface chip which doesn't even require an ADC, spitting out a nice digital data signal of the temperature.

## Some Basic Stats

## This is for a K-type thermocouple with glass overbraiding

- **Size:** &nbsp;24 gauge, 1 meter long (you can cut it down if desired)
- **Price:&nbsp;** [$10 at the adafruit store](http://www.adafruit.com/index.php?main_page=product_info&cPath=35&products_id=270)
- **Temperature range:** &nbsp;-100°C to 500°C / -150 to 900°F (After this the glass overbraiding may be damaged)
- **Output range:&nbsp;** -6 to +20mV
- **Precision:** &nbsp;+-2°C
- **[Requires an amplifier such as MAX31855](http://www.adafruit.com/products/269 "Link: http://www.adafruit.com/products/269")**
- **Interface** :&nbsp;[MAX6675](https://www.analog.com/en/products/max6675.html) (discontinued),&nbsp;[MAX31855](http://www.adafruit.com/products/269), or [AD595](http://www.analog.com/en/sensors/analog-temperature-sensors/ad595/products/product.html)&nbsp;(analog)
- **[K Thermocouple Datasheet](https://sea.omega.com/temperature/Z/pdf/z204-206.pdf)**
- **[MAX6675 Datasheet](http://www.adafruit.com/datasheets/MAX6675.pdf)**
- **[MAX31855 Datasheet](http://www.adafruit.com/datasheets/MAX31855.pdf)**

# MAX31855 Thermocouple

## Wiring a Thermocouple

As we mentioned before, trying to actually measure the voltage across the wires will be very difficult for most people, which is why we strongly suggest using a thermocouple interface chip. The nicest one we've seen so far is the MAX6675 (and its replacement version called the MAX31855) which unfortunately is only available in SOIC package. While not too difficult to solder,&nbsp;[we nevertheless have in the shop a breakout board that is ready to go](http://www.adafruit.com/products/269 "Link: http://www.adafruit.com/products/269")&nbsp;.

First thing to determine is which wire is which. As you recall, thermocouples are made by welding together two wires, the chip reads the voltage difference between the two. One is the negative (for K-type its made of Alumel) and the other positive (ditto, Chromel). Luckily the wires are color coded, and almost all of the time you'll find the Alumel is red and the Chromel is yellow.

Connect the leads as required to your amplifier:

Danger: 

Danger: 

![](https://cdn-learn.adafruit.com/assets/assets/000/000/365/medium800/temperature_terminal.jpg?1396762470)

# MAX31855 Thermocouple

## Arduino Code

If you're using an AD595 interface chip, you can simply connect the voltage output to an analog input on your microcontroller and do some basic math to multiply the 10 mV/°C input into numerical output.![](https://cdn-learn.adafruit.com/assets/assets/000/000/366/medium800/temperature_attached.jpg?1396762479)

If you're planning to use the MAX6675/MAX31855, there's a little more work to be done. First off, Vin and GND must connect to a 3-5V supply. Then the three data pins must connect to digital IO pins:

- **CLK&nbsp;** (clock) is an input to the MAX6675/MAX31855 (output from microcontroller) which indicates when to present another bit of data
- **DO&nbsp;** (data out) is an output from the MAX6675/MAX31855 (input to the microcontroller) which carries each bit of data
- **CS&nbsp;** (chip select) is an input to the MAX6675/MAX31855 (output from the microcontroller) which tells the chip when its time to read the thermocouple and output more data.

In the beginning of our sketches, we define these pins. For our examples **DO** connects to digital 3, **CS** connects to digital 4, and **CLK** connects to pin 5  
![](https://cdn-learn.adafruit.com/assets/assets/000/001/303/medium800/temperature_cap.jpg?1396770831)

If you are using the MAX31855 v1.0 in a noisy environment, you may need to add a 0.01uF capacitor across the thermocouple leads.  
  
The MAX31855 does not support grounded thermocouples - if the sensor touches ground the chip will return an error

# Arduino Library

If you have an older MAX6675 breakout, download the&nbsp; **Adafruit MAX6675&nbsp;** library from the Arduino library manager.

If you have the newer MAX31855 breakout, download the&nbsp; **Adafruit MAX31855** library from the Arduino library manager.

Open up the Arduino library manager:

![](https://cdn-learn.adafruit.com/assets/assets/000/084/483/medium800/temperature___humidity_1library_manager_menu.png?1574049141)

If you have a MAX6675 breakout, search for the&nbsp; **MAX6675&nbsp;** library and install it

![](https://cdn-learn.adafruit.com/assets/assets/000/084/484/medium800/temperature___humidity_max6675.png?1574049287)

If you have the MAX31855 breakout, search for the&nbsp; **Adafruit MAX31855&nbsp;** library and install it

![](https://cdn-learn.adafruit.com/assets/assets/000/084/486/medium800/temperature___humidity_max31855.png?1574049373)

Open up the **File**** -\> ****Examples-\>MAX6675/Adafruit\_MAX31855**** -\> ****serialthermocouple** sketch and upload it to your Arduino. Once uploaded, open up the serial port monitor to display the current temperatures in both Celsius and Fahrenheit.

We also have a great tutorial on Arduino library installation at:  
[http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use](http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use "Link: http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use")

![](https://cdn-learn.adafruit.com/assets/assets/000/000/368/medium800/temperature_maxtest.gif?1447975488)

As you can see, its pretty simple to use the library, simply tell the sensor object what the clock, chip select and data pins are, then call&nbsp;**readCelsius()** or&nbsp;**readFahrenheit()**&nbsp;to get a floating point result.

# Adding a Display
A common request is to have the temperature output onto [a 'classic' character LCD such as the ones in this tutorial](http://learn.adafruit.com/character-lcds).  
![](https://cdn-learn.adafruit.com/assets/assets/000/000/369/medium800/temperature_LCDThermocouple.jpg?1396762511)

For this wiring, we connected **CLK** to digital **3** , **CS** to digital **4** and **DO** to digital **5.** Once you get it working, you can change the pin connections in the sketch  
  
We have an example sketch for this as well. [First get the LCD working by following our tutorial](http://learn.adafruit.com/character-lcds). Now load up the new sketch **File-\>Examples**** -\> ****MAX31855**** \> ****lcdthermocouple** and plug in the thermocouple module as we did in the serial thermocouple test, you'll see the internal temperature and the thermocouple temperature displayed in Celsius

# MAX31855 Thermocouple

## Python & CircuitPython

It's easy to use the&nbsp;MAX31855 sensor with Python and CircuitPython, and the&nbsp;[Adafruit CircuitPython MAX31855](https://github.com/adafruit/Adafruit_CircuitPython_MAX31855)&nbsp;module.&nbsp; This module allows you to easily write Python code that reads the&nbsp;temperature from the thermocouple.

You can use this sensor with any CircuitPython microcontroller board or with a computer that has GPIO and Python [thanks to Adafruit\_Blinka, our CircuitPython-for-Python compatibility library](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).

# CircuitPython Microcontroller Wiring

First wire up a&nbsp;MAX31855 to your board exactly as shown on the previous pages for Arduino.&nbsp; Here's an example of wiring a Feather M0 to the sensor:

- **Board 3V** &nbsp;to&nbsp; **sensor&nbsp;Vdd**
- **Board GND** &nbsp;to&nbsp; **sensor GND**
- **Board SCK** &nbsp;to&nbsp; **sensor&nbsp;CLK**
- **Board MISO** &nbsp;to&nbsp; **sensor&nbsp;DO**
- **Board D5** to **sensor CS** (or any other free digital I/O pin)

![temperature___humidity_FeatherM0_MAX31855.png](https://cdn-learn.adafruit.com/assets/assets/000/059/076/medium640/temperature___humidity_FeatherM0_MAX31855.png?1534117069)

# Python Computer Wiring

Since there's _dozens_ of Linux computers/boards you can use we will show wiring for Raspberry Pi. For other platforms, [please visit the guide for CircuitPython on Linux to see whether your platform is supported](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).&nbsp;

Here's the Raspberry Pi wired with SPI:

- **Pi**  **3.3V** to **sensor**  **Vin**
- **Pi**  **GND** to **sensor**  **GND**
- **Pi**  **SCLK** to **sensor**  **CLK**
- **Pi**  **MISO** to **sensor**  **DO**
- **Pi**  **GPIO 5** to **sensor**  **CS**

![temperature___humidity_raspi_max31855_spi.png](https://cdn-learn.adafruit.com/assets/assets/000/059/075/medium640/temperature___humidity_raspi_max31855_spi.png?1534116815)

## CircuitPython Installation of MAX31855 Library

Next you'll need to install the&nbsp;[Adafruit CircuitPython MAX31855](https://github.com/adafruit/Adafruit_CircuitPython_MAX31855)&nbsp;library on your CircuitPython board

First make sure you are running the&nbsp;[latest version of Adafruit CircuitPython](https://github.com/adafruit/circuitpython/releases)&nbsp;for your board.

Next you'll need to install the necessary libraries to use the hardware. You can do this in two ways:

1. **Easy:** In the example at the bottom of the page, click the blue "Download Project Bundle" button to get the example code and libraries for the version of CircuitPython you're using.

2. **Manual method:** &nbsp;carefully follow the steps to find and install these libraries from&nbsp;[Adafruit's CircuitPython library bundle](https://github.com/adafruit/Adafruit_CircuitPython_Bundle). For example the Circuit Playground Express guide has&nbsp;[a great page on how to install the library bundle](https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-libraries)&nbsp;for both express and non-express boards.

Remember for non-express boards like the Trinket M0, Gemma M0, and Feather/Metro M0 basic you'll need to manually install the necessary libraries from the bundle:

- **adafruit\_max31855.mpy**
- **adafruit\_bus\_device**

Before continuing make sure your board's lib folder or root filesystem has the **adafruit\_max31855.mpy,** and **adafruit\_bus\_device**** &nbsp; **files and folders** &nbsp;**copied over.

Next[&nbsp;connect to the board's serial REPL](https://learn.adafruit.com/welcome-to-circuitpython/the-repl) so you are at the CircuitPython&nbsp; **\>\>\>** &nbsp;prompt.

## Python Installation of MAX31855 Library

You'll need to install the Adafruit\_Blinka library that provides the CircuitPython support in Python. This **may** also require enabling I2C on your platform (even though this uses SPI not I2C) and verifying you are running Python 3. [Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux)!

Once that's done, from your command line run the following command:

- `sudo pip3 install adafruit-circuitpython-max31855`

If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!

## CircuitPython & Python Usage

To demonstrate the usage of the sensor we'll initialize it and read the temperature.&nbsp; First initialize the&nbsp;SPI connection and library by running:

```python
import board
import digitalio
import adafruit_max31855
spi = board.SPI()
cs = digitalio.DigitalInOut(board.D5)
max31855 = adafruit_max31855.MAX31855(spi, cs)
```

Now you can read the&nbsp; **temperature** &nbsp;property to retrieve the temperature from the sensor in degrees Celsius:

```
print('Temperature: {} degrees C'.format(max31855.temperature))
```

![](https://cdn-learn.adafruit.com/assets/assets/000/048/106/medium800/temperature_Screen_Shot_2017-11-10_at_3.00.50_PM.png?1510354866)

That's all there is to reading temperature with the&nbsp;MAX31855 and CircuitPython code!

## Full Example Code
https://github.com/adafruit/Adafruit_CircuitPython_MAX31855/blob/main/examples/max31855_simpletest.py

# MAX31855 Thermocouple

## Python Docs

# MAX31855 Thermocouple

## F.A.Q.

### 

This is likely caused by the thermocouple wires being labled incorrectly. Try swapping the two thermocouple leads, even if yellow and red wires are in the right slots - we've seen some thermocouple where the wire colors are wrong.  

### 

The MAX31855 is surprisingly sensitive, we've found a good way to fix this is to place a 0.01uF to 0.1uF capacitor across the thermocouple leads (that is, place the capacitor into the blue terminal block, or solder to the bottom as shown below).

![](https://cdn-learn.adafruit.com/assets/assets/000/002/077/medium800/temperature_ThermocoupleCap.jpg?1396779025)

### 

K thermocouples are not precision temperature measurement devices! There will be offsets & differences between thermocouples. Most thermocouple thermometers have the offset corrected in software which is what we suggest. &nbsp;See this guide for tips on calibration: &nbsp;

[Sensor Calibration](../../../../calibrating-sensors/why-calibrate)

For precision temperature measurement, we suggest a 1% Thermistor.

### 

You can connect as many MAX31855's as you have pins. Simply share the CLK and DO pins of all the breakouts and have a unique CS pin for each one  
Then you can create new thermocouples using the following style:

> Adafruit\_MAX31855 thermocouple1(thermoCLK, thermoCS1, thermoDO);  
> Adafruit\_MAX31855 thermocouple2(thermoCLK, thermoCS2, thermoDO);  
> Adafruit\_MAX31855 thermocouple3(thermoCLK, thermoCS3, thermoDO);

You can also try having same CS and CLK pins but all different DO pins  

> Adafruit\_MAX31855 thermocouple1(thermoCLK, thermoCS, thermoDO1);  
> Adafruit\_MAX31855 thermocouple2(thermoCLK, thermoCS, thermoDO2);  
> Adafruit\_MAX31855 thermocouple3(thermoCLK, thermoCS, thermoDO3);

### 

The 31855 chip handles the linear range of the K-type thermocouples very well. &nbsp;It does not provide correction for the non-linearities that occur at the extremes of the measurement range. &nbsp;Thermocouple linearization for temperature extremes requires some curve fitting. &nbsp;See this guide for more information and example code:

[Thermocouple Linearization](../../../../calibrating-sensors/maxim-31855-linearization "MAX31855 Thermocouple Linearization")

# MAX31855 Thermocouple

## Project Examples

Need ideas? Check out these projects!![](https://cdn-learn.adafruit.com/assets/assets/000/000/370/medium800/temperature_screen_shot_2010_05_13_at_001050.png?1396762542)

[Jeelabs has a detailed walkthrough for a reflow controller (uses an AD595-type chip)](http://news.jeelabs.org/tag/reflow/)https://www.youtube.com/watch?v=Sb1nvKYYTdc

![](https://cdn-learn.adafruit.com/assets/assets/000/000/371/medium800/temperature_cr_frontview_full.jpg?1396762550)

[Terran's PI conntrolled coffee roaster](http://www.consistent.org/terran/2009/coffeeroaster.shtml "Link: http://www.consistent.org/terran/2009/coffeeroaster.shtml")![](https://cdn-learn.adafruit.com/assets/assets/000/000/372/medium800/temperature_3591683079_f16a63a79a_b.jpg?1396762554)

[RocketNumberNine's reflow toaster project](http://www.rocketnumbernine.com/2009/06/03/smt-table-top-reflow-oven-part-1/ "Link: http://www.rocketnumbernine.com/2009/06/03/smt-table-top-reflow-oven-part-1/")# MAX31855 Thermocouple

## Downloads

# Datasheets & Files

- [MAX31855 Datasheet](https://cdn-shop.adafruit.com/datasheets/MAX31855.pdf)
- [MAX6675 Schematic and layout files can be found at GitHub](http://github.com/adafruit/Adafruit-MAX6675-breakout-board)
- [MAX31855 Schematic and layout files can be found at GitHub](http://github.com/adafruit/Adafruit-MAX31855-breakout-board)
- [Fritzing objects for both in the Adafruit Fritzing library](https://github.com/adafruit/Fritzing-Library)

# Schematic

Click to embiggen

![](https://cdn-learn.adafruit.com/assets/assets/000/035/637/medium800/temperature_schem.png?1473452098)

# Fabrication Print

Dimensions in Inches

![](https://cdn-learn.adafruit.com/assets/assets/000/035/636/medium800/temperature_fabprint.png?1473452088)


## Primary Products

### Adafruit Universal Thermocouple Amplifier MAX31856 Breakout

[Adafruit Universal Thermocouple Amplifier MAX31856 Breakout](https://www.adafruit.com/product/3263)
Thermocouples are very sensitive, requiring a good amplifier with a cold-compensation reference, as well as calculations to handle any non-linearities. For a long time we've [suggested our MAX31855K breakout, which works great but is only for...](https://www.adafruit.com/products/269)

Out of Stock
[Buy Now](https://www.adafruit.com/product/3263)
[Related Guides to the Product](https://learn.adafruit.com/products/3263/guides)

## Featured Products

### Thermocouple Amplifier MAX31855 breakout board (MAX6675 upgrade)

[Thermocouple Amplifier MAX31855 breakout board (MAX6675 upgrade)](https://www.adafruit.com/product/269)
Thermocouples are very sensitive, requiring a good amplifier with a cold-compensation reference. The MAX31855K does everything for you, and can be easily interfaced with any microcontroller, even one without an analog input. This breakout board has the chip itself, a 3.3V regulator with 10uF...

In Stock
[Buy Now](https://www.adafruit.com/product/269)
[Related Guides to the Product](https://learn.adafruit.com/products/269/guides)
### Thermocouple Type-K Glass Braid Insulated

[Thermocouple Type-K Glass Braid Insulated](https://www.adafruit.com/product/270)
Thermocouples are best used for measuring temperatures that can go above 100 °C. This is a bare wires bead-probe which can measure air or surface temperatures. Most inexpensive thermocouples have a vinyl covering which can melt at around 200 °C, this one uses a fiberglass braid so it...

Out of Stock
[Buy Now](https://www.adafruit.com/product/270)
[Related Guides to the Product](https://learn.adafruit.com/products/270/guides)
### Thermocouple Type-K Glass Braid Insulated Stainless Steel Tip

[Thermocouple Type-K Glass Braid Insulated Stainless Steel Tip](https://www.adafruit.com/product/3245)
Thermocouples are best used for measuring temperatures that can go above 100°C. This is a bare wires stainless-steel tip probe which can measure air or surface temperatures. Most inexpensive thermocouples have a vinyl covering which can melt at around 200°C, this one uses a fiberglass...

In Stock
[Buy Now](https://www.adafruit.com/product/3245)
[Related Guides to the Product](https://learn.adafruit.com/products/3245/guides)

## Related Guides

- [Calibrating Sensors](https://learn.adafruit.com/calibrating-sensors.md)
- [Connecting the MAX31855 Thermocouple Amplifier breakout to an Electric Imp](https://learn.adafruit.com/connecting-the-max31855-thermocouple-amplifier-breakout-to-an-electric-imp.md)
- [Adafruit 1-Wire Thermocouple Amplifier - MAX31850K](https://learn.adafruit.com/adafruit-1-wire-thermocouple-amplifier-max31850k.md)
- [ Analog IC Insights On-the-Go by Maxim Integrated](https://learn.adafruit.com/maxim-app.md)
- [Google Docs Sensor Logging From Your PC](https://learn.adafruit.com/gdocs-sensor-logging-from-your-pc.md)
- [Adafruit FT232H With SPI & I2C Devices](https://learn.adafruit.com/adafruit-ft232h-with-spi-and-i2c-libraries.md)
- [CircuitPython I2C and SPI Under the Hood](https://learn.adafruit.com/circuitpython-basics-i2c-and-spi.md)
- [Adding a Single Board Computer to Blinka](https://learn.adafruit.com/adding-a-single-board-computer-to-blinka.md)
- [CircuitPython Libraries on Linux and the 96Boards DragonBoard 410c](https://learn.adafruit.com/circuitpython-libraries-on-linux-and-the-96boards-dragonboard-410c.md)
- [MAX31855 Thermocouple Sensor Python Library](https://learn.adafruit.com/max31855-thermocouple-python-library.md)
- [MicroPython Hardware: SPI Devices](https://learn.adafruit.com/micropython-hardware-spi-devices.md)
- [Adafruit MLX90632 FIR Remote Thermal Temperature Sensor](https://learn.adafruit.com/adafruit-mlx90632-fir-remote-thermal-temperature-sensor.md)
- [ESP8266 Temperature / Humidity Webserver](https://learn.adafruit.com/esp8266-temperature-slash-humidity-webserver.md)
- [Compost Friend!](https://learn.adafruit.com/compost-optimization-machine.md)
- [UTi165 Thermal Fever Scanner Camera](https://learn.adafruit.com/uti165-thermal-fever-scanner-camera.md)
