Sistem Kerja Alat
Mengontrol 4 relay menggunakan remot kontrol. Tombol 1 s/d 4 untuk menghidupkan Relay1 s/d 4, sedangkan tombol 5 s/d 8 untuk mematikan Relay 1 s/d 4. LCD digunakan untuk menampilkan data tombol yang ditekan. Relay sebagai aktuator yang akan mengontrol langsung peralatan listrik yang dikendalikan ‘ON – OFF’ nya.
- Xinda IR Remote Control Kit
- LCD 2x16
- 4 Relay +5V
- Modul Arduino UNO
- Power supply +9Volt
Xinda IR Remote Control Kit (Source) Modul Relay 4 Channel (Source)
Diagram Blok
Koneksi Arduino UNO dengan LCD
Koneksi Sensor
Koneksi Relay
Source Code/Sketch
#include <IRremote.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
int IR_PIN = 8;
int Rl1 = 9;
int Rl2 = 10;
int Rl3 = 11;
int Rl4 = 12;
IRrecv irrecv(IR_PIN);
decode_results results;
void setup(){
for(char i=9; i<13; i++){
pinMode(i, OUTPUT);
digitalWrite(i, LOW);
}
lcd.begin(16, 2);
lcd.print(" Kontrol 4Relay");
lcd.setCursor(0, 1);
lcd.print(" dg Remot IR");
delay(2000);
irrecv.enableIRIn();
}
void loop(){
lcd.setCursor(0, 1);
lcd.print("Tekan Tb 1 s/d 8");
if (irrecv.decode(&results)){
irrecv.resume();
lcd.setCursor(0,1);
switch(results.value){
case 0xFF30CF: lcd.print("Relay 1 ON ");
digitalWrite(Rl1, HIGH);break;
case 0xFF18E7: lcd.print("Relay 2 ON ");
digitalWrite(Rl2, HIGH);break;
case 0xFF7A85: lcd.print("Relay 3 ON ");
digitalWrite(Rl3, HIGH);break;
case 0xFF10EF: lcd.print("Relay 4 ON ");
digitalWrite(Rl4, HIGH);break;
case 0xFF38C7: lcd.print("Relay 1 OFF ");
digitalWrite(Rl1, LOW);break;
case 0xFF5AA5: lcd.print("Relay 2 OFF ");
digitalWrite(Rl2, LOW);break;
case 0xFF42BD: lcd.print("Relay 3 OFF ");
digitalWrite(Rl3, LOW);break;
case 0xFF4AB5: lcd.print("Relay 4 OFF ");
digitalWrite(Rl4, LOW);break;
case 0xFF6897: lcd.print("Relay All ON ");
digitalWrite(Rl1, HIGH);
digitalWrite(Rl2, HIGH);
digitalWrite(Rl3, HIGH);
digitalWrite(Rl4, HIGH);break;
case 0xFF52AD: lcd.print("Relay All OFF ");
digitalWrite(Rl1, LOW);
digitalWrite(Rl2, LOW);
digitalWrite(Rl3, LOW);
digitalWrite(Rl4, LOW);break;
}
delay(2000);
}
}
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
int IR_PIN = 8;
int Rl1 = 9;
int Rl2 = 10;
int Rl3 = 11;
int Rl4 = 12;
IRrecv irrecv(IR_PIN);
decode_results results;
void setup(){
for(char i=9; i<13; i++){
pinMode(i, OUTPUT);
digitalWrite(i, LOW);
}
lcd.begin(16, 2);
lcd.print(" Kontrol 4Relay");
lcd.setCursor(0, 1);
lcd.print(" dg Remot IR");
delay(2000);
irrecv.enableIRIn();
}
void loop(){
lcd.setCursor(0, 1);
lcd.print("Tekan Tb 1 s/d 8");
if (irrecv.decode(&results)){
irrecv.resume();
lcd.setCursor(0,1);
switch(results.value){
case 0xFF30CF: lcd.print("Relay 1 ON ");
digitalWrite(Rl1, HIGH);break;
case 0xFF18E7: lcd.print("Relay 2 ON ");
digitalWrite(Rl2, HIGH);break;
case 0xFF7A85: lcd.print("Relay 3 ON ");
digitalWrite(Rl3, HIGH);break;
case 0xFF10EF: lcd.print("Relay 4 ON ");
digitalWrite(Rl4, HIGH);break;
case 0xFF38C7: lcd.print("Relay 1 OFF ");
digitalWrite(Rl1, LOW);break;
case 0xFF5AA5: lcd.print("Relay 2 OFF ");
digitalWrite(Rl2, LOW);break;
case 0xFF42BD: lcd.print("Relay 3 OFF ");
digitalWrite(Rl3, LOW);break;
case 0xFF4AB5: lcd.print("Relay 4 OFF ");
digitalWrite(Rl4, LOW);break;
case 0xFF6897: lcd.print("Relay All ON ");
digitalWrite(Rl1, HIGH);
digitalWrite(Rl2, HIGH);
digitalWrite(Rl3, HIGH);
digitalWrite(Rl4, HIGH);break;
case 0xFF52AD: lcd.print("Relay All OFF ");
digitalWrite(Rl1, LOW);
digitalWrite(Rl2, LOW);
digitalWrite(Rl3, LOW);
digitalWrite(Rl4, LOW);break;
}
delay(2000);
}
}
Jalannya Alat
- Koneksikan antara sistem Arduino dengan peripheral lain seperti pada rangkaian (skematik).
- Pasang power supply (adaptor 9 V) dan hidupkan (colokkan ke sumber PLN 220V) sehingga lampu LED indikator nyala, LCD juga nyala.
- Remot yang digunakan masih sama tipe remot NEC/remot mp3 player.
- Selanjutnya upload program diatas.
- Tampilan normal pada LCD
6. Tombol yang digunakan
7. Selanjutnya tekan tombol pada remot, misal tombol Power ditekan maka pada LCD
menampilkan
menampilkan
9. Penekanan tombol berikutnya akan direspon setelah 2 detik dan LCD kembali pada tampilan
normal.
Video Project III - 12. Kontrol 4 Buah Relay menggunakan Infrared Remote berbasis Arduino
KAMI MELAYANI JASA PEMBUATAN HARDWARE ATAU SOFTWARE BERBASIS ARDUINO
KONTAK KAMI 085743320570 (adi sanjaya)
No comments:
Post a Comment