Arduino IR remote

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




which is all we need for an infrared remote as we will be sending a coded message to be able to identify each button.

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 :

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

Resistor Color Code value ?

How To Read A Resistor Value ?

Reading a resistor value is an essential basic for electronics work and a very easy one. first of all the most common used color code is 4 bands as the value of a resistor is in the 4 colors around it.

4 Colors Resistor Type:

the first two bands or colors represent the resistance value in digitsthe third color or band represent the multiplier which means how many zeros after the two digits,at last the fourth represents the tolerance or accuracy of the resistor the most common is gold which means  ±5%.

Resistor Color Code Table

resistor color code

5 Colors Resistor Type:

In addition the 5 bands type its the same except the first three are the digits and the forth is the multiplier leaving the fifth color band of the resistor to be the tolerance and that’s it for understanding the colors. now the color code is this one

Color 1st digit 2nd digit 3rd digit* Multiplier Tolerance Temp. Coef. Fail Rate
Black 0 0 0 ×100
Brown 1 1 1 ×101 ±1% (F) 100 ppm/K 1%
Red 2 2 2 ×102 ±2% (G) 50 ppm/K 0.1%
Orange 3 3 3 ×103 15 ppm/K 0.01%
Yellow 4 4 4 ×104 25 ppm/K 0.001%
Green 5 5 5 ×105 ±0.5% (D)
Blue 6 6 6 ×106 ±0.25%(C)
Violet 7 7 7 ×107 ±0.1% (B)
Gray 8 8 8 ×108 ±0.05% (A)
White 9 9 9 ×109
Gold ×0.1 ±5% (J)
Silver ×0.01 ±10% (K)
None ±20% (M)