Using K-Type Thermocoupler MAX6675 using ESP32 with Arduino IDE

Project Video
Project Details

In this tutorial we learn how to use MAX6675 Thermocouple sensor with ESP32 to measure temperature and read it on serial monitor of your computer or do take action.
If you need to use 2 or more MAX6675 thermocouple sensor with ESP32 (no bluetooth) See this page
If you need to use MAX6675 thermocouple sensor with ESP32 with bluetooth See this page

Project Code

 * This is Arduino code to Measure Temperature 
 MAX6675 with ESP32 print on the serial monitor
 * Watch video instruction for wriring 0nly:
 * Written/updated by Ahmad Shamshiri for Robojax Video channel
 * Date: July 08, 2020, in Ajax, Ontario, Canada
 updated on Feb 05, 2021

Related videos:
Introduction to MAX6675 K-Type:
Using MAX6675 K-Type thermocouple whit LED display:
Using MAX6675 K-Type thermocouplewith LCD1602-I2C:
Using 2 or more MAX6675 K-Type thermocouple:
Using MAX6675 K-Type with ESP32 over Bluetooth: [this video]
 * this code has been downloaded from
 * Get this code and other Arduino codes from
Learn Arduino step by step in structured course with all material, wiring diagram and library
all in once place. Purchase My course on

Get early access to my videos via Patreon and have  your name mentioned at end of very 
videos I publish on YouTube here: (watch until end of this video to list of my Patrons)

or make donation using PayPal

 *  * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
 * This code has been download from
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see .

///////// Start of MAX6675 settings

#include "max6675.h"
//  MAX6675 Thermocoupler

int thermoCLK = 12;
int thermoCS = 14;
int thermoDO = 27;
float tempC, tempF, tempK;
char *titleTemp="Temperature: ";
int type=1;// 1=C, 2=F, 3=K,
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
/////////////// end of MAX6675 settings

void setup() {
  Serial.println("Robojax MAX6675 with ESP32");
  Serial.println("to read temperature");  
	  // MAX6675 with ESP32 (without bluetooth)


void loop() {
   getTemp();// this reas the temperature
  // MAX6675 with ESP32

    prinTemp(1);//print temperature in Celsius
    prinTemp(2);//print temperature in Fahrenheit
    prinTemp(3);//print temperature in Kelvin	

     // if temperature in Celsius is greator thatn 125 do something
    if(tempC > 125)
		// do something here

        delay(300);//change this delay to make it faster or slower. 100 makes it slower 
// MAX6675 with ESP32 
}//loop ends here

 * @brief prints temperature

 * @return returns none
 * Usage: to get Fahrenheit type: prinTemp(1), prinTemp(2), prinTemp(3)
 1-Celsius prinTemp(1)
 2-Fahrenheit  prinTemp(2)
 3-Kelvin prinTemp(3)
 * to print it on serial monitor
 * Written by Ahmad Shamshiri on Feb 05, 2021
 * in Ajax, Ontario, Canada
void prinTemp(int type)

// MAX6675 with ESP32 
    if(type ==1)

    if(type ==2)

    if(type ==3)


// MAX6675 with ESP32
}//sendTemp ends here

 * @brief returns temperature or relative humidity

 * @return returns one of the values above
 * Usage: to get Fahrenheit type: getTemp('F')
 * to print it on serial monitor Serial.println(getTemp('F'));
 * Written by Ahmad Shamshiri on Mar 30, 2020. 
 * in Ajax, Ontario, Canada
void getTemp()
 // with MAX6675 Thermocoupler 

   tempF = thermocouple.readFahrenheit();// Fahrenheit 
   tempK= thermocouple.readCelsius() + 273.15;//convert to Kelvin
   tempC = thermocouple.readCelsius();// Celsius
 //  MAX6675 Thermocoupler 

If you found this Arduino course helpful, please support me so I can continue creating content like this. support me via PayPal