Finding the IR Codes of Any IR Remote Using Arduino

0 17993 Medium

Let's learn to use your IR Receiver to get the codes of any IR based remote like TV remote, AC remote etc. by using Arduino.

projectImage

Things used in this project

 

Hardware components

HARDWARE LIST
1 DFRobot DFRduino UNO
1 IR receiver (generic)
1 Jumper wires (generic)
1 IR Remote
1 Breadboard (generic)

Software apps and online services

 

Arduino IDE

Story

 

 

 

Introduction

 

Most of the appliances from DTH receiver, TV, AC, etc. are controlled by remotes which are IR remotes.

 

These IR remotes have specific buttons to perform specific functions and these specific buttons have specific codes corresponding to each functions. If you want to make an IR based project the you should be aware of the codes which it sends to various appliances or the IR receiver.

 

 

Getting The Circuit Ready

 

Follow These Steps

 

Connect the first pin from left (OUT pin) with the pin 11 of Arduino. Hook the middle pin (GND pin) with the GND pin of the Arduino. Connect the third pin (VCC pin) with the 5 V pin of the Arduino. 

Uploading The Codes

 

Download and install the IRremote.h library from https://github.com/z3t0/Arduino-IRremote/archive/master.zip

Copy or download the code attached with the project. Hit upload and open serial monitor. Take any remote you want to use or you want the codes off it and press any button. Now, see in the serial monitor. You will see a code of the corresponding button you pressed. The codes will be displayed on the Serial monitor note them. 

Serial Monitor Window

 

Serial Monitor Window

 

Schematics

 

Circuit Diagram

 

 

Code

 

Code for finding the IR codes

C/C++

CODE
#include <IRremote.h>      //including infrared remote header file

int RECV_PIN = 11;        // the pin where you connect the output pin of IR sensor 
IRrecv irrecv(RECV_PIN);
decode_results results;
 
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn();
}
 
void loop() 
{
  if (irrecv.decode(&results)) 
    {
    int value = results.value;
    Serial.println(" ");
    Serial.print("Code: ");
    Serial.println(results.value); //prints the value a a button press
    Serial.println(" ");
    irrecv.resume();              // Receive the next value
    Serial.println("*****************");
      }
}

The article was first published in hackster, June 21, 2018

cr: https://www.hackster.io/shiven2612/finding-the-ir-codes-of-any-ir-remote-using-arduino-f4f054

author: SHIVENDRA VATSA MISHRA

License
All Rights
Reserved
licensBg
0