change temperature config between 35-40
This commit is contained in:
parent
f4e570e9e8
commit
b3f02bb4a8
|
@ -466,12 +466,7 @@ float getKadarGas() {
|
||||||
|
|
||||||
// konversi tegangan ke persen berdasarkan rumus yang telah ditentukan
|
// konversi tegangan ke persen berdasarkan rumus yang telah ditentukan
|
||||||
float getPersentaseKadarGas(float voltase) {
|
float getPersentaseKadarGas(float voltase) {
|
||||||
// float m = 6.0 / (1.49 / 0.33);
|
float persentase = 0.0448 * voltase - 0.0058;
|
||||||
// float b = -m * 0.33;
|
|
||||||
// float persentase = m * voltase + b;
|
|
||||||
// float hasil = constrain(persentase * 100, 0, 100);
|
|
||||||
|
|
||||||
float persentase = 0.0526 * voltase - 0.0174;
|
|
||||||
float hasil = constrain(persentase * 100, 0, 100);
|
float hasil = constrain(persentase * 100, 0, 100);
|
||||||
|
|
||||||
// float persentase = 0.2043 * pow(voltase, 2.0) + 0.0611 * voltase - 0.0249;
|
// float persentase = 0.2043 * pow(voltase, 2.0) + 0.0611 * voltase - 0.0249;
|
||||||
|
@ -632,7 +627,7 @@ void cekKegagalan() {
|
||||||
regresiKadarGas = regresiKadarGas * 100;
|
regresiKadarGas = regresiKadarGas * 100;
|
||||||
float nilaiPertiga = regresiKadarGas / 3.0;
|
float nilaiPertiga = regresiKadarGas / 3.0;
|
||||||
|
|
||||||
if (lamaJam > 6) {
|
if (lamaJam > 12) {
|
||||||
// jika kadar gas tidak naik secara signifikan
|
// jika kadar gas tidak naik secara signifikan
|
||||||
// if (persentaseKadarGas > (regresiKadarGas + nilaiPertiga) || persentaseKadarGas < (regresiKadarGas - nilaiPertiga)) {
|
// if (persentaseKadarGas > (regresiKadarGas + nilaiPertiga) || persentaseKadarGas < (regresiKadarGas - nilaiPertiga)) {
|
||||||
if (persentaseKadarGas < (regresiKadarGas - nilaiPertiga)) {
|
if (persentaseKadarGas < (regresiKadarGas - nilaiPertiga)) {
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
#define FANPIN 25
|
#define FANPIN 25
|
||||||
#define BUZZERPIN 23
|
#define BUZZERPIN 23
|
||||||
|
|
||||||
#define SUPABASE_URL "https://oxmfbobxmqldgthethlz.supabase.co"
|
// #define SUPABASE_URL "https://oxmfbobxmqldgthethlz.supabase.co"
|
||||||
#define SUPABASE_ANON_KEY "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im94bWZib2J4bXFsZGd0aGV0aGx6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDgwNjQ1NDksImV4cCI6MjAyMzY0MDU0OX0.pTDI9CsiN8wthOWhHjM1dONrRP_Hd7BcbwfKgeKGhtU"
|
// #define SUPABASE_ANON_KEY "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im94bWZib2J4bXFsZGd0aGV0aGx6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDgwNjQ1NDksImV4cCI6MjAyMzY0MDU0OX0.pTDI9CsiN8wthOWhHjM1dONrRP_Hd7BcbwfKgeKGhtU"
|
||||||
|
|
||||||
// #define WIFI_SSID "Vivo Y21c"
|
// #define WIFI_SSID "Vivo Y21c"
|
||||||
// #define WIFI_PASS "12346789"
|
// #define WIFI_PASS "12346789"
|
||||||
|
@ -227,9 +227,13 @@ void setup(){
|
||||||
WIFI_SSID = readFile(ssidPath);
|
WIFI_SSID = readFile(ssidPath);
|
||||||
WIFI_PASS = readFile(passPath);
|
WIFI_PASS = readFile(passPath);
|
||||||
|
|
||||||
|
Serial.println(WIFI_SSID);
|
||||||
|
Serial.println(WIFI_PASS);
|
||||||
|
|
||||||
// inisialisasi LCD
|
// inisialisasi LCD
|
||||||
lcd.init();
|
lcd.init();
|
||||||
lcd.backlight();
|
lcd.backlight();
|
||||||
|
lcd.clear();
|
||||||
|
|
||||||
// inisialisasi DHT22
|
// inisialisasi DHT22
|
||||||
dht.begin();
|
dht.begin();
|
||||||
|
@ -248,6 +252,8 @@ void setup(){
|
||||||
Serial.println("Memuat: " + String(loading) + "%");
|
Serial.println("Memuat: " + String(loading) + "%");
|
||||||
|
|
||||||
lcd.setCursor(0, 0);
|
lcd.setCursor(0, 0);
|
||||||
|
// lcd.print("SSID : " + String(WIFI_SSID));
|
||||||
|
// lcd.setCursor(0, 1);
|
||||||
lcd.print("Memuat : " + String(loading) + "%");
|
lcd.print("Memuat : " + String(loading) + "%");
|
||||||
|
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
@ -319,12 +325,15 @@ void loop(){
|
||||||
// delay(1000);
|
// delay(1000);
|
||||||
// }
|
// }
|
||||||
// } else {
|
// } else {
|
||||||
|
// Serial.println("Gagal terhubung ke " + WIFI_SSID);
|
||||||
|
|
||||||
|
// lcd.clear();
|
||||||
// lcd.setCursor(0, 0);
|
// lcd.setCursor(0, 0);
|
||||||
// lcd.print("Gagal terhubung");
|
// lcd.print("Gagal terhubung");
|
||||||
// lcd.setCursor(0, 1);
|
// lcd.setCursor(0, 1);
|
||||||
// lcd.print("ke jaringan!");
|
// lcd.print("ke " + WIFI_SSID + "!");
|
||||||
|
|
||||||
// Serial.println("Gagal terhubung ke jaringan");
|
// delay(1000);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,19 +373,32 @@ void runFermentasi() {
|
||||||
lcd.print(kelembaban, 1);
|
lcd.print(kelembaban, 1);
|
||||||
lcd.print(" %");
|
lcd.print(" %");
|
||||||
|
|
||||||
// menyalakan lampu jika suhu di bawah 30
|
// bool otomatis = (bool) pengaturan[0]["auto"];
|
||||||
if (suhu <= 30) {
|
// int suhuMin = (int) pengaturan[0]["suhu_min"];
|
||||||
|
// int suhuMax = (int) pengaturan[0]["suhu_max"];
|
||||||
|
|
||||||
|
// pilihan user menghidupkan kontrol otomatis atau manual
|
||||||
|
// if (otomatis) {
|
||||||
|
// menyalakan lampu jika suhu di bawah suhu minimal
|
||||||
|
if (suhu <= 35) {
|
||||||
digitalWrite(LAMPPIN, LOW);
|
digitalWrite(LAMPPIN, LOW);
|
||||||
} else {
|
} else {
|
||||||
digitalWrite(LAMPPIN, HIGH);
|
digitalWrite(LAMPPIN, HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
// menyalakan kipas jika suhu di atas 40
|
// menyalakan kipas jika suhu di atas suhu maximal
|
||||||
if (suhu >= 40) {
|
if (suhu >= 40) {
|
||||||
digitalWrite(FANPIN, LOW);
|
digitalWrite(FANPIN, LOW);
|
||||||
} else {
|
} else {
|
||||||
digitalWrite(FANPIN, HIGH);
|
digitalWrite(FANPIN, HIGH);
|
||||||
}
|
}
|
||||||
|
// } else {
|
||||||
|
// bool lampOn = (bool) pengaturan[0]["lamp_on"];
|
||||||
|
// bool fanOn = (bool) pengaturan[0]["fan_on"];
|
||||||
|
|
||||||
|
// digitalWrite(LAMPPIN, lampOn ? LOW : HIGH);
|
||||||
|
// digitalWrite(FANPIN, fanOn ? LOW : HIGH);
|
||||||
|
// }
|
||||||
|
|
||||||
// menentukan data masuk ke pengujian atau tidak berdasarkan jarak jam
|
// menentukan data masuk ke pengujian atau tidak berdasarkan jarak jam
|
||||||
// long unsigned epochTimeNow = timeClient.getEpochTime();
|
// long unsigned epochTimeNow = timeClient.getEpochTime();
|
||||||
|
@ -446,15 +468,10 @@ float getKadarGas() {
|
||||||
|
|
||||||
// konversi tegangan ke persen berdasarkan rumus yang telah ditentukan
|
// konversi tegangan ke persen berdasarkan rumus yang telah ditentukan
|
||||||
float getPersentaseKadarGas(float voltase) {
|
float getPersentaseKadarGas(float voltase) {
|
||||||
// float m = 6.0 / (1.49 / 0.33);
|
float persentase = 0.0448 * voltase - 0.0058;
|
||||||
// float b = -m * 0.33;
|
|
||||||
// float persentase = m * voltase + b;
|
|
||||||
// float hasil = constrain(persentase * 100, 0, 100);
|
|
||||||
|
|
||||||
float persentase = 0.0526 * voltase - 0.0174;
|
|
||||||
float hasil = constrain(persentase * 100, 0, 100);
|
float hasil = constrain(persentase * 100, 0, 100);
|
||||||
|
|
||||||
// float persentase = 0.1727 * pow(voltase, 2.0) + 0.1805 * voltase - 0.137;
|
// float persentase = 0.2043 * pow(voltase, 2.0) + 0.0611 * voltase - 0.0249;
|
||||||
// float hasil = constrain(persentase * 100, 0, 100);
|
// float hasil = constrain(persentase * 100, 0, 100);
|
||||||
|
|
||||||
return hasil;
|
return hasil;
|
||||||
|
|
Loading…
Reference in New Issue