Translate

ARDUINO Monitoring 5 SUHU Thermocouple Tipe K DATALOGGER EEPROM (Multiple Sensor)

ARDUINO Monitoring 5 SUHU Thermocouple Tipe K DATALOGGER EEPROM (Multiple Sensor)


           Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang berfungsi untuk memonitor suhu menggunakan sensor thermocouple sebanyak 5 buah dan dimonitoring secara bersamaan. alat ini menggunakan sistem penyimpanan EEPROM sebagai dataloggernya dan juga terdapat tombol konversi yang dapat merubah dari celsius ke reamur ataupun ke kelvin atau fahrenheit. untuk lebih jelasnya berikut adalah komponen dan programnya,



a. Arduino Uno




b. Sensor Thermocouple Tipe K (5 pcs)




c. LCD + I2C






d. Program Arduino IDE

#include <max6675.h> 
#include <EEPROM.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>

int thermoS01 = 6; //bisa juga S0
int thermoCS1 = 7;
int thermoCLK1 = 3; //bisa juga SCK
int thermoS02 = 6; //bisa juga S0
int thermoCS2 = 8;
int thermoCLK2 = 3; //bisa juga SCK
int thermoS03 = 6; //bisa juga S0
int thermoCS3 = 9;
int thermoCLK3 = 3; //bisa juga SCK
int thermoS04 = 6; //bisa juga S0
int thermoCS4 = 10;
int thermoCLK4 = 3; //bisa juga SCK
int thermoS05 = 6; //bisa juga S0
int thermoCS5 = 11;
int thermoCLK5 = 3; //bisa juga SCK
MAX6675 thermo1(thermoCLK1,thermoCS1,thermoS01);
MAX6675 thermo2(thermoCLK2,thermoCS2,thermoS02);
MAX6675 thermo3(thermoCLK3,thermoCS3,thermoS03);
MAX6675 thermo4(thermoCLK4,thermoCS4,thermoS04);
MAX6675 thermo5(thermoCLK5,thermoCS5,thermoS05);
#include <SPI.h>
#include <SD.h>

int mark = 0;

int addr1 = 0;
int addr2 = 1;
int addr3 = 2;
int addr4 = 3;
int addr5 = 4;
int addr6 = 5;
int addr7 = 6;
int addr8 = 7;
int addr9 = 8;
int addr10 = 9;

LiquidCrystal_I2C lcd(0x27, 20,4);
uint8_t degree[8]  = {140, 146, 146, 140, 128, 128, 128, 128}; // untuk membuat simbol derajat

int btsave = 10;
int btkonv = 9;
int btmemori = 11;

int btsavex = 0;
int btkonvx = 0;
int btmemorix = 0;

float val1;
float val2;
float val3;
float val4;
float val5;
int hitung;

float simpan1;
float simpan2;
float simpan3;
float simpan4;
float simpan5;
float simpan6;
float simpan7;
float simpan8;
float simpan9;
float simpan10;



void setup() {
  pinMode(btsave,INPUT);
  pinMode(btkonv,INPUT);
  pinMode(btmemori,INPUT);
 
  lcd.begin();

  lcd.noCursor();
  lcd.clear();
  //lcd.init();
  lcd.setBacklight(HIGH);
  lcd.createChar(0, degree);
 
  delay(1000);
  lcd.noCursor();
  lcd.clear();
  //lcd.init();
  lcd.setBacklight(HIGH);
  lcd.createChar(0, degree);
  lcd.clear();
 delay(1000);
}

void loop()
{  
 
     val1 = thermo1.readCelsius();
     val2 = thermo2.readCelsius();
     val3 = thermo3.readCelsius();
     val4 = thermo4.readCelsius();
     val5 = thermo5.readCelsius();
   
  //celcius
  if(mark == 0){
      //lcd.clear();// clear previous values from screen (1)
      lcd.setCursor(0,0);// set cursor at character 0, line 0      
      lcd.print("T1:");
      lcd.setCursor(3,0);// set cursor at character 0, line 1
      lcd.print(thermo1.readCelsius()); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(8,0);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(11,0);// set cursor at character 0, line 0      
      lcd.print("T2:");
      lcd.setCursor(14,0);// set cursor at character 0, line 1
      lcd.print(thermo2.readCelsius()); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(19,0);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(8,1);// set cursor at character 0, line 0      
      lcd.print("T3:");
      lcd.setCursor(11,1);// set cursor at character 0, line 1
      lcd.print(thermo3.readCelsius()); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(16,1);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(0,2);// set cursor at character 0, line 0      
      lcd.print("T4:");
      lcd.setCursor(3,2);// set cursor at character 0, line 1
      lcd.print(thermo4.readCelsius()); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(8,2);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(11,2);// set cursor at character 0, line 0      
      lcd.print("T5:");
      lcd.setCursor(14,2);// set cursor at character 0, line 1
      lcd.print(thermo5.readCelsius()); // print temperature in Celsius
      lcd.print(" ");     
      lcd.setCursor(19,2);// set cursor at character 9, line 1
      lcd.setCursor(0,3);
      lcd.print("Celsius          "); 
  }             


  //reamur
  if(mark == 1){
      //lcd.clear();// clear previous values from screen (1)
      lcd.setCursor(0,0);// set cursor at character 0, line 0      
      lcd.print("T1:");
      lcd.setCursor(3,0);// set cursor at character 0, line 1
      lcd.print(thermo1.readCelsius() * 0.8); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(8,0);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(11,0);// set cursor at character 0, line 0      
      lcd.print("T2:");
      lcd.setCursor(14,0);// set cursor at character 0, line 1
      lcd.print(thermo2.readCelsius() * 0.8); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(19,0);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(8,1);// set cursor at character 0, line 0      
      lcd.print("T3:");
      lcd.setCursor(11,1);// set cursor at character 0, line 1
      lcd.print(thermo3.readCelsius() * 0.8); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(16,1);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(0,2);// set cursor at character 0, line 0      
      lcd.print("T4:");
      lcd.setCursor(3,2);// set cursor at character 0, line 1
      lcd.print(thermo4.readCelsius() * 0.8); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(8,2);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(11,2);// set cursor at character 0, line 0      
      lcd.print("T5:");
      lcd.setCursor(14,2);// set cursor at character 0, line 1
      lcd.print(thermo5.readCelsius() * 0.8); // print temperature in Celsius
      lcd.print(" ");     
      lcd.setCursor(19,2);// set cursor at character 9, line 1
      lcd.setCursor(0,3);
      lcd.print("Reamur           "); 
  }             


  //Fahrenheit
  if(mark == 2){
      //lcd.clear();// clear previous values from screen (1)
      lcd.setCursor(0,0);// set cursor at character 0, line 0      
      lcd.print(" T1:");
      lcd.setCursor(4,0);// set cursor at character 0, line 1
      lcd.print(thermo1.readCelsius() * 1.8 + 32); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(8,0);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(11,0);// set cursor at character 0, line 0      
      lcd.print("T2:");
      lcd.setCursor(14,0);// set cursor at character 0, line 1
      lcd.print(thermo2.readCelsius() * 1.8 + 32); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(19,0);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(8,1);// set cursor at character 0, line 0      
      lcd.print("T3:");
      lcd.setCursor(11,1);// set cursor at character 0, line 1
      lcd.print(thermo3.readCelsius() * 1.8 + 32); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(16,1);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(0,2);// set cursor at character 0, line 0      
      lcd.print("T4:");
      lcd.setCursor(3,2);// set cursor at character 0, line 1
      lcd.print(thermo4.readCelsius() * 1.8 + 32); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(8,2);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(11,2);// set cursor at character 0, line 0      
      lcd.print("T5:");
      lcd.setCursor(14,2);// set cursor at character 0, line 1
      lcd.print(thermo5.readCelsius() * 1.8 + 32); // print temperature in Celsius
      lcd.print(" ");     
      lcd.setCursor(19,2);// set cursor at character 9, line 1
      lcd.setCursor(0,3);
      lcd.print("Fahrenheit           "); 
  }             



  //Kelvin
  if(mark == 3){
      //lcd.clear();// clear previous values from screen (1)
      lcd.setCursor(0,0);// set cursor at character 0, line 0      
      lcd.print("T1:");
      lcd.setCursor(3,0);// set cursor at character 0, line 1
      lcd.print(thermo1.readCelsius() * 1.8 + 32); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(8,0);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(11,0);// set cursor at character 0, line 0      
      lcd.print("T2:");
      lcd.setCursor(14,0);// set cursor at character 0, line 1
      lcd.print(thermo2.readCelsius() * 1.8 + 32); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(19,0);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(8,1);// set cursor at character 0, line 0      
      lcd.print("T3:");
      lcd.setCursor(11,1);// set cursor at character 0, line 1
      lcd.print(thermo3.readCelsius() * 1.8 + 32); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(16,1);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(0,2);// set cursor at character 0, line 0      
      lcd.print("T4:");
      lcd.setCursor(3,2);// set cursor at character 0, line 1
      lcd.print(thermo4.readCelsius() * 1.8 + 32); // print temperature in Celsius
      lcd.print(" ");
      lcd.setCursor(8,2);// set cursor at character 9, line 1
      //lcd.print("C");   

      lcd.setCursor(11,2);// set cursor at character 0, line 0      
      lcd.print("T5:");
      lcd.setCursor(14,2);// set cursor at character 0, line 1
      lcd.print(thermo5.readCelsius() * 1.8 + 32); // print temperature in Celsius
      lcd.print(" ");     
      lcd.setCursor(19,2);// set cursor at character 9, line 1
      lcd.setCursor(0,3);
      lcd.print("Fahrenheit"); 
  }             
   
   delay(1000);

btsavex = digitalRead(btsave);
btkonvx = digitalRead(btkonv);
btmemorix = digitalRead(btmemori);



if(btmemorix == 1){
delay(200);
lcd.clear();
simpan1 = EEPROM.read(addr1);
simpan2 = EEPROM.read(addr2);
simpan3 = EEPROM.read(addr3);
simpan4 = EEPROM.read(addr4);
simpan5 = EEPROM.read(addr5);
simpan6 = EEPROM.read(addr6);
simpan7 = EEPROM.read(addr7);
simpan8 = EEPROM.read(addr8);
simpan9 = EEPROM.read(addr9);
simpan10 = EEPROM.read(addr10);

lcd.setCursor(0,0);
lcd.print("T1/6= ");
lcd.print(simpan1);
lcd.print("/");
lcd.print(simpan6);
lcd.print("    ");

lcd.setCursor(0,1);
lcd.print("T2/7= ");
lcd.print(simpan2);
lcd.print("/");
lcd.print(simpan7);
lcd.print("    ");

lcd.setCursor(0,2);
lcd.print("T3/8= ");
lcd.print(simpan3);
lcd.print("/");
lcd.print(simpan8);
lcd.print("    ");

lcd.setCursor(0,3);
lcd.print("T4/9= ");
lcd.print(simpan4);
lcd.print("/");
lcd.print(simpan9);
lcd.print("    ");

delay(5000);
lcd.clear();

lcd.setCursor(0,0);
lcd.print("T5/10= ");
lcd.print(simpan5);
lcd.print("/");
lcd.print(simpan10);
lcd.print("    ");

delay(5000);
lcd.clear();


}


if((btsavex == 1)&&(hitung == 0)){
   EEPROM.write(addr1, val1);
   EEPROM.write(addr2, val2);
   EEPROM.write(addr3, val3);
   EEPROM.write(addr4, val4); 
   EEPROM.write(addr5, val5);
 hitung = 1;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("SAVING 1");
delay(3000);
lcd.clear();
btsavex = 0;
 }


if((btsavex == 1)&&(hitung == 1)){
   EEPROM.write(addr6, val1);
   EEPROM.write(addr7, val2);
   EEPROM.write(addr8, val3);
   EEPROM.write(addr9, val4);
   EEPROM.write(addr10, val5);
hitung = 0;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("SAVING 2");
delay(3000);
lcd.clear();
btsavex = 0;  
}


if(btkonvx == 1){
delay(200);
  mark++;
}

if(mark > 3){
mark = 0;
}


}






e. Cara Menjalankan Alat

       Cara menjalankan alat ini yang pertama yaitu hubungkan alat dengan power supply atau adaptor kemudian pastikan semua komponen sudah terpasang secara tepat, untuk pin arduino yang terhubung ke sensor bisa dilihat pada program di bagian atas. selanjutnya tekan tombol untuk konversi, simpan data ke EEPROM dan baca data yang ada di EEPROM.








No comments:

Post a Comment