Modul Kontroller Pompa Air Mancur 8 Channel
Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang dapat mengendalikan 8 buah pompa untuk air mancur, selain itu alat ini juga terdapat 3 buah variasi yang bisa disetting sesuai keinginan. untuk lebih jelasnya berikut adalah koding dan skemanya.
1. Skema
2. Program Arduino IDE
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int tb1 = A0;
int tb2 = A1;
int tb3 = A2;
int tb4 = A3;
int ssr1 = 2;
int ssr2 = 3;
int ssr3 = 4;
int ssr4 = 5;
int ssr5 = 6;
int ssr6 = 7;
int ssr7 = 8;
int ssr8 = 9;
int waktu,mode;
int tb1x,tb2x,tb3x,tb4x;
void setup() {
lcd.begin();
lcd.clear();
lcd.noCursor();
pinMode(tb1,INPUT_PULLUP);
pinMode(tb2,INPUT_PULLUP);
pinMode(tb3,INPUT_PULLUP);
pinMode(tb4,INPUT_PULLUP);
pinMode(ssr1,OUTPUT);
pinMode(ssr2,OUTPUT);
pinMode(ssr3,OUTPUT);
pinMode(ssr4,OUTPUT);
pinMode(ssr5,OUTPUT);
pinMode(ssr6,OUTPUT);
pinMode(ssr7,OUTPUT);
pinMode(ssr8,OUTPUT);
settingmode();
settingdelay();
}
void loop() {
tb1x = digitalRead(tb1);
tb2x = digitalRead(tb2);
tb3x = digitalRead(tb3);
tb4x = digitalRead(tb4);
if(tb4x == 0){
lcd.clear();
delay(2000);
settingmode();
settingdelay();
}
if(mode == 1){
variasi1();
}
if(mode == 2){
variasi2();
}
if(mode == 3){
variasi3();
}
}
void settingmode(){
tb1x = digitalRead(tb1);
tb2x = digitalRead(tb2);
tb3x = digitalRead(tb3);
tb4x = digitalRead(tb4);
if(tb3x == 0){
lcd.clear();
delay(2000);
return;;
}
if(tb1x == 0){
delay(200);
mode++;
}
if(tb2x == 0){
delay(200);
mode--;
}
if(mode < 1){
mode = 1;
}
if(mode > 3){
mode = 3;
}
lcd.setCursor(0,0);
lcd.print("MODE= ");
lcd.print(mode);
lcd.print(" ");
settingmode();
}
void settingdelay(){
tb1x = digitalRead(tb1);
tb2x = digitalRead(tb2);
tb3x = digitalRead(tb3);
tb4x = digitalRead(tb4);
if(tb3x == 0){
lcd.clear();
delay(2000);
return;
}
if(tb1x == 0){
delay(200);
waktu = waktu + 100;
}
if(tb2x == 0){
delay(200);
waktu = waktu - 100;
}
if(waktu < 1){
waktu = 100;
}
lcd.setCursor(0,0);
lcd.print("DLY= ");
lcd.print(waktu);
lcd.print(" ms ");
settingdelay();
}
void variasi1(){
lcd.setCursor(0,0);
lcd.print("MODE= ");
lcd.print(mode);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("DLY= ");
lcd.print(waktu);
lcd.print(" ms ");
digitalWrite(ssr1,HIGH);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,HIGH);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,HIGH);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,HIGH);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,HIGH);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,HIGH);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,HIGH);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,HIGH);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,HIGH);
delay(waktu);
}
//======================================================================
void variasi2(){
lcd.setCursor(0,0);
lcd.print("MODE= ");
lcd.print(mode);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("DLY= ");
lcd.print(waktu);
lcd.print(" ms ");
digitalWrite(ssr1,HIGH);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,HIGH);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,HIGH);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,HIGH);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,HIGH);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,HIGH);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,HIGH);
digitalWrite(ssr5,HIGH);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,HIGH);
digitalWrite(ssr5,HIGH);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,HIGH);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,HIGH);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,HIGH);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,HIGH);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,HIGH);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,HIGH);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,HIGH);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,HIGH);
delay(waktu);
}
//======================================================================
void variasi3(){
lcd.setCursor(0,0);
lcd.print("MODE= ");
lcd.print(mode);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("DLY= ");
lcd.print(waktu);
lcd.print(" ms ");
digitalWrite(ssr1,LOW);
digitalWrite(ssr2,LOW);
digitalWrite(ssr3,LOW);
digitalWrite(ssr4,LOW);
digitalWrite(ssr5,LOW);
digitalWrite(ssr6,LOW);
digitalWrite(ssr7,LOW);
digitalWrite(ssr8,LOW);
delay(waktu);
digitalWrite(ssr1,HIGH);
digitalWrite(ssr2,HIGH);
digitalWrite(ssr3,HIGH);
digitalWrite(ssr4,HIGH);
digitalWrite(ssr5,HIGH);
digitalWrite(ssr6,HIGH);
digitalWrite(ssr7,HIGH);
digitalWrite(ssr8,HIGH);
delay(waktu);
}
3. VIDEO HASILNYA