Monitor Suhu dan PH serta Turbidity Kolam Ikan dan juga Fitur Pakan Otomatis via BLYNK 2.0 ESP32
Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat memonitor PH dan suhu air serta turbidity air pada kolam ikan, alat ini juga terdapat fitur yaitu jika pada jam yang telah ditentukan maka motor atau relay akan membuka pakan sehingga akan memberikan pakan otomatis di jam tertentu. untuk lebih jelasnya berikut adalah komponen dan kodingnya.
a. Komponen
b. Program Arduino IDE
#define BLYNK_TEMPLATE_ID "TMPL6URGWCTpo"
#define BLYNK_TEMPLATE_NAME "monitor kolam ikan"
#define BLYNK_AUTH_TOKEN "gR-atiO8n1ckW8NInocGTRkbKJpG4Ufe"
#define BLYNK_PRINT Serial
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
#include "RTClib.h"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#define ONE_WIRE_BUS 32
RTC_DS3231 rtc;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
LiquidCrystal_I2C lcd(0x27,16,2);
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
int jampagi,jamsiang,jamsore;
float TempC;
float pHValue;
int tds;
int adctds;
int adcPH;
int TempCx;
int pHValuex;
int ntux;
float ntufix;
int tanda = 0;
int kolam;
int tinggipakan;
int relayout = 25;
int relayout2 = 26;
int Secs;
int Minutes;
int Hours;
int motor;
BlynkTimer timer;
char ssid[] = "hotspothpku";
char pass[] = "123456789";
void sendSensor()
{
Blynk.virtualWrite(V0, pHValue);
Blynk.virtualWrite(V1, tds);
Blynk.virtualWrite(V2, TempC);
Blynk.virtualWrite(V3, motor);
delay(1000);
}
void setup(){
pinMode(relayout,OUTPUT);
digitalWrite(relayout,HIGH);
Wire.begin();
sensors.begin();
Serial.begin(9600);
lcd.begin();
lcd.clear();
rtc.begin();
rtc.adjust(DateTime(0, 0, 0, 6, 59, 50));
//rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
timer.setInterval(1000L, sendSensor);
}
void loop(){
DateTime now = rtc.now();
Secs = now.second();
Hours = now.hour();
Minutes = now.minute();
adcPH = analogRead(34);
pHValue = (adcPH - 936.84) / 100.283;
adctds = analogRead(35);
tds = map(adctds, 4095, 50, 0, 1000);
sensors.requestTemperatures();
TempC = sensors.getTempCByIndex(0); // Celcius
if((Hours == 7)&&(tanda == 0)){
tanda = 1;
Blynk.logEvent("jam_makan_ikan");
}
if ((Hours == 13)&&(tanda == 1)){
tanda = 2;
Blynk.logEvent("jam_makan_ikan");
}
if ((Hours == 19)&&(tanda == 2)){
tanda = 0;
Blynk.logEvent("jam_makan_ikan");
}
if((pHValue > 6.5)&&(pHValue < 8.5)){
digitalWrite(relayout,HIGH);
}
if(pHValue < 6.5){
digitalWrite(relayout,LOW);
motor++;
Blynk.logEvent("kondisi_ph");
}
if(pHValue > 8.5){
digitalWrite(relayout,LOW);
Blynk.logEvent("kondisi_ph");
motor++;
}
if(tds > 500){
digitalWrite(relayout,LOW);
Blynk.logEvent("kondisi_tds");
motor++;
}
if(tds < 500){
digitalWrite(relayout,HIGH);
}
if((TempC > 25)&&(TempC < 30)){
digitalWrite(relayout,HIGH);
}
if(TempC < 25){
digitalWrite(relayout,LOW);
Blynk.logEvent("SUHU KURANG");
motor++;
}
if(TempC > 30){
digitalWrite(relayout,LOW);
Blynk.logEvent("SUHU LEBIH");
motor++;
}
lcd.setCursor(0,0);
lcd.print("P/T:");
lcd.print(pHValue);
lcd.print("/");
lcd.print(tds);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("T:");
lcd.print(TempC,1);
lcd.print(" ");
lcd.print(Hours);
lcd.print(":");
lcd.print(Minutes);
lcd.print(":");
lcd.print(Secs);
lcd.print(" ");
Blynk.run();
timer.run();
delay(200);
}
c. VIDEO HASILNYA
No comments:
Post a Comment