Robojax

Lesson 41: Using two or more MAX6675 K-Type Thermocouple with two or more LCD

Lesson 41: Using two or more MAX6675 K-Type Thermocouple with two or more LCD

Please select other codes for this lecture from the links below.

Related or required files and link to this lesson

Part 4: Temperature Sensors

In this lesson we learn how to use to or more K-Type Thermocouple Sensor with MAX6674 chip to measure temperature and display it on two or more LCD2004 which has only 4 wires. There is separate code to use it for LCD1602 display.


  /*
 * Robojax Arduino Step By Step Course
 * Part 4: Temperature Sensors 
  * Lesson 41-2 Two or more MAX6657 with two or more LCD2004-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 2 or more LCD2004 I2C Displays


  Please watch video instruction here https://youtu.be/TkKPUHMFDiI
 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  

 * Robojax.com 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"

// start of settings for LCD2004 with I2C
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd1(0x3F, 20, 4);// I2C address is 0x3F
LiquidCrystal_I2C lcd2(0x26, 20, 4);// 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 Arduino Step by Step course  http://robojax.com/L/?id=338
  lcd1.begin();// initialize the LCD2004(LCD1)
  lcd1.backlight();// turn the backlight ON for the LCD(LCD1)

  lcd2.begin();// initialize the LCD2004 (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() {
  //Robojax Arduino Step by Step course  http://robojax.com/L/?id=338
  
   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);
//Robojax Arduino Step by Step course  http://robojax.com/L/?id=338   
}