Other Arduino Codes and Videos by Robojax

Using 2 or more K-Type Thermocoupler MAX6675 using ESP32 with Arduino IDE

دروس آردوینو به فارسی

Using 2 or more K-Type Thermocoupler MAX6675 using ESP32 with Arduino IDE

In this tutorial we learn how to use 2 or more 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 single MAX6675 thermocouple sensor with ESP32 See this page
If you need to use MAX6675 thermocouple sensor with ESP32 with bluetooth See this page

  1. MAX6675 Adafruit Library (GetHub)
  2. Preparing your Arduino IDE to work with ESP32
  3. MAX6675 k type with Arduino (without display) (video and code)
  4. MAX6675 k type with Arduino with LCD1602 I2C (video and code)
  5. MAX6675 k type with Arduino (without display)
  6. download MAX6675 Library (from Robojax.com)
  7. Robojax Crash Course on Arduino: Learn Arduino in 30 Minutes (code and video)
  8. Robojax Arduino Course on Udemy
  9. Get Early Access to my videos via Patreon

Arduino code for MAX6675 with ESP32 Bluetooth


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

Related videos:
Introduction to MAX6675 K-Type: https://youtu.be/VGqONmUinqA
Using MAX6675 K-Type thermocouple whit LED display: https://youtu.be/cD5oOu4N_AE
Using MAX6675 K-Type thermocouplewith LCD1602-I2C: https://youtu.be/BlhpktgPdKs
Using 2 or more MAX6675 K-Type thermocouple: https://youtu.be/c90NszbNG8c
Using MAX6675 K-Type with ESP32 over Bluetooth: [this video]
 
 * this code has been downloaded from http://robojax.com/learn/arduino/
 
 * Get this code and other Arduino codes from Robojax.com
Learn Arduino step by step in structured course with all material, wiring diagram and library
all in once place. Purchase My course on Udemy.com http://robojax.com/L/?id=62

****************************
Get early access to my videos via Patreon and have  your name mentioned at end of very 
videos I publish on YouTube here: http://robojax.com/L/?id=63 (watch until end of this video to list of my Patrons)
****************************

or make donation using PayPal http://robojax.com/L/?id=64

 *  * 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 Robojax.com
    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
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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 <https://www.gnu.org/licenses/>.
 */

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

#include "max6675.h"
//Robojax.com  MAX6675 Thermocoupler

//for sensor one
int thermoCLK1 = 12;
int thermoCS1 = 14;
int thermoDO1 = 27;
float tempC1, tempF1, tempK1;

//for sensor 2
int thermoCLK2 = 26;
int thermoCS2 = 25;
int thermoDO2 = 33;
float tempC2, tempF2, tempK2;

//for sensor 3 do as above,define pins

char *titleTemp="Temperature: ";
int type=1;// 1=C, 2=F, 3=K,
MAX6675 thermocouple1(thermoCLK1, thermoCS1, thermoDO1);
MAX6675 thermocouple2(thermoCLK2, thermoCS2, thermoDO3);
//for 3rd MAX6675 thermocouple3(thermoCLK3, thermoCS3, thermoDO3);
/////////////// end of MAX6675 settings



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

}

void loop() {
   getTemp(1);// this reas the temperature for sensor 1
   Serial.println(thermocouple.readCelsius());
  //Robojax.com 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 in sensor 1 do something
    if(tempC1 > 125)
	{
		// do something here
	}

     // if temperature in Celsius is greator thatn 340 in sensor 2 do something
    if(tempC2 > 340)
	{
		// do something here
	}


        delay(300);//change this delay to make it faster or slower. 100 makes it slower 
//Robojax.com 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
 * www.Robojax.com 
 */
void prinTemp(int type, int s)
{

//Robojax.com MAX6675 with ESP32 
      Serial.print(titleTemp);
	  if(s ==1)
	  {
      Serial.print(" Sensor 1: ");	  
			if(type ==1)
			{
			  Serial.print(tempC1);
			  Serial.println("°C");

			}
			if(type ==2)
			{
			  Serial.print(tempF1);
			  Serial.println("°F");

			}
			if(type ==3)
			{

			  Serial.print(tempK1); 
			  Serial.println("°K");

			} 
	  }//sensor 1 end
	  
	  //sensor 2
	  if(s ==2)
	  {
      Serial.print(" Sensor 2: ");	  
			if(type ==1)
			{
			  Serial.print(tempC2);
			  Serial.println("°C");

			}
			if(type ==2)
			{
			  Serial.print(tempF2);
			  Serial.println("°F");

			}
			if(type ==3)
			{

			  Serial.print(tempK2); 
			  Serial.println("°K");

			} 
	  }//sensor 2 end	  
//Robojax.com MAX6675 with ESP32
}//sendTemp ends here



/*
 * @brief returns temperature or relative humidity

 * @return returns one of the values above
 * Usage: getTemp(1) for sensor 1
 * to print it on serial monitor 
 * Written by Ahmad Shamshiri on Mar 30, 2020. 
 * in Ajax, Ontario, Canada
 * www.Robojax.com 
 */
void getTemp(int s)
{
 //Robojax.com with MAX6675 Thermocoupler 
 if(s ==1)
 {
   tempF1 = thermocouple1.readFahrenheit();// Fahrenheit 
   tempK1= thermocouple1.readCelsius() + 273.15;//convert to Kelvin
   tempC1 = thermocouple1.readCelsius();// Celsius
 }
 
 if(s ==2)
 {
   tempF2 = thermocouple2.readFahrenheit();// Fahrenheit 
   tempK2= thermocouple2.readCelsius() + 273.15;//convert to Kelvin
   tempC2 = thermocouple2.readCelsius();// Celsius
 } 
  
 //Robojax.com  MAX6675 Thermocoupler 
}//getTemp
    

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