In this guide, you’ll learn how to read temperature using a K-Type Thermocouple with the MAX6675 amplifier with the Arduino board. A K-type thermocouple is a type of temperature sensor with a wide measurement range like â200ÂșC to 1350ÂșC (â326 to 2300ÂșF).
This tutorial covers how to interface the k-type thermocouple with your Arduino board, install the required library and use a simple sketch to display the sensor readings in the Serial Monitor.
Table of Contents
In this tutorial, we’ll cover the following topics:
- Introducing K-Type Thermocouple
- MAX6675 Amplifier
- Interfacing K-Type Thermocouple with MAX6675 Amplifier
- Installing MAX6675 Arduino Library
- Code – Get Temperature from K-Type Thermocouple with MAX6675 Amplifier
What is a K-Type Thermocouple?
A thermocouple is a device that consists of two different electrical conductors that form an electrical junctionâthermal junction. The change in temperature at the junction creates a slightly but measurable voltage at the reference junction that can be used to calculate the temperature.
A thermocouple can be made of different metals. The metals used will affect the voltage range, cost, and sensitivity. There are standardized metal combinations that result in different thermocouple types: B, E, J, N, K, R, T, and S.
Our tutorial is about the k-type thermocouple. A k-type thermocouple is made out of chrome and alumel conductors and has a general temperature range of -200 to 1260ÂșC (-326 to 2300ÂșF).
MAX6675 Amplifier
To get the temperature from the thermocouple we need a thermocouple amplifier. The temperature output from the thermocouple amplifier depends on the voltage read on the reference junction. The voltage at the reference junction depends on the temperature difference between the reference junction and the thermal junction. So, we need to know the temperature at the reference junction.
The MAX6675 thermocouple comes with a temperature sensor to measure temperature at the reference junction (cold-compensation reference) and amplifies the tiny voltage at the reference junction so that we can read it using our microcontrollers. The MAX6675 amplifier communicates with a microcontroller using the SPI communication protocol and the data is output in a 12-bit resolution.
Usually, you can get a pack with a k-type thermocouple and the MAX6675 amplifier. Here’s a list of the MAX6675 most relevant features. For a more detailed description, please consult the MAX6675 datasheet.
- Direct digital conversion of k-type thermocouple output
- Cold-junction compensaiton
- Simple SPI-compatible serial interface
- Operating voltage range: 3.0 to 5.5V
- Operating temperature range: -20 to 85ÂșC
- Resolves temperatures to 0.25ÂșC, allows readings as high as 1024ÂșC (1875ÂșF).
Interfacing K-Type Thermocouple with MAX6675 Amplifier
As mentioned previously, the MAX6675 communicates with a microcontroller using SPI communication protocol.
MAX6675 | Microcontroller |
SO | MISO |
CS | CS |
SCK | CLK |
VCC | VCC (3.3V or 5V) |
GND | GND |
Get Temperature from K-Type Thermocouple with MAX6675 Amplifier
In this section, you’ll learn how to get temperature from your k-type thermocouple. We’ll show you a simple example that reads the temperature and displays it on the Arduino IDE Serial Monitor.
Parts Required
To complete this tutorial, you need the following parts:
- K-type thermocouple with MAX6675 amplifier
- Arduino (read Best Arduino starter kits)
- Jumper wires (female-to-male)
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Schematic – Arduino with K-type thermocouple and MAX6675 Amplifier
Wire the MAX6675 Amplifier to the Arduino as shown in the following schematic diagram.
You can also follow the next table.
MAX6675 | Arduino |
GND | GND |
VCC | 3.3V |
SCK | Pin 6 |
CS | Pin 5 |
SO | Pin 4 |
Installing MAX6675 Arduino Library
There are different libraries to get temperature from a K-type thermocouple using the MAX6675 amplifier. We’ll use the max6675 library from Adafruit.
Follow the next steps to install the library in your Arduino IDE:
Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries. The Library Manager should open.
Search for âmax6675 â in the search box and install the library from Adafruit.
Code – Get Temperature from K-Type Thermocouple with MAX6675 Amplifier
Getting temperature from the K-Type thermocouple with the Arduino is very simple. The library provides an example that gets temperature and displays the results on the Arduino IDE Serial monitor.
This code is the example provided by the library.
// this example is public domain. enjoy! https://learn.adafruit.com/thermocouple/
#include "max6675.h"
int thermoDO = 4;
int thermoCS = 5;
int thermoCLK = 6;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
void setup() {
Serial.begin(9600);
Serial.println("MAX6675 test");
// wait for MAX chip to stabilize
delay(500);
}
void loop() {
// basic readout test, just print the current temp
Serial.print("C = ");
Serial.println(thermocouple.readCelsius());
Serial.print("F = ");
Serial.println(thermocouple.readFahrenheit());
// For the MAX6675 to update, you must delay AT LEAST 250ms between reads!
delay(1000);
}
How the Code Works
First, include the max6675.h library.
#include "max6675.h"
Define the pins that are interfacing with the MAX6675 thermocouple amplifier.
int thermoDO = 12;
int thermoCS = 15;
int thermoCLK = 14;
Create a MAX6675 object called thermocouple on the pins we’ve defined previously.
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
In the setup(), initialize the Serial Monitor at a baud rate of 9600.
Serial.begin(9600);
In the loop(), we read the temperature and display it on the Serial Monitor. The library provides a method to read the temperature in Celsius and a method to read the temperature in Fahrenheit degrees.
- thermocouple.readCelsius(): returns temperature in Celsius degrees.
- thermocouple.readFahrenheit(): returns temperature in Fahrenheit degrees.
The following lines read the temperature and display it on the Serial Monitor.
Serial.print("C = ");
Serial.println(thermocouple.readCelsius());
Serial.print("F = ");
Serial.println(thermocouple.readFahrenheit());
As you can see, it’s very simple to get temperature readings using the K-type thermocouple with the MAX6675 amplifier.
Demonstration
Upload the code to your Arduino board. Don’t forget the select the board you’re using in Tools > Board and select the COM port your board is connected to in Tools > Port.
After uploading the code, open the Serial Monitor at a baud rate of 9600.
New temperature readings are displayed on the Serial Monitor every second.
Wrapping Up
In this tutorial, you learned how to read temperature using the k-type thermocouple with the MAX6675 amplifier. Thermocouples have a wide temperature measurement range and allow you to read very high temperaturesâas high as 1024ÂșC (1875ÂșF) when using k-type thermocouple with MAX6675.
We have tutorials for other popular sensors with the Arduino board that you may like:
- BME680 Environmental Sensor with Arduino (Gas, Temperature, Humidity, Pressure)
- BME280 Sensor with Arduino (Pressure, Temperature, Humidity)
- DS18B20 Temperature Sensor with Arduino
- DHT11/DHT22 Humidity and Temperature Sensor With Arduino
- LM35, LM335 and LM34 Temperature Sensors with Arduino
- HC-SR04 Ultrasonic Sensor with Arduino
- BH1750 Ambient Light Sensor with Arduino
Learn more about the Arduino with our resources:
The MAX6675 TC Amplifier is depreciated and has been replaced by the MAX31855 TC Amplifier! Even more, the MAX31856 universal TC Amplifier can now be used for all different types of TC- Sensors, as eg the versatile type T-TC sensor (copper/konstantan)đ !
All include files are available ! Sara, make a project !
Hi.
Thanks for the info.
But many people can have it, and it is still available for purchase. So, I guess the tutorial is still useful for many people.
I need to order that new one and make a tutorial about that too.
Regards,
Sara
Need Code for MAX31856
Hi Sarah,
I love the tutorials that you and Rui publish (AND I have all your courses – just need time to work through them…)
Like you said, Amazon still has the MAX6675 with the K-Thermocouple (HiLetgo is $7.99 for both and Sainsmart is $13.99 for both), which is less cost than the newer MAX31855 board.
I just ordered a few to play with and Amazon said they would be here in 3 days!
I found the MAX31855 on Adafruit (and several other sites), but Adafruit has not included code for it with the correct libraries.
Also, the thermocouples on Adafruit are not as good as the one you show on your tutorial, which looks like it was maybe the HiLetgo version.
Anyway, thanks very much again!
Joe
Hi.
Here you can find example for the MAX31855: https://github.com/adafruit/Adafruit-MAX31855-library
Thank you for your support.
Regards,
Sara
Hi, thanks for this tutorial. Pls, haven’t you got a version with display to see the values? Thank you.
Hi.
No. At the moment, we only have this version.
Regards,
Sara
Thanks for this!! Finally can use my draw full of the K probes. LoL
Too bad the resolution can’t keep up with my Fluke and Anritsu data collectors.
C loves K. đšđŠ
Hi Sara!
I would like to know if with MAX6675 amplifier can I read -80ÂșC temperatures.
The datasheet says it works between -20 to +85ÂșC but I suppose these conditions are environmental conditions for the amplifier, not for the reading temperature from TC.
Do you know it?
Thank you!
Regards
Hi, I am a little confused as your tutorial has conflicting info i.e. SCK, CS, SO and DO,CS, CLK. Are these the same thing and if so, which maps to which?
Hi Sara,
Thank you very much for the tutorial.
I am a bit of a newbie and have a newbie question. Is it possible to increase the reading frequency of the TC?
In a project I have in mind, I would need to get a reading every 10ms or so (maybe 50ms max).
Thanks in advance,
Jorge
Hi. I want to cite this tutorial in a publication. Is Sara Santos the author? Thanks.
Hi.
Yes, it’s me.
Thanks for referencing our work.
Regards,
Sara
Hi Sara, I am Rustam from Indonesia. Now, I am doing the project data logger thermocouple 12 Channel (Max6675) using microcontroller Arduino Mega 2560. But the accuracy and precision missing.
Thank You
Best Regards.
Hi Sara – I have everything working but want to send the float value from —
thermocouple.readCelsius()
as an MQTT publish — such as —
publisher(“test_out/thermo”, “Read (C): “+thermocouple.readCelsius());
I tried —
//char buffer[10]; -- declared global at the top
String tem = dtostrf(thermocouple.readCelsius(), 5, 2, buffer);
publisher("test_out/thermo", "Read (C): "+buffer);
Throws an error — invalid operands of types ‘const char [12]’ and ‘char [10]’ to binary ‘operator+’
Any ideas or tips? Thanks.
Got it to compile — just declared a string “s” and a float “tempC” and then —
tempC = thermocouple.readCelsius();
publisher("test_out/thermo", s+"Read (C): "+tempC);
Sorry, I am just a beginner on this, but is there not a mistake in this line
int thermoDO = 12;
int thermoCS = 15;
int thermoCLK = 14;
Thnaks
Hi sara
Do you have any cord for R type thomocupel by using K type module.
Because in sri lanka dont have to by R type module .thanks
Hi.
Unfortunately, we don’t have any tutorials using that thermocouple.
Regards,
Sara
Looks like there is a MAX 31855R for R type. But not widely available (looking on US eBay). One from India — https://roboindia.com/store/max-31855-r-type-module-thermocouple — pretty sure there are lots of examples on interfacing to the 31855R — so easy to modify one of your projects.
How long does it take to detect and instantaneous 50 degrees celsius difference?
How can I have temperature below 0 measured and presented. Now the measurement stops at 0. So a temperature below 0 is not presented