How to use 2 MAX6675 Thermocouple k type sensors with one LCD1602 and Arduino
How to use 2 MAX6675 Thermocouple k type sensors with one LCD1602 and Arduino
Arduino code to read temperature using 2 MAX6675 chip and k-type thermocouple
and display ONE LCD1602 I2C display.
If you want to use one display for each sensor, 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 2 MAX6675 chip and k-type thermocouple
* and display on ONE LCD1602 I2C Display
*
* 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
Updated on Feb 02, 2021 on request of Raphael M. under https://youtu.be/c90NszbNG8c
*
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
// 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("2 Thermocouple3");//(LCD1)
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
//see video for details https://youtu.be/c90NszbNG8c
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 1
lcd1.print("Tmp-1: ");
lcd1.setCursor(8,0);// set cursor at character 8, line 1
lcd1.print(thermocouple1.readCelsius()); // print temperature in Celsius for thermocouple1
lcd1.setCursor(13,0);// set cursor at character 13, line 1
lcd1.print((char)223);
lcd1.print("C");
lcd1.setCursor(0,0);// set cursor at character 0, line 2
lcd1.print("Tmp-1: ");
lcd1.setCursor(8,0);// set cursor at character 8, line 2
lcd1.print(thermocouple1.readCelsius()); // print temperature in Celsius for thermocouple1
lcd1.setCursor(13,0);// set cursor at character 13, line 2
lcd1.print((char)223);
lcd1.print("C");
delay(1000);
}