Related or required files and link to this lesson
Lesson 40: Using MAX6675 K-Type Thermocouple with LCD
Lesson 40: Using MAX6675 K-Type Thermocouple with LCD
Please select other codes for this lecture from the links below.
Part 4: Temperature Sensors
In this lesson we learn how to use K-Type Thermocouple Sensor with MAX6674 chip to measure temperature and display it on LCD1602 which has only 4 wires. There is separate code to use it for LCD2004 display.
/*
* Robojax Arduino Step By Step Course
* Part 4: Temperature Sensors
* Lesson 40-1 MAX6657 with LCD1602-I2C
*
// original library source:
// www.ladyada.net/learn/sensors/thermocouple
/*
* Arduino code to read temperature using MAX6675 chip and k-type thermocouple
* and display on LCD1602 I2C Display
*
Please watch video instruction here https://youtu.be/RjzQ4juXgoA
This code is available at http://robojax.com/course1/?vid=lecture37
with over 100 lectures Free On YouTube Watch it here http://robojax.com/L/?id=338
Get the code for the course: http://robojax.com/L/?id=339
* on Saturday November 24, 2018
* in Ajax, Ontario, Canada
*
* This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.*
* 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"// this file is part of the library. See video for details
// start of settings for LCD1602 with I2C
#include <Wire.h>
#include <LiquidCrystal_I2C.h>// this file is part of the library. See video for details
// Set the LCD address to 0x3F for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x3F, 16, 2);
// end of settings for LCD1602 with I2C
int soPin = 4;// SO=Serial Out
int csPin = 5;// CS = chip select CS pin
int sckPin = 6;// SCK = Serial Clock pin
MAX6675 thermocouple(sckPin, csPin, soPin);
void setup() {
// Robojax.com Code YouTube Watch it here http://robojax.com/L/?id=338
lcd.begin();// initializ the LCD1602
lcd.backlight();// turn the backlight ON for the LCD
lcd.print("Robojax MAX6675");
lcd.setCursor(0,1);
lcd.print("Thermocouple");
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
// Robojax.com MAX6675 video with LCD1602 20181124
}
void loop() {
// Robojax.com Code YouTube Watch it here http://robojax.com/L/?id=338
Serial.print("C = ");
Serial.println(thermocouple.readCelsius());
Serial.print("F = ");
Serial.println(thermocouple.readFahrenheit());
lcd.clear();// clear previous values from screen
lcd.setCursor(0,0);// set cursor at character 0, line 0
lcd.print("Temperature");
lcd.setCursor(0,1);// set cursor at character 0, line 1
lcd.print(thermocouple.readCelsius());
lcd.setCursor(5,1);// set cursor at character 9, line 1
lcd.print((char)223);
lcd.setCursor(6,1);// set cursor at character 9, line 1
lcd.print("C");
lcd.setCursor(7,1);// set cursor at character 9, line 1
lcd.print(" ");
lcd.setCursor(8,1);// set cursor at character 9, line 1
lcd.print(thermocouple.readFahrenheit()); // print temperature in ahrenheit
lcd.setCursor(14,1);// set cursor at character 9, line 1
lcd.print((char)223);
lcd.setCursor(15,1);// set cursor at character 9, line 1
lcd.print("F");
// Robojax.com Code YouTube Watch it here http://robojax.com/L/?id=338
delay(1000);
}