Dispaly Temperature from MAX6675 using ESP32 over Bluetooth on Mobile phone
Dispaly Temperature from MAX6675 using ESP32 over Bluetooth on Mobile phone
In this tutorial we learn how to use MAX6675 Thermocouple sensor with ESP32 to measure temperature and read it using Bluetooth on mobile phone or tablet devices.
If you need to use MAX6675 thermocouple sensor with ESP32 (no bluetooth) See this page
If you need to use 2 or more MAX6675 thermocouple sensor with ESP32 (no bluetooth) See this page
- MAX6675 Adafruit Library (GetHub)
- Preparing your Arduino IDE to work with ESP32
- MAX6675 k type with Arduino (without display) (video and code)
- MAX6675 k type with Arduino with LCD1602 I2C (video and code)
- MAX6675 k type with Arduino (without display)
- download MAX6675 Library (from Robojax.com)
- Robojax Crash Course on Arduino: Learn Arduino in 30 Minutes (code and video)
- Robojax Arduino Course on Udemy
- Get Early Access to my videos via Patreon
Arduino code for MAX6675 with ESP32 Bluetooth
/*
*
*
* This is Arduino code to Measure Temperature over Bluetooth using
MAX6675 with ESP32 to display on Tablet or mobile device
* Watch video instruction for this code: 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
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
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
#include "BluetoothSerial.h"
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
BluetoothSerial SerialBT;
int inData;
char receivedChar;// received value will be stored as CHAR in this variable
void setup() {
Serial.begin(115200);
SerialBT.begin("ESP32_Robojax"); //Bluetooth device name
Serial.println("The device started, now you can pair it with bluetooth!");
Serial.println("Search for ESP32_Robojax device and Pair your phone to ESP32_Robojax");
//Robojax.com MAX6675 with ESP32 Bluetooth
}
void loop() {
getTemp();
Serial.println(thermocouple.readCelsius());
//Robojax.com MAX6675 with ESP32 Bluetooth
if (Serial.available()) {
// SerialBT.write(Serial.read());
}
while (SerialBT.available() ) {
receivedChar =(char)SerialBT.read();
inData += receivedChar;
if (receivedChar == '
')
{
//SerialBT.print("Received:");// write on BT app
//SerialBT.println(inData);// write on BT app
//Serial.print("Received:");//print on Serial Monitor
// Serial.println(inData); //print on Serial Monitor
type = inData;
sendTemp();
inData = 0; // Clear recieved buffer
}//if (receivedChar
}// while
delay(300);
//Robojax.com MAX6675 with ESP32 Bluetooth
}//loop ends here
void sendTemp()
{
//Robojax.com MAX6675 with ESP32 Bluetooth
SerialBT.print(titleTemp);
if(type ==24)
{
SerialBT.print(tempC);
SerialBT.println("°C");
}
if(type ==25)
{
SerialBT.print(tempF);
SerialBT.println("°F");
}
if(type ==26)
{
SerialBT.print(tempK);
SerialBT.println("°K");
}
//Robojax.com MAX6675 with ESP32 Bluetooth
}//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
* www.Robojax.com
*/
void getTemp()
{
//Robojax.com with MAX6675 Thermocoupler
tempF = thermocouple.readFahrenheit();// Fahrenheit
tempK= thermocouple.readCelsius() + 273.15;//convert to Kelvin
tempC = thermocouple.readCelsius();// Celsius
//Robojax.com MAX6675 Thermocoupler
}//getTemp