top of page

Priject Name : How to utilize IR remote with Arduino Uno.

 

Project Description :

The main issue of this project is to allow any one who have a IRremote kit to use it with any external device.   You may control/trigger devices such as : Motors, Bulbs, servos, drills e.t.c.  You may actuate any device from a distance as long as 8 meter quite accurately. 

The only disadvantage is that the remote should be aligned with the sensor.

 

Components Needed :

1.  Arduino uno.

2.  One Relay module.

3. IRremote kit included Remote Control Transmeter, receiver sensor, (it comes with a transmitting led as well).

4.  Any device to actuate, preferable with external power.

5. Power suplly to the Arduino Or you may use the USB power.

 

 

CODE AND EXPLAINATION WILL COME SOON

/*
 IR Remote with Keyes kit.
 By Yohi Zucker
 based on  Ken Shirriff code.
 May 9,2015
  */

#include <IRremote.h> // The IR remote library

int RECV_PIN = 11;//IR reciever signal connected to pin 11
long const up = 16736925;//up code from keyes remote in decimal notation
long const down = 16754775;//down code from keyes remote in decimal notation

IRrecv irrecv(RECV_PIN);//create instance of irrecv object named -irrecv

decode_results results;//create  instance of of decode_results object named - results

void setup()
{
  pinMode(3,OUTPUT);//led lit when UP bottun pushed (on the relay module)
  pinMode(5,OUTPUT);//led lit when DOWN bottun pushed (on the relay module)
  pinMode(8,OUTPUT);//actuate the relay
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  long button;
  if (irrecv.decode(&results))// If button pressed

{                                                                                                                                      //first if begins here
     button=results.value;// Variable button get the value pressed
 
     if(button==up)

     {                                                                                                                                  //second if begins here
       digitalWrite(3,HIGH);
       digitalWrite(8,HIGH);

     }                                                                                                                                     //second if ends here
        else

            {                                                                                                                              //this else belong to second if  
              digitalWrite(3,LOW);
               digitalWrite(8,LOW);

                                                      }                                                                                  //   else of second if ends here
                       if(button==down)

                            {                                                                                                              //third if begins here
                                  digitalWrite(5,HIGH);

                            }                                                                                                                  //third if ends here
                                         else

                                             {                                                                                                //this else belong to third if  
                                                   digitalWrite(5,LOW);

                                                                                       }                                                         //   else of third if ends here
        delay(500);
    irrecv.resume(); // Receive the next value
  }                                                                                                                                        //   first if ends here

 

 

bottom of page