How to Use Two MAX6675 K-Type Thermocouple Sensors with One LCD1602 and an Arduino
Arduino code to read temperature using two MAX6675 chips and K-type thermocouples and display on one LCD1602 I2C display. If you want to use one display for each sensor, then see the code on this page.
174-How to use two MAX6675 K-type thermocouple sensors with one LCD1602 and an Arduino
Язык: C++
// Original library source:
// www.ladyada.net/learn/sensors/thermocouple
/*
* Arduino code to read temperature using two MAX6675 chips and K-type thermocouples
* and display on one LCD1602 I2C display
*
* Watch video instructions 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 February 2, 2021, on request of Raphael M. under https://youtu.be/c90NszbNG8c
*
You can get the wiring diagram and full explanation from my Arduino Course at Udemy.com.
Learn Arduino step by step with all libraries, codes, and wiring diagrams 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 a 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 downloaded 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 Thermocouples");//(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);
}
Ресурсы и ссылки
-
ВнешнийMAX6675 технический паспорт (PDF)datasheets.maximintegrated.com
-
Внешний
-
Внутренний
Файлы📁
Нет доступных файлов.