Translate

Alat Pendeteksi Arus Bocor (Deteksi Arus Bocor) ESP32 Sensor PZEM-004t dan IOT Thingspeak

Alat Pendeteksi Arus Bocor (Deteksi Arus Bocor) ESP32 Sensor PZEM-004t dan IOT Thingspeak


       Pada kesempatan kali ini saya akan menjelaskan mengenai bagimana cara membuat sebuah alat yang dapat digunakan untuk mendeteksi kebocoran arus, dikarenakan kebocoran arus sangat berbahaya dan merugikan, salah satunya yaitu dapat mengakibatkan biaya jadi besar dan jika arus bocornya lumayan besar maka akan mengakibatkan kesetrum jika terkena aliran arus tersebut, untuk itu perlu dipakaikan alat untuk memonitornya. untuk lebih jelasnya berikut adalah koding dan skemanya.


a. Komponen dan Skema

1. ESP32
2. PZEM-004t
3. LCD 2x4 I2C
4. Buzzer
5. Led
6. SSR DC AC
7. Push Button




b. Program Arduino IDE

#include <Wire.h>
#include <HardwareSerial.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <PZEM004Tv30.h>
#include <LiquidCrystal_I2C.h> 
#define RXD2 16
#define TXD2 17

LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 20 chars and 4 line display
 
PZEM004Tv30 pzem(&Serial);  //(RX,TX) connect to TX,RX of PZEM
PZEM004Tv30 pzem2(&Serial2);  //(RX,TX) connect to TX,RX of PZEM

float voltage;
float current1;
float power;
float energy;
float biaya; 
float voltage2;
float current2;
float energy2;
int buzzer = 19;
int btreset = 35;
int ledmerah = 26;
int ledhijau = 25;
int ssr = 27;
float selisih;
int btresetx;

WiFiClient client;
// ThingSpeak Settings
String apiKey = "GHJ754DGHBN87GJ7";
const char *ssid = "hotspothpku";
const char *pass = "123456789";
const char* server = "api.thingspeak.com";
const char* resource = "/update?api_key=";

void setup() {

 //setting ke online
  Serial.println("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED){\
    delay(200);
    Serial.println(".");
    }
  Serial.println("");
  Serial.println("WiFi connected");

  Serial.begin(9600); 
  Serial2.begin(9600);
  lcd.begin();  
  lcd.clear();
  lcd.noCursor();  
  pinMode(buzzer,OUTPUT);
  pinMode(btreset,INPUT);
  pinMode(ledmerah,OUTPUT);
  pinMode(ledhijau,OUTPUT);
  pinMode(ssr,OUTPUT);
  digitalWrite(ssr,HIGH); //LITRIK AC NYALA
}

void loop() {

btresetx = digitalRead(btreset);

if(btresetx == 0){
  digitalWrite(ssr,HIGH); //LITRIK AC NYALA
  delay(1000);  
}
 
voltage = pzem.voltage();
current1 = pzem.current();
energy = pzem.energy();
power = pzem.power();
biaya = energy * 1350;
current2 = pzem2.current();

if(current1 == current2){
  digitalWrite(buzzer,HIGH);
  digitalWrite(ledmerah,LOW);
  digitalWrite(ledhijau,HIGH); 
  digitalWrite(ssr,HIGH);  
}

if(current1 > current2){
  selisih = current1 - current2;

/*
if((selisih > 0.00)&&(selisih < 0.01 )){
  digitalWrite(buzzer,HIGH);
  digitalWrite(ledmerah,HIGH);
  digitalWrite(ledhijau,LOW);
  digitalWrite(ssr,HIGH);     
}
*/

if(selisih >= 0){
  digitalWrite(buzzer,LOW);
  digitalWrite(ledmerah,HIGH);
  digitalWrite(ledhijau,LOW);  
  digitalWrite(ssr,LOW);  
  lcd.clear();
  padam();
}

}


if(current1 < current2){
  selisih = current2 - current1;  

/*
if((selisih > 0.00)&&(selisih < 0.01 )){
  digitalWrite(buzzer,HIGH);
  digitalWrite(ledmerah,HIGH);
  digitalWrite(ledhijau,LOW);
  digitalWrite(ssr,HIGH);     
}
*/

if(selisih >= 0){
  digitalWrite(buzzer,LOW);
  digitalWrite(ledmerah,HIGH);
  digitalWrite(ledhijau,LOW);  
  digitalWrite(ssr,LOW);  
  lcd.clear();
  padam();
}

}

lcd.setCursor(0,0);
lcd.print("V:");
lcd.print(voltage);
lcd.print("  ");

lcd.setCursor(0,1);
lcd.print("I1:");   
lcd.print(current1);
lcd.print(" I2:");
lcd.print(current2);
lcd.print("     ");

lcd.setCursor(0,2);
lcd.print("Kwh:");
lcd.print(energy);
lcd.print(" Rp.");   
lcd.print(biaya);
lcd.print("  ");

lcd.setCursor(0,3);
lcd.print("B:");
lcd.print(selisih);
lcd.print(" ");   
lcd.print("P: ");
lcd.print(power);
lcd.print(" ");   

kirim();
delay(1000);
}

void kirim(){
  
 if (client.connect(server,80))   //   "184.106.153.149" or api.thingspeak.com
 
                      {
                           
                             String postStr = apiKey;
                             postStr +="&field1=";
                             postStr += String(voltage);
                             postStr += "\r\n\r\n";

                             client.print(String("GET ") + resource + apiKey + "&field1=" + voltage + "&field2=" + current1 + "&field3=" + current2 + "&field4=" + energy + "&field5=" + biaya + "&field6=" + selisih + "&field7=" + power +" HTTP/1.1\r\n" + "Host: " + server + "\r\n" + "Connection: close\r\n\r\n");
                                       
                             client.print("Host: api.thingspeak.com\n");
                             client.print("Connection: close\n");
                             client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n");
                             client.print("Content-Type: application/x-www-form-urlencoded\n");
                             client.print("Content-Length: ");
                             client.print(postStr.length());
                             client.print("\n\n");
                             client.print(postStr);
                         
                             Serial.println(". Send to Thingspeak.");
                        }
                       
          client.stop();

          Serial.println("Waiting...");
 
  // thingspeak needs minimum 15 sec delay between updates, i've set it to 30 seconds
  delay(10000);
    
}

void padam(){
lcd.setCursor(0,1);
lcd.print("TERJADI ARUS BOCOR");
digitalWrite(buzzer,LOW);

  digitalWrite(buzzer,LOW);
  digitalWrite(ledmerah,HIGH);
  digitalWrite(ledhijau,LOW);  
  digitalWrite(ssr,LOW);  

btresetx = digitalRead(btreset);

if(btresetx == 0){
  lcd.clear();
  delay(1000);
  digitalWrite(ssr,HIGH); //LITRIK AC NYALA
  digitalWrite(buzzer,HIGH);
  delay(1000);
  return;  
}
  
padam();  
}



c. VIDEO HASILNYA



Deteksi Tegangan AC 220v dan Listrik Padam / Nyala NOTIF SMS

Deteksi Tegangan AC 220v dan Listrik Padam / Nyala NOTIF SMS
 

          Pada kesempatan kali ini saya akan menjeaskan mengenai bagaimana memuat sebuah alat yang dapat mendeteksi tegangan PLN 220v, jadi alat ini akan memberikan notif sms jika terjadi listrik padam dan ketika listrik nyala maka akan memberikan notif sms juga sehingga user atau pemilik bisa mengetahui bahwa telah terjadi listrik padam. untuk lebih jelasnya berikut adalah koding dan skemanya.
 
 
a. Komponen dan skemanya



 
b. Program Arduino IDE

#include "Wire.h"
#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
SMSGSM sms;

int vin = 0;
int iin = 0;
int vout;
float kal;

int a = 0;
int zero = 1;
int kondisi = 0;
int dataadc;

char string[160];
int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];
unsigned long values[100];
int vin1;
int vin2;
int vin3;
int vin4;
unsigned int i1;
unsigned int z1;
unsigned int i2;
unsigned int z2;
unsigned int i3;
unsigned int z3;
unsigned int i4;
unsigned int z4;

void setup() {
  Serial.begin(9600);
 
  Serial.println("GSM Shield testing.");
     if (gsm.begin(2400)) {
          Serial.println("\nstatus=READY");
          started=true;
     } else Serial.println("\nstatus=IDLE");

     if(started) {
          if (sms.SendSMS("081234567890", "Alat Ready"))
          Serial.println("\nSMS sent OK");
     }
     
}

void loop() {
 
z1 = 0;
z2 = 0;
z3 = 0;
z4 = 0;

for(i1=0;i1<100;i1++) {
  values[i1] = analogRead(A0);            
  if (values[i1] >= z1) {
  z1 = values[i1];
  }
}

for(i2=0;i2<100;i2++) {
  values[i2] = analogRead(A0);            
  if (values[i2] >= z2) {
  z2 = values[i2];
  }
}
 
for(i3=0;i3<100;i3++) {
  values[i3] = analogRead(A0);            
  if (values[i3] >= z3) {
  z3 = values[i3];
  }
}
 
 for(i4=0;i4<100;i4++) {
  values[i4] = analogRead(A0);            
  if (values[i4] >= z4) {
  z4 = values[i4];
  }
}
 
vin1 = z1 ;
vin2 = z2 ;
vin3 = z3 ;
vin4 = z4 ;

z1 = 0;
z2 = 0;
z3 = 0;
z4 = 0;

if((vin1 > vin2)&&(vin1 > vin3)&&(vin1 > vin4)){
  vout = vin1;
  kal = (vout - 515.9) / 0.413 ;
}
else if((vin2 > vin1)&&(vin2 > vin3)&&(vin2 > vin4)){
  vout = vin2;
  kal = (vout - 515.9) / 0.413 ;
}
else if((vin3 > vin1)&&(vin3 > vin2)&&(vin3 > vin4)){
  vout = vin3;
  kal = (vout - 515.9) / 0.413 ;
}
else if((vin4 > vin1)&&(vin4 > vin2)&&(vin4 > vin3)){
  vout = vin4;
  kal = (vout - 515.9) / 0.413 ;
}

if(kal < 0){
kal = 0;
}

Serial.println(kal);

 if((kal > 200)&&(kondisi == 1)){
  if (sms.SendSMS("081234567890", "Listrik Nyala"))
      Serial.println("\nSMS sent OK");
      kondisi = 0;
      delay(3000);
   }
 
 if((kal < 200)&&(kondisi == 0)){
   if (sms.SendSMS("081234567890", "Listrik Padam"))
      Serial.println("\nSMS sent OK");
      kondisi = 1;
      delay(3000);
   }
      
delay(200);
}
 
 
 
c, VIDEO HASILNYA
 

 
 
 

Membuat Alat Orbital Shaker Arduino

Membuat Alat Orbital Shaker Arduino


        Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat berfungsi sebagai alat pencampur 2 larutan yaitu orbital shaker, tujuan utama alat ini yaitu mencampurkan 2 larutan yang berbeda menjadi 1 wadah larutan yang kemudian dilakukan pengadukan sehingga tercampur rata. proses pengadukan juga harus berjalan secara smoot / halus agar cairan didalam wadah tidak mengalami goncangan yang serius. untuk lebih jelasnya berikut adalah koding dan komponennya. 


a. Komponen



b. Program Arduino IDE

#include <Wire.h>
#include <LiquidCrystal_I2C.h> 
#include <MsTimer2.h> 
#include <L298N.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 20 chars and 4 line display

//Motor DC - Driver Motor L298N
#define motor 10 //deklarasi pin 10 untuk mengatur kecepatan motor dengan mengubah nilai PWM
#define R_motor 9 //deklarasi pin 9 untuk mengatur arah putaran motor searah jarum jam
#define L_motor 8 //deklarasi pin 8 untuk mengatur arah putaran motor berlawanan arah jarum jam
//Water Pump - Driver Motor L298N
#define IN1 4 // deklarasi pin IN1 (drivermotor) terhubung ke pin 4 Arduino
#define IN2 5 // deklarasi pin IN2 (drivermotor) terhubung ke pin 5 Arduino
#define IN3 6 // deklarasi pin IN3 (drivermotor) terhubung ke pin 6 Arduino
#define IN4 7 // deklarasi pin IN4 (drivermotor) terhubung ke pin 7 Arduino

//Tombol - PullUpResistor
#define buttonUP A0 // deklarasi pin A0 sebagai tombol UP 
#define buttonDOWN A1 // deklarasi pin A1 sebagai tombol DOWN
#define buttonBACK A2 // deklarasi pin A2 sebagai tombol BACK 
#define buttonSTART A3 // deklarasi pin A3 sebagai tombol START

//Buzzer
#define buzzer 2 //deklarasi pin 13 untuk indikator buzzer

int menu=0;
int START=buttonSTART; 
int BACK=buttonBACK; 
int UP=buttonUP;
int DOWN=buttonDOWN; 
int menit;
int detik;
int vol_1,vol_2;
int nextVol_1, nextVol_2; 
int kec;
int setTimer=0;
float setpoints1;
float setpoints2;
float setpoints3;
  
void flash() {
detik--; }


void setup() {
//pengurangan detik
//deklarasi Motor DC 
pinMode(motor,OUTPUT); 
pinMode(R_motor,OUTPUT);
pinMode(L_motor,OUTPUT);
//deklarasi Tombol
pinMode(buttonUP, INPUT_PULLUP); 
pinMode(buttonDOWN, INPUT_PULLUP); 
pinMode(buttonSTART, INPUT_PULLUP); 
pinMode(buttonBACK, INPUT_PULLUP);
//deklarasi Water Pump 
pinMode(IN1, OUTPUT); 
pinMode(IN2, OUTPUT); 
pinMode(IN3, OUTPUT); 
pinMode(IN4, OUTPUT);
//deklarasi Buzzer 
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer,HIGH);
//pengurangan timer setiap 1 detik 
MsTimer2::set(1000,flash);
//inisialisasi tampilan awal 
nama();
menu=0;
}


void loop() {
switch (menu) {

case(0):
//Halaman awal menu berisi pemilihan Washing&Cleanser//
halaman1();
if (digitalRead(START)==LOW){klick();
delay(200);
lcd.clear();
menu=5;

if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=0;
  } 
  
if (digitalRead(UP)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=0;
  }
  
if (digitalRead(DOWN)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=1;
  } 
  break;
  
case(1):
//Halaman awal menu berisi pemilihan Setting Volume//
halaman2();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=9;
  } 
  
  if (digitalRead(BACK)==LOW){
    klick();
    delay(200);
    lcd.clear();
    menu=1;
    } 
    
if (digitalRead(UP)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=0;
  }
  
if (digitalRead(DOWN)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=2;
  } 
  break;
  
case(2):
//Halaman awal menu berisi pemilihan Setting Kecepatan//
halaman3();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=15;
  } 
  
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=2;
  }
  
if (digitalRead(UP)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=1;
  }
  
if (digitalRead(DOWN)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=3;
  } 
  break;
  
case(3):
//Halaman awal menu berisi pemilihan Setting Timer//

halaman4();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=16;
  } 
  
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=1;
  }
  
if (digitalRead(UP)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=2;
  }
  
if (digitalRead(DOWN)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=4;
  } 
  break;
  
case(4):
//Halaman awal menu berisi pemilihan START//
halaman5();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=17;
  } 

if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=4;
  }
  
if (digitalRead(UP)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=3;
  }
  
if (digitalRead(DOWN)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=4;
  } 
  break;
  
case(5):
//Halaman kesatu submenu Satu berisi pemilihan Washing// 
subHalaman1();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=6;
  } 
  
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=20;
  } 
  break;
  
case(6):
//Halaman kedua submenu Satu berisi proses Washing// 
subHalaman1_1();
menu=7;
break;

case(7):
//Halaman ketiga submenu Satu berisi pemilihan Cleanser// 
subHalaman1_2();
if (digitalRead(START)==LOW){
  klick();
  delay(200);lcd.clear();menu=8;} 
  break;
  
case (8):
//Halaman keempat submenu Satu berisi proses Cleanser// 
subHalaman1_3();
menu=1;
break;

case(9):
//Halaman kesatu submenu Dua berisi pemilihan Setting Volume I// 
subHalaman2_1();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=10;
  } 
  
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=1;
  }
  
if (digitalRead(UP)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=12;
  }
  
if (digitalRead(DOWN)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=12;
  } 
  break;
  
case(10):
//Halaman kedua submenu Dua berisi pemilihan jumlah Volume I// 
subHalaman2_1_1();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=11;
  } 
  
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=9;
  }
  
if (digitalRead(UP)==LOW&&vol_1<4){
  klick();
  delay(100);
  vol_1++;
  }
  
if (digitalRead(DOWN)==LOW&&vol_1>1){
  klick();
  delay(100);
  vol_1--;
  }
  break;

case(11):
//Halaman ketiga submenu Dua berisi proses Volume I// 
subHalaman2_1_2();
menu=12;
break;

case(12):
//Halaman kesatu submenu Dua berisi pemilihan Setting Volume II// 
subHalaman2_2();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=13;
  } 
  
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=1;
  }
  
if (digitalRead(UP)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=9;
  }
  
if (digitalRead(DOWN)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=9;
  } 
  break;
  
case(13):
//Halaman kedua submenu Dua berisi pemilihan jumlah Volume II// 
subHalaman2_2_1();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=14;
  } 
  
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=12;
  } 
  
if (digitalRead(UP)==LOW&&vol_2<4){
  klick();
  delay(100);
  vol_2++;
  }
  
if (digitalRead(DOWN)==LOW&&vol_2>1){
  klick();
  delay(100);
  vol_2--;
  } 
  break;
  
case(14):
//Halaman ketiga submenu Dua berisi proses Volume II// 
subHalaman2_2_2();
menu=25;

break;

case(15):
//Halaman awal submenu Tiga berisi pemilihan Kecepatan// 
subHalaman3();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=3;
  } 
  
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=2;
  } 
  
if (digitalRead(UP)==LOW&&kec<3){
  klick();
  delay(100);
  kec++;
  }
  
if (digitalRead(DOWN)==LOW&&kec>1){
  klick();
  delay(100);
  kec--;
  }
  break;
  
case(16):
//Halaman awal submenu Empat berisi pemilihan Timer//
subHalaman4();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=4;
  }
  
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=3;
  }
  
if (digitalRead(UP)==LOW&&setTimer<60){
  klick();
  delay(100);
  setTimer++;
  }
  
if (digitalRead(DOWN)==LOW&&setTimer>1){
  klick();
  delay(100);
  setTimer-- ;
  }
  
break;

case(17):
//Halaman kesatu submenu Lima berisi nilai Kecepatan dan Timer yang telah di setting//
subHalaman5();
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=4;
  }
  
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  MsTimer2::start();
  startMotor();
  menu=18;}
break;

case(18):
//Halaman kedua submenu Lima berisi proses Running Motor dan Countdown Timer//
subHalaman5_1();
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  MsTimer2::stop();
  stopMotor(); 
  }
  
if (digitalRead(START)==LOW){
  klick();
  delay(100);
  MsTimer2::start();
  startMotor() ;
  }
  
if (digitalRead(BACK)==LOW){
  klick();
  delay(2000);
  lcd.clear();
  menu=19;
  } 
  
if (detik<=0&&setTimer<=0){
  detik=0;
  lcd.clear();
  menu=19;
  }
  
break;

case(19):
//Halaman ketiga submenu Lima berisi proses selesai Running Motor dan Countdown Timer//
subHalaman5_2(); 
menu=20;
break;

case(20):
//Halaman awal menu berisi pemilihan Washing&Cleanser tanpa Pembersihan Selang//
nextHalaman1();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=5;
  }

if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=20;
  }

if (digitalRead(UP)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=20;
  }
  
if (digitalRead(DOWN)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=21;
  }
  break;
  
case(21):

//Halaman awal menu berisi pemilihan Setting Volume tanpa Pembersihan Selang//
nextHalaman2();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=22;
  }

if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=21;
  }

if (digitalRead(UP)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=0;
  }
  
if (digitalRead(DOWN)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=2;
  }
  break;
  
case(22):
//Halaman kesatu submenu Dua berisi pemilihan Setting Volume I tanpa Pembersihan Selang//
nextSubHalaman2_1();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=23;
  }

if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=21;
  }
  
if (digitalRead(UP)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=25;
  }
  
if (digitalRead(DOWN)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=25;
  }
  break;
  
case(23):
//Halaman kedua submenu Dua berisi pemilihan jumlah Volume I tanpa Pembersihan Selang//
nextSubHalaman2_1_1();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=24;}
  
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=22;}

if (digitalRead(UP)==LOW&&nextVol_1<4){
  klick();
  delay(100);
  nextVol_1++;}
  
if (digitalRead(DOWN)==LOW&&nextVol_1>1){
  klick();
  delay(100);
  nextVol_1--;}
break;

case(24):
//Halaman ketiga submenu Dua berisi proses Volume I tanpa Pembersihan Selang//
nextSubHalaman2_1_2(); menu=25;
break;
case(25):
//Halaman kesatu submenu Dua berisi pemilihan Setting Volume II tanpa Pembersihan Selang//
nextSubHalaman2_2();
if (digitalRead(START)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=26;} 
  
if (digitalRead(BACK)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=21;} 
  
if (digitalRead(UP)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=22;}
  
if (digitalRead(DOWN)==LOW){
  klick();
  delay(200);
  lcd.clear();
  menu=22;}
  break;
  
case(26):
//Halaman kedua submenu Dua berisi pemilihan jumlah Volume II tanpa Pembersihan Selang//
nextSubHalaman2_2_1();
if (digitalRead(START)==LOW){klick();delay(200);lcd.clear();menu=27;}
if (digitalRead(BACK)==LOW){klick();delay(200);lcd.clear();menu=25;}
if (digitalRead(UP)==LOW&&nextVol_2<4){klick();delay(100);nextVol_2++;}
if (digitalRead(DOWN)==LOW&&nextVol_2>1){klick();delay(100);nextVol_2--;}
break; case(27):

//Halaman ketiga submenu Dua berisi proses Volume II tanpa Pembersihan Selang//
nextSubHalaman2_2_2(); menu=25;
break;
}
delay(50); }


void halaman1()
//Tampilan Pemilihan Washing & Cleanser// 
{
lcd.setCursor(0,0); lcd.print(">WASHING & CLEANSER"); lcd.setCursor(0,1);
lcd.print(" SET.VOLUME"); lcd.setCursor(0,2);
lcd.print(" SET.KECEPATAN"); lcd.setCursor(0,3);
lcd.print(" SET.TIMER");
}


void halaman2()
//Tampilan Pemilihan Setting Volume// 
{
lcd.setCursor(0,0);
lcd.print(" WASHING & CLEANSER"); lcd.setCursor(0,1); lcd.print(">SET.VOLUME");

lcd.setCursor(0,2);
lcd.print(" SET.KECEPATAN"); lcd.setCursor(0,3);
lcd.print(" SET.TIMER");
}
void halaman3()
//Tampilan Pemilihan Setting Kecepatan// 
{
lcd.setCursor(0,0);
lcd.print(" WASHING & CLEANSER"); lcd.setCursor(0,1);
lcd.print(" SET.VOLUME"); lcd.setCursor(0,2); lcd.print(">SET.KECEPATAN"); lcd.setCursor(0,3);
lcd.print(" SET.TIMER");
}


void halaman4()
//Tampilan Pemilihan Setting Timer// 
{
lcd.setCursor(0,0);
lcd.print(" WASHING & CLEANSER"); lcd.setCursor(0,1);
lcd.print(" SET.VOLUME"); lcd.setCursor(0,2);
lcd.print(" SET.KECEPATAN"); lcd.setCursor(0,3);

lcd.print(">SET.TIMER"); }


void halaman5()
//Tampilan Pemilihan Start// 
{
lcd.setCursor(0,0);
lcd.print(">START"); }


void subHalaman1()
//Tampilan Pemilihan Washing// 
{
lcd.setCursor(6,1); lcd.print("WASHING"); lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(13,3); lcd.print("[START]");
}


void subHalaman1_1() //Tampilan Proses Washing// 
{
lcd.setCursor(0,0); lcd.print("-------******-------"); lcd.setCursor(7,1); lcd.print("PROSES"); lcd.setCursor(7,2);
lcd.print("WASHING"); lcd.setCursor(0,3); lcd.print("------*********-----"); washingPump();
delay(200);
lcd.clear(); }


void subHalaman1_2() //Tampilan Pemilihan Cleanser// 
{
lcd.setCursor(5,1); lcd.print("CLEANSER"); lcd.setCursor(13,3); lcd.print("[START]");
}

void subHalaman1_3() //Tampilan Proses Cleanser// 
{
lcd.setCursor(0,0); lcd.print("-------******-------");
lcd.setCursor(7,1); lcd.print("PROSES");
lcd.setCursor(6,2); lcd.print("CLEANSER"); lcd.setCursor(0,3); lcd.print("-----**********-----"); cleanserPump();

delay(200);
lcd.clear(); }

void subHalaman2_1()
//Tampilan Pemilihan Setting Volume I// 
{
lcd.setCursor(0, 0); lcd.print(">SET.VOLUME I"); lcd.setCursor(0, 1);
lcd.print(" SET.VOLUME II"); lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(16,3); lcd.print("[OK]");
}

void subHalaman2_1_1()
//Tampilan Pemilihan jumlah Volume I// 
{
lcd.setCursor(4,0);
lcd.print("SET VOLUME I"); lcd.setCursor(11,1);
lcd.print("ml");
lcd.setCursor(7, 1); if(vol_1==1){lcd.print(" 25 ml ");} if(vol_1==2){lcd.print(" 50 ml ");} if(vol_1==3){lcd.print(" 75 ml ");} if(vol_1==4){lcd.print(" 100 ml ");}

lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(13,3); lcd.print("[START]");
}

void subHalaman2_1_2()
//Tampilan proses pengisian Volume I// 
{
lcd.setCursor(0,0); lcd.print("-------******-------"); lcd.setCursor(0,3); lcd.print("-------******-------"); lcd.setCursor(2, 1); lcd.print("PROSES PENGISIAN"); lcd.setCursor(10,2); lcd.print("ml");
lcd.setCursor(6, 2); if(vol_1==1){lcd.print(" 25 ml ");} if(vol_1==2){lcd.print(" 50 ml ");} if(vol_1==3){lcd.print(" 75 ml ");} if(vol_1==4){lcd.print(" 100 ml ");} waterPump1();
delay(200);
lcd.clear();
}

void subHalaman2_2()
//Tampilan Pemilihan Setting Volume II//
{
lcd.setCursor(0,0);
lcd.print(" SET.VOLUME I"); lcd.setCursor(0,1); lcd.print(">SET.VOLUME II"); lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(16,3); lcd.print("[OK]");
}

void subHalaman2_2_1()
//Tampilan Pemilihan jumlah Volume II// 
{
lcd.setCursor(4,0);
lcd.print("SET VOLUME II"); lcd.setCursor(11,1);
lcd.print("ml");
lcd.setCursor(7, 1); if(vol_2==1){lcd.print(" 25 ml ");} if(vol_2==2){lcd.print(" 50 ml ");} if(vol_2==3){lcd.print(" 75 ml ");} if(vol_2==4){lcd.print(" 100 ml ");} lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(13,3); lcd.print("[START]");
}

void subHalaman2_2_2()
//Tampilan proses pengisian Volume II// 
{
lcd.setCursor(0,0); lcd.print("-------******-------"); lcd.setCursor(0,3); lcd.print("-------******-------"); lcd.setCursor(2, 1); lcd.print("PROSES PENGISIAN"); lcd.setCursor(10,2); lcd.print("ml");
lcd.setCursor(6, 2); if(vol_2==1){lcd.print(" 25 ml ");} if(vol_2==2){lcd.print(" 50 ml ");} if(vol_2==3){lcd.print(" 75 ml ");} if(vol_2==4){lcd.print(" 100 ml ");} waterPump2();
delay(200);
lcd.clear();
}

void subHalaman3()
//Tampilan Pemilihan Kecepatan// 
{
lcd.setCursor(3, 0); 
lcd.print("SET KECEPATAN"); lcd.setCursor(11, 1); lcd.print("rpm"); lcd.setCursor(6, 1);
if(kec==1){lcd.print(" 100 rpm ");} 
if(kec==2){lcd.print(" 150 rpm ");} 
if(kec==3){lcd.print(" 250 rpm ");} 
lcd.setCursor(0,3); 
lcd.print("[BACK]"); 
lcd.setCursor(16,3); 
lcd.print("[OK]");
}

void subHalaman4() //Tampilan Pemilihan Timer// 
{
lcd.setCursor(4, 0); lcd.print("SETTING TIMER"); lcd.setCursor(7, 1); lcd.print(setTimer);
lcd.print(" menit "); lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(16,3); lcd.print("[OK]");
}

void subHalaman5()
//Tampilan hasil setting Kecepatan & Timer// 
{
lcd.setCursor(0, 0);
lcd.print("Kec. :"); 
if(kec==1){lcd.print(" 100 rpm ");} 
if(kec==2){lcd.print(" 150 rpm ");} 
if(kec==3){lcd.print(" 250 rpm ");}
lcd.setCursor(0, 1); lcd.print("Tim. :"); lcd.setCursor(7,1);
if(setTimer < 10) lcd.print("0"); lcd.print(setTimer); lcd.print(":");
if(detik < 10) lcd.print("0"); lcd.print(detik);
lcd.print(" "); lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(13,3); lcd.print("[START]");
}

void subHalaman5_1()
//Tampilan running Kecepatan & Timer// 
{
if(detik<0)
{
 detik=59; 
 setTimer--;
}
 
lcd.setCursor(0, 1);
lcd.print("Kec. :"); 

if(kec==1){
  lcd.print(" 100 rpm ");
  } 

if(kec==2){
  lcd.print(" 150 rpm ");
  }

if(kec==3){
  lcd.print(" 250 rpm ");
  }
  
  lcd.setCursor(0, 2);
  lcd.print("Tim. :"); 
  lcd.setCursor(7,2);
  
if(setTimer < 10) lcd.print("0"); lcd.print(setTimer); lcd.print(":");

if(detik < 10) lcd.print("0"); lcd.print(detik); lcd.print(" "); //lcd.print(setpoints1); //menampilkan nilai pwm
lcd.print(" "); lcd.setCursor(0,0); lcd.print("--------------------"); lcd.setCursor(0,3); lcd.print("--------------------");
startMotor();
}

void subHalaman5_2()
//Tampilan running selesai Kecepatan & Timer// 
{
stopMotor();
MsTimer2::stop(); 
lcd.setCursor(0,0); 
lcd.print("-------******-------"); 
lcd.setCursor(7,1); 
lcd.print("PROSES"); 
lcd.setCursor(7,2); 
lcd.print("SELESAI"); 
lcd.setCursor(0,3); 
lcd.print("-----**********-----"); 
digitalWrite(buzzer, LOW); 
delay(2000);
digitalWrite(buzzer, HIGH);
lcd.clear(); }

void nextHalaman1()
//Tampilan Pemilihan Washing & Cleanser tanpa Pembersihan Selang// 
{
lcd.setCursor(0,0); lcd.print(">WASHING & CLEANSER"); lcd.setCursor(0,1);
lcd.print(" SET.VOLUME"); lcd.setCursor(0,2);
lcd.print(" SET.KECEPATAN"); lcd.setCursor(0,3);
lcd.print(" SET.TIMER");
}

void nextHalaman2()
//Tampilan Pemilihan Setting Volume tanpa Pembersihan Selang// 
{
lcd.setCursor(0,0);
lcd.print(" WASHING & CLEANSER"); lcd.setCursor(0,1); lcd.print(">SET.VOLUME"); lcd.setCursor(0,2);
lcd.print(" SET.KECEPATAN"); lcd.setCursor(0,3);
lcd.print(" SET.TIMER");
}

void nextSubHalaman2_1()
//Tampilan Pemilihan Setting Volume I tanpa Pembersihan Selang// 
{
lcd.setCursor(0, 0); lcd.print(">SET.VOLUME I"); lcd.setCursor(0, 1);
lcd.print(" SET.VOLUME II"); lcd.setCursor(0,3); lcd.print("[BACK]"); lcd.setCursor(16,3); lcd.print("[OK]");
}

void nextSubHalaman2_1_1()
//Tampilan Pemilihan jumlah Volume I tanpa Pembersihan Selang// 
{
lcd.setCursor(4,0);
lcd.print("SET VOLUME I"); lcd.setCursor(11,1);
lcd.print("ml");
lcd.setCursor(7, 1); if(nextVol_1==1){lcd.print(" 25 ml ");} if(nextVol_1==2){lcd.print(" 50 ml ");} if(nextVol_1==3){lcd.print(" 75 ml ");} if(nextVol_1==4){lcd.print(" 100 ml ");} lcd.setCursor(0,3);
lcd.print("[BACK]"); lcd.setCursor(13,3); lcd.print("[START]");
}

void nextSubHalaman2_1_2()
//Tampilan proses pengisian Volume I tanpa Pembersihan Selang// 
{
lcd.setCursor(0,0); lcd.print("-------******-------"); lcd.setCursor(0,3); lcd.print("-------******-------"); lcd.setCursor(2, 1); lcd.print("PROSES PENGISIAN"); lcd.setCursor(10,2); lcd.print("ml");
lcd.setCursor(6, 2); if(nextVol_1==1){lcd.print(" 25 ml ");} if(nextVol_1==2){lcd.print(" 50 ml ");} if(nextVol_1==3){lcd.print(" 75 ml ");} if(nextVol_1==4){lcd.print(" 100 ml ");} NextWaterPump1();
delay(200);
lcd.clear();
}

void nextSubHalaman2_2 ()
//Tampilan Pemilihan Setting Volume II tanpa Pembersihan Selang// 
{
lcd.setCursor(0,0);
lcd.print(" SET.VOLUME I"); lcd.setCursor(0,1); lcd.print(">SET.VOLUME II"); lcd.setCursor(0,3); lcd.print("[BACK]");
lcd.setCursor(16,3);
lcd.print("[OK]"); }

void nextSubHalaman2_2_1 ()
//Tampilan Pemilihan jumlah Volume II tanpa Pembersihan Selang// 
{
lcd.setCursor(4,0);
lcd.print("SET VOLUME II"); lcd.setCursor(11,1);
lcd.print("ml");
lcd.setCursor(7, 1); if(nextVol_2==1){lcd.print(" 25 ml ");} if(nextVol_2==2){lcd.print(" 50 ml ");} if(nextVol_2==3){lcd.print(" 75 ml ");} if(nextVol_2==4){lcd.print(" 100 ml ");} lcd.setCursor(0,3);
lcd.print("[BACK]"); lcd.setCursor(13,3); lcd.print("[START]");
}

void nextSubHalaman2_2_2 ()
//Tampilan proses pengisian Volume II tanpa Pembersihan Selang// 
{
lcd.setCursor(0,0); lcd.print("-------******-------"); lcd.setCursor(0,3); lcd.print("-------******-------");
lcd.setCursor(2, 1);
lcd.print("PROSES PENGISIAN"); lcd.setCursor(10,2);
lcd.print("ml");
lcd.setCursor(6, 2); if(nextVol_2==1){lcd.print(" 25 ml ");} if(nextVol_2==2){lcd.print(" 50 ml ");} if(nextVol_2==3){lcd.print(" 75 ml ");} if(nextVol_2==4){lcd.print(" 100 ml ");} NextWaterPump2();
delay(200);
lcd.clear();
}

void nama()
{
lcd.clear();
lcd.begin();
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("ORBITAL SHAKER"); 
delay(2000);
lcd.clear();
}

void klick() 
{
digitalWrite(buzzer, LOW); delay(200); digitalWrite(buzzer, HIGH);
}

//pengaturan kondisi Buzzer saat tombol ditekan
void washingPump() // dengan air
{ startWaterPump(); delay(5200);
//pengaturan pembersihan selang I dan selang
stopWaterPump(); }

void cleanserPump() // tanpa air
{ startWaterPump(); 
delay(8000); 
stopWaterPump();
}

void waterPump1() 
{
//pengaturan pengosongan selang cairan I dan
//pengaturan volume cairan I
if(vol_1==1){startWaterPump1();delay(2200);stopWaterPump();} if(vol_1==2){startWaterPump1();delay(3200);stopWaterPump();} if(vol_1==3){startWaterPump1();delay(4200);stopWaterPump();} if(vol_1==4){startWaterPump1();delay(5200);stopWaterPump();}
}

void waterPump2() //pengaturan volume cairan II 
{
if(vol_2==1){startWaterPump2();delay(2200);stopWaterPump();} if(vol_2==2){startWaterPump2();delay(3200);stopWaterPump();} if(vol_2==3){startWaterPump2();delay(4200);stopWaterPump();} if(vol_2==4){startWaterPump2();delay(5200);stopWaterPump();}
}

void NextWaterPump1() //pengaturan volume cairan I tanpa pembersihan selang
{
if(nextVol_1==1){startWaterPump1();delay(1000);stopWaterPump();} if(nextVol_1==2){startWaterPump1();delay(2000);stopWaterPump();} if(nextVol_1==3){startWaterPump1();delay(3000);stopWaterPump();} if(nextVol_1==4){startWaterPump1();delay(4000);stopWaterPump();}
}

void NextWaterPump2() //pengaturan volume cairan II tanpa pembersihan selang
{ if(nextVol_2==1){startWaterPump2();delay(1000);stopWaterPump();} if(nextVol_2==2){startWaterPump2();delay(2000);stopWaterPump();} if(nextVol_2==3){startWaterPump2();delay(3000);stopWaterPump();} if(nextVol_2==4){startWaterPump2();delay(4000);stopWaterPump();}
}

void startWaterPump() //secara bersamaan
{
digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); }

void startWaterPump1() {
digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); }
//pengaturan mulai water pump 1 dan water pump 2
//pengaturan mulai water pump 1

void startWaterPump2() {
digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); }
void stopWaterPump() {
digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); digitalWrite(IN3, LOW); digitalWrite(IN4, LOW);
}



void startMotor() {
//pengaturan kecepatan motor dc
digitalWrite(R_motor, HIGH);
digitalWrite(L_motor, LOW);

if(kec==1){
  if(setpoints1 < 127.5){
    setpoints1 = setpoints1 + 5.0;
  }
  if(setpoints1 >= 127.5){
    setpoints1 = 127.5;
  }
  analogWrite(motor, setpoints1); //nilai PWM untuk kecepatan 100 RPM
  } 
  
if(kec==2){
  if(setpoints2 < 191.25){
    setpoints2 = setpoints2 + 5.0;
  }
  if(setpoints2 >= 191.25){
    setpoints2 = 191.25;
  }
  analogWrite(motor, setpoints2); //nilai PWM untuk kecepatan 150 RPM
  } 
  
if(kec==3){
  if(setpoints3 < 231.25){
    setpoints3 = setpoints3 + 5.0;
  }
  if(setpoints3 >= 231.25){
    setpoints3 = 231.25;
  }
  analogWrite(motor, setpoints3); //nilai PWM untuk kecepatan 250 RPM
  } 
 
}



void stopMotor() //pengaturan berhenti kerja motor dc 
{
  

if(kec==1){ 
  if(setpoints1 > 0){
    setpoints1 = setpoints1 - 1.0;
    digitalWrite(R_motor, HIGH);
    digitalWrite(L_motor, LOW);
    analogWrite(motor, setpoints1);
  }   
  if(setpoints1 <= 0){
    setpoints1 = 0;
    digitalWrite(R_motor, LOW);
    digitalWrite(L_motor, LOW);
    analogWrite(motor, setpoints1); //nilai PWM untuk kecepatan 100 RPM
    return;
  }   
}
 
if(kec==2){ 
  if(setpoints2 > 0){
    setpoints2 = setpoints2 - 1.0;
    digitalWrite(R_motor, HIGH);
    digitalWrite(L_motor, LOW);
    analogWrite(motor, setpoints2);
  }    
  if(setpoints2 <= 0){
    setpoints2 = 0;
    digitalWrite(R_motor, LOW);
    digitalWrite(L_motor, LOW);
    analogWrite(motor, setpoints2); //nilai PWM untuk kecepatan 100 RPM
    return; 
  } 
}
  
if(kec==3){ 
  if(setpoints3 > 0){
    setpoints3 = setpoints3 - 1.0;
    digitalWrite(R_motor, HIGH);
    digitalWrite(L_motor, LOW);
    analogWrite(motor, setpoints3);
  } 
  if(setpoints3 <= 0){
    setpoints3 = 0;
    digitalWrite(R_motor, LOW);
    digitalWrite(L_motor, LOW);
    analogWrite(motor, setpoints3); //nilai PWM untuk kecepatan 100 RPM
    return;  
  } 
}

stopMotor();  
}


c. VIDEO HASILNYA