Arduino IR remote

2 arduinos communicate with ir
2 arduinos communicate with ir

Simple Arduino Project : IR Remote

Introduction

Making an arduino based IR remote is fairly simple thanks to the IR library.it enables us to :

  1. Detect and Read IR Signal
  2. Decode It
  3. Send Ir Signal

this project has many applications other than duplicating a TV or radio IR remote but can be used to activate or trigger anything with an IR receiver up to 10 meters away.

Principle :

Arduino IR Remote

the IR light that an IR led cant be seeing with a human eye ( you can use a camera to see it) but IR receivers can.the arduino using the PWM function will blink the led at a certain frequency which is picked up by the TSOP Ir receiver which can interpret those bursts of IR light into data.

Code:

IR Library Download Link :

the first code i used is the IRrecdemo and IRrecvDumpv2 included in the arduino IR library.how can read the IR signal of remotes and decode it .

IR Emitter code :

#include <IRremote.h>

IRsend irsend;

const int switch1 = 4;
 const int switch2 = 5;
 const int switch3 = 6;
 void setup() {
 pinMode(switch1, INPUT_PULLUP);
 pinMode(switch2, INPUT_PULLUP);
 pinMode(switch3, INPUT_PULLUP);

}

void loop() {

if (digitalRead(switch1) == LOW){
 delay(50);
 irsend.sendNEC(0xE0E020DF, 32);}

if (digitalRead(switch2) == LOW){
 delay(50);
 irsend.sendNEC(0xE0E0A05F, 32);}

if (digitalRead(switch3) == LOW){
 delay(50);
 irsend.sendNEC(0xE0E0609F, 32);}

}

IR Receiver code :

#include <IRremote.h> // IR library
 const int RECV_PIN = 11; // TSOP IR Receiver Data PIN

const int switch1 = 2; //Switch or led's to be activated OUTPUTS
 const int switch2 = 3;
 const int switch3 = 4;

IRrecv irrecv(RECV_PIN);
 decode_results results;

void setup() {

irrecv.enableIRIn();
 pinMode(switch1, OUTPUT);
 pinMode(switch2, OUTPUT);
 pinMode(switch3, OUTPUT);
 }

void loop() {
 if (irrecv.decode(&results)) { // Receiving IR Signal and decoding it

irrecv.resume();
 }

if (results.value == 0xE0E020DF) {
 digitalWrite(switch1, HIGH);
 delay(200);
 digitalWrite(switch1, LOW);
 results.value = 0x00000000;
 }

if (results.value == 0xE0E0A05F) {
 digitalWrite(switch2, HIGH);
 delay(200);
 digitalWrite(switch2, LOW);
 results.value = 0x00000000;
 }
 if (results.value == 0xE0E0609F) {
 digitalWrite(switch3, HIGH);
 delay(200);
 digitalWrite(switch3, LOW);
 results.value = 0x00000000;
 }

}

Circuit

2 arduinos communicate with ir
2 arduinos communicate with ir
ir receiver circuit
arduino ir receiver circuit

2 comments

Comments are closed.