Remote Control Infrared

Indobot Academy

Inframerah adalah teknologi nirkabel yang banyak digunakan dan juga mudah diimplementasikan yang memiliki banyak aplikasi berguna. Oleh karena itu contoh paling menonjol dalam kehidupan sehari-hari adalah remote control TV. Radiasi inframerah merupakan suatu bentuk cahaya yang mirip dengan cahaya yang bahkan kita lihat di sekitar kita. Satu-satunya perbedaan antara cahaya IR dan juga cahaya tampak adalah frekuensi dan panjang gelombangnya. Frekuensi dan panjang gelombang inframerah berada di luar jangkauan cahaya tampak. 

Sistem komunikasi inframerah membutuhkan pemancar IR dan juga penerima IR. Untuk mencegah noise yang mengganggu sinyal IR, teknik modulasi sinyal digunakan. Dalam modulasi sinyal IR, encoder pada remote IR mengubah sinyal biner menjadi sinyal listrik termodulasi. Dalam modulasi sinyal IR, encoder pada remote IR mengubah sinyal biner menjadi sinyal listrik termodulasi. Sinyal listrik ini dikirim ke LED pemancar. Penerima IR kemudian mendemodulasi sinyal lampu IR dan mengubahnya kembali ke biner sebelum meneruskan informasi ke mikrokontroler.

Library IR Remote https://github.com/z3t0/Arduino-IRremote

1. Skema Rangkaian

Gambar rangkaian Remote Control Infrared

 

2. Alat / Bahan
  • Arduino                                        : 1 buah
  • Breadboard                                  : 1 buah
  • LED dengan warna berbeda        : 4 buah
  • Infrared Receiver TSOP38238     : 1 buah
  • Resistor 220Ω                              : 1 buah
  • Remote Control Infrared              : 1 buah

Gambar Remote yang digunakan

 

3. Sketch Program

Belajar elektronika step by step dengan bantuan tangga belajar? lanjut Regitrasi dulu dan dapatkan konsultasi dari kami!

a. Program Inisialisasi kode

/*
  Program Scan Kode IR
  dibuat oleh Indobot
*/
#include <IRremote.h>  //Pendeklarasian Library

const int RECV_PIN = 7;  // Pemilihan Pin OUTPUT dan pendeklarasian variabel
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup() { //Pengaturan Pin
  Serial.begin(9600);
  irrecv.enableIRIn();
  irrecv.blink13(true);
}

void loop() { //Perulangan Program
  if (irrecv.decode(&results)) { //Pencarian Kode IR
    Serial.println(results.value, HEX); //Penampilan Kode IR
    irrecv.resume();
  }
}

Jalankan program di atas, kemudian buka terminal serial, kemudian tekan masing-masing tombol pada remote.

Gambar Terminal Serial

Tabel Tombol Remote dan juga Kode Hexadesimal

Tombol

Kode Hexa

CH- 0xFFA25D
CH 0xFF629D
CH+ 0xFFE21D
<< 0xFF22DD
>> 0xFF02FD
>|| 0xFFC23D
0xFFE01F
+ 0xFFA857
EQ 0xFF906F
100+ 0xFF9867
200+ 0xFFB04F
0 0XFF6897
1 0xFF30CF
2 0xFF18E7
3 0xFF7A85
4 0xFF10EF
5 0xFF38C7
6 0xFF5AA5
7 0xFF42BD
8 0xFF4AB5
9 0xFF52AD

 

b. Program kontrol nyala LED

/*
  Program Remote Kontrol IR
  dibuat oleh Indobot
*/
#include &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;lt;IRremote.h&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;gt;  //Pendeklarasian Library

const int RECV_PIN = 7;  // Pemilihan Pin OUTPUT dan pendeklarasian variabel
IRrecv irrecv(RECV_PIN);
decode_results results;
const int redPin = 8;
const int bluePin = 9;
const int orangePin = 10;
const int yellowPin = 11;

void setup() {   //Pengaturan Pin
  irrecv.enableIRIn();
  irrecv.blink13(true);
  pinMode(redPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  pinMode(orangePin, OUTPUT);
  pinMode(yellowPin, OUTPUT);
}

void loop() {  //Perulangan Program
  if (irrecv.decode(&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;results)) {   //Pencarian Kode IR
    /*Kode Perintah Remote*/
    switch (results.value) {
      case 0xFF30CF: //Keypad button "1"
        digitalWrite(redPin, HIGH);
        delay(2000);
        digitalWrite(redPin, LOW);
    }

    switch (results.value) {
      case 0xFF18E7: //Keypad button "2"
        digitalWrite(bluePin, HIGH);
        delay(2000);
        digitalWrite(bluePin, LOW);
    }
    switch (results.value) {
      case 0xFF7A85: //Keypad button "3"
        digitalWrite(orangePin, HIGH);
        delay(2000);
        digitalWrite(orangePin, LOW);
    }
    switch (results.value) {
      case 0xFF10EF: //Keypad button "4"
        digitalWrite(yellowPin, HIGH);
        delay(2000);
        digitalWrite(yellowPin, LOW);
    }

    irrecv.resume();
  }
}

Kesimpulan :

Dalam Project ini, sensor IR menerima pancaran dari remote IR kemudian mendemodulasi sinyal dan mengubahnya kembali ke biner dan diteruskan ke Arduino untuk menjalankan suatu perintah seperti menyalakan LED pada setiap tombol yang telah di program.

Bikin project tanpa ribet beli komponen sana-sini? Starter Kit Arduino/IoT bisa jadi solusi mu!

Ingin Tahu Program Kami Lebih Lanjut?

Silahkan isi Formulir Dibawah Ini untuk Diskusi dengan Tim Indobot Academy.

Baca Juga

Bagikan:

Tinggalkan komentar

whatsapp whatsapp