How to use 2 MAX6675 Thermocouple k type sensor with 2 or more LCD1602 I2C and Arduino
MAX6675 Thermocouple k type sensor with 2 or more LCD1602 and Arduino
Arduino code to read temperature using MAX6675 chip and k-type thermocouple
and display it on 2 or more LCD1602 I2C display.
If you want to display the temperature for both sensors on the same dispaly, then see the code this page.
Resources for this sketch
- I2C Scanner Code(Code)
- How to set different I2C Address (video)
- MAX6675 k type with Arduino (without display) (video and code)
- MAX6675 k type with Arduino with LCD1602 I2C (video and code)
- MAX6675 with LED and relay explained (Video and Code)
- MAX6675 Datasheet (pdf)
- download library (from Robojax.com)
- Robojax Arduino Course on Udemy
- Get Early Access to my videos via Patreon
// original library source:
// www.ladyada.net/learn/sensors/thermocouple
/*
* Arduino code to read temperature using MAX6675 chip and k-type thermocouple
* and display on 2 or more LCD1602 I2C Displays
*
* Watch video instruction for this code: https://youtu.be/c90NszbNG8c
*
* Download this code from Robojax.com
*
* updated by Ahmad Shamshiri for Robojax.com on Saturday November 24, 2018
* in Ajax, Ontario, Canada
*
You can get the wiring diagram and full explanition from my Arduino Course at Udemy.com
Learn Arduino step by step with all library, codes, wiring diagram all in one place
visit my course now http://robojax.com/L/?id=62
If you found this tutorial helpful, please support me so I can continue creating
content like this. You can support me on Patreon http://robojax.com/L/?id=63
or make donation using PayPal http://robojax.com/L/?id=64
*
* Code is available at http://robojax.com/learn/arduino
* 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/>.
*/
#include "max6675.h"
// start of settings for LCD1602 with I2C
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd1(0x3F, 16, 2);// I2C address is 0x3F
LiquidCrystal_I2C lcd2(0x26, 16, 2);// I2C address is 0x26
// pins for first thermocouple
int so1Pin = 4;// SO1=Serial Out
int cs1Pin = 5;// CS1 = chip select CS pin
int sck1Pin = 6;// SCK1 = Serial Clock pin
// pins for 2nd thermocouple
int so2Pin = 8;// SO1=Serial Out
int cs2Pin = 9;// CS1 = chip select CS pin
int sck2Pin = 10;// SCK1 = Serial Clock pin
MAX6675 thermocouple1(sck1Pin, cs1Pin, so1Pin);// watch video for details
MAX6675 thermocouple2(sck2Pin, cs2Pin, so2Pin);// watch video for details
void setup() {
// Robojax.com Dual display, dual thermocouple 20181122
lcd1.begin();// initialize the LCD1602(LCD1)
lcd1.backlight();// turn the backlight ON for the LCD(LCD1)
lcd2.begin();// initialize the LCD1602 (LCD2)
lcd2.backlight();// turn the backlight ON for the LCD (LCD2)
lcd1.print("Robojax MAX6675");//(LCD1)
lcd1.setCursor(0,1);//(LCD1)
lcd1.print("Thermocouple 1");//(LCD1)
lcd2.print("Robojax MAX6675");//(LCD2)
lcd2.setCursor(0,1);//(LCD2)
lcd2.print("Thermocouple 2");//(LCD2)
Serial.begin(9600);// initialize serial monitor with 9600 baud
Serial.println("Robojax MAX6675");
delay(3000);// give time to user to read the display at the beginning
}
void loop() {
// basic readout test, just print the current temp
Serial.print("C_1 = ");
Serial.print (thermocouple1.readCelsius());
Serial.print(" F_1 = ");
Serial.println(thermocouple1.readFahrenheit());
Serial.print("C_2 = ");
Serial.print (thermocouple2.readCelsius());
Serial.print(" F_2 = ");
Serial.println(thermocouple2.readFahrenheit());
lcd1.clear();// clear previous values from screen (1)
lcd2.clear();// clear previous values from screen (2)
lcd1.setCursor(0,0);// set cursor at character 0, line 0
lcd1.print("Thermocouple-1");
lcd1.setCursor(0,1);// set cursor at character 0, line 1
lcd1.print(thermocouple1.readCelsius()); // print temperature in Celsius
lcd1.setCursor(5,1);// set cursor at character 9, line 1
lcd1.print((char)223);
lcd1.setCursor(6,1);// set cursor at character 9, line 1
lcd1.print("C");
lcd1.setCursor(7,1);// set cursor at character 9, line 1
lcd1.print(" ");
lcd1.setCursor(8,1);// set cursor at character 9, line 1
lcd1.print(thermocouple1.readFahrenheit()); // print temperature in Fahrenheit
lcd1.setCursor(14,1);// set cursor at character 9, line 1
lcd1.print((char)223);
lcd1.setCursor(15,1);// set cursor at character 9, line 1
lcd1.print("F");
lcd2.setCursor(0,0);// set cursor at character 0, line 0
lcd2.print("Thermocouple-2");
lcd2.setCursor(0,1);// set cursor at character 0, line 1
lcd2.print(thermocouple2.readCelsius());// print temperature in Celsius
lcd2.setCursor(5,1);// set cursor at character 9, line 1
lcd2.print((char)223);
lcd2.setCursor(6,1);// set cursor at character 9, line 1
lcd2.print("C");
lcd2.setCursor(7,1);// set cursor at character 9, line 1
lcd2.print(" ");
lcd2.setCursor(8,1);// set cursor at character 9, line 1
lcd2.print(thermocouple2.readFahrenheit()); // print temperature in Fahrenheit
lcd2.setCursor(14,1);// set cursor at character 9, line 1
lcd2.print((char)223);
lcd2.setCursor(15,1);// set cursor at character 9, line 1
lcd2.print("F");
delay(1000);
}