Simulasi Autoclave Arduino Sensor MPX5500 dan Thermocouple Tipe-K
Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang berfungsi untuk memanaskan benda di suhu tertentu agar bersih dari kuman atau bakteri, jadi alat ini terdapat dua sensor yaitu sensor suhu dan sensor tekanan. yang dimonitor adalah suhunya terlebih dahulu kemudian tekanannya dalam satuan bar. untuk lebih jelasnya berikut koding dan kompoennya.
a. Komponen
b. Program Arduino IDE
#include <Wire.h>
#include <max6675.h>
#include <LiquidCrystal_I2C.h>
#include <DS3231.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int thermoDO = 4; //bisa juga S0
int thermoCS = 5;
int thermoCLK = 6; //bisa juga SCK
int dataku;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
int solenoid = 7;
int heater = 8;
int btset = 12;
int btsetx;
int sp = 125;
int mark;
int buzzer = 9;
int sensorValue;
float sensorVoltage;
float kPa;
float bar;
DS3231 rtc(SDA, SCL);
Time t;
void setup() {
lcd.begin();
lcd.noCursor();
lcd.clear();
Serial.begin(9600);
rtc.begin();
rtc.setDOW(FRIDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(0, 0, 0); // Set the time to 12:00:00 (24hr format)
rtc.setDate(13, 5, 2022); // Set the date to January 1st, 2014
pinMode(btset,INPUT_PULLUP);
pinMode(solenoid,OUTPUT);
pinMode(heater,OUTPUT);
pinMode(buzzer,OUTPUT);
digitalWrite(solenoid,HIGH); //OFF
digitalWrite(heater,LOW);
digitalWrite(buzzer,HIGH); //OFF
delay(500);
}
void loop() {
sensorValue = analogRead(A0);
sensorVoltage = sensorValue * (5.0 / 1023.0);
// convert the reading to it’s PSI equivilant [(Vout = Vs*(0.0018*P+0.04)), (Vs = 5.0Vdc)]
// thus: P= (-V+0.2)/0.009 (kPa)
kPa = (sensorVoltage - 0.2) / 0.009;
bar = kPa / 100.0;
dataku = thermocouple.readCelsius();
btsetx = digitalRead(btset);
if(btsetx == 0){
mark = 1;
lcd.setCursor(10, 1);
lcd.print("ON");
}
lcd.setCursor(0, 0);
lcd.print("T=");
lcd.print(dataku);
lcd.print(" ");
lcd.print("P=");
lcd.print(bar);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print("SP=");
lcd.print(sp);
lcd.print(" ");
if((dataku < sp)&&(mark == 1)){
digitalWrite(heater,HIGH);
}
if((dataku >= sp)&&(mark == 1)){
lcd.clear();
delay(2000);
rtc.setTime(0, 29, 0);
mulai();
pendinginan();
}
delay(200);
}
void pendinginan(){
sensorValue = analogRead(A0);
sensorVoltage = sensorValue * (5.0 / 1023.0);
// convert the reading to it’s PSI equivilant [(Vout = Vs*(0.0018*P+0.04)), (Vs = 5.0Vdc)]
// thus: P= (-V+0.2)/0.009 (kPa)
kPa = (sensorVoltage - 0.2) / 0.009;
bar = kPa / 100.0;
digitalWrite(heater,LOW); //OFF
lcd.setCursor(0, 0);
lcd.print("Pendinginan");
lcd.setCursor(0, 1);
lcd.print("P= ");
lcd.print(bar);
lcd.print(" ");
if(bar < 0.1){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("SOLENOID ON");
digitalWrite(solenoid,LOW); //ON solenoid
delay(10000);
digitalWrite(solenoid,HIGH); //OFF solenoid
digitalWrite(heater,LOW); //OFF
mark = 0;
return;
}
delay(200);
pendinginan();
}
void mulai(){
t = rtc.getTime();
sensorValue = analogRead(A0);
sensorVoltage = sensorValue * (5.0 / 1023.0);
// convert the reading to it’s PSI equivilant [(Vout = Vs*(0.0018*P+0.04)), (Vs = 5.0Vdc)]
// thus: P= (-V+0.2)/0.009 (kPa)
kPa = (sensorVoltage - 0.2) / 0.009;
bar = kPa / 100.0;
dataku = thermocouple.readCelsius();
lcd.setCursor(0, 0);
lcd.print("T=");
lcd.print(dataku);
lcd.print(" ");
lcd.print("P=");
lcd.print(bar);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print("SP=");
lcd.print(sp);
lcd.print(" ");
lcd.print(t.hour);
lcd.print(":");
lcd.print(t.min);
lcd.print(":");
lcd.print(t.sec);
lcd.print(" ");
if(dataku < sp){
digitalWrite(heater,HIGH);
}
if(dataku >= sp){
digitalWrite(heater,LOW);
}
if(t.min == 30){
lcd.clear();
digitalWrite(buzzer,LOW); //ON
delay(3000);
digitalWrite(buzzer,HIGH); //OFF
return;
}
delay(200);
mulai();
}
c. VIDEO HASILNYA
No comments:
Post a Comment