How to Decode IR Remote Control Signals using Arduino

We are going to decode the IR Remote Control using the arduino and IR remote library. We can also decode any tv remote control. And use those tv remote control code in the arduino sketch to run any application. As we have seen, some devices are running using the ir remote. There is some kind of IR communication between the ir remote and the receiver devices who receive the ir signal. This is not the simple IR transmitter and receiver as we use in different robotics and embedded sensors.

The transmitter IR  sends a frequency signal instead of a simple IR light. TV remote control or ir remote send the signal at long distance it sends the signal at some frequency like 38KHz.

At the receiver side, we use the IR receiver which is compatible to receive the frequency signal sent from the transmitter. If a signal is transmitted with a frequency of 38KHz then we need a receiver which is capable of receiving the signal of 38KHz.

Available TSOP with Different Carrier Frequencies

TSOP  Frequency
TSOP1730 30KHz
TSOP1733 33KHz
TSOP1736 36KHz
TSOP1737 36.7
TSOP1738 38KHz
TSOP1740 40KHz
TSOP1756 56KHz

TSOP IR sensor receives a specific frequency signal as given in the table.

The TSOP1733 receiver will receive the only 33KHz signal.

Why use TSOP Based IR Receiver

The simple IR sensor gives false detection when using in presence of the sunlight. The signal sends from the normal IR led can not cover a long distance. TSOP is a complex IR sensor which can differentiate between the actual signal send from IR remote and the sunlight. The data bits at transmitter side are modulated at some frequency like 38KHz. TSOP receives it filter the noise and extract the original signal.

TSOP1738 Pinout

TSOP1738 Block Diagram

TSOP1738 Application Circuit

Download IR Remote Library and place in Arduino/libraries folder.

IR Remote Control Decoder Arduino Connection

TSOP IR Remote Control Receiver Arduino Circuit

To decode the IR Remote Control we use the IRrecvDemo arduino sketch as given with the IR Remote Library. And connect the TSOP1738 to the arduino as given in the circuit.


/* IRremote: 
IRrecvDemo - demonstrates receiving IR codes with IRrecv 
An IR detector/demodulator must be connected to the input RECV_PIN. 
Version 0.1 July, 2009
Copyright 2009 Ken Shirriff * 

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
  irrecv.enableIRIn(); // Start the receiver

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);                 
    irrecv.resume(); // Receive the next value
  • Connect the output pin of TSOP1738 to Arduino digital pin 11 to get the decoded output
  • Write the IRrecvDemo.ino sketch to the Arduino
  • The open serial terminal at 9600 baud rate.
  • Press the IR Remote button while pointing remote towards the IR Receiver
  • You will see some hex value when pressing the button
  • Note Down
  • Repeat few times and make sure you are getting the same hex value for a single button.

IR Remote Control Decoded Output at Arduino Serial Terminal

Here the hex value 1FE50AF is for button 1 and hex value 1FED827 is for button 2. So finally we decoded the button from 0-9 with all hex code given in the table below.

Button Hex Value
0 0x1FEE01F
1 0x1FE50AF
2 0x1FED827
3 0x1FEF807
4 0x1FE30CF
5 0x1FEB04F
6 0x1FE708F
7 0x1FE00FF
8 0x1FEF00F
9 0x1FE9867

Now use these codes in arduino sketch. When these codes match with the stored one do something. Here we have written the code that decodes the IR remote control button and shows the button number on the serial monitor.


/* Decode the IR Remote Control signal and display 
the button/key name on the serial monitor using the 
IRremote: IRrecvDemo April, 2017  

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
  irrecv.enableIRIn(); // Start the receiver

void loop() {
  if (irrecv.decode(&results)) {
   // Serial.println(results.value, HEX);    //showing decoded data on serial terminal
        case 0x1FE50AF:  Serial.println("This is 1"); break; // Button 1
        case 0x1FED827:  Serial.println("This is 2"); break; // Button 2
        case 0x1FEF807:  Serial.println("This is 3"); break; // Button 3
        case 0x1FE30CF:  Serial.println("This is 4"); break; // Button 4
        case 0x1FEB04F:  Serial.println("This is 5"); break; // Button 5
        case 0x1FE708F:  Serial.println("This is 6"); break; // Button 6
        case 0x1FE00FF:  Serial.println("This is 7"); break; // Button 7
        case 0x1FEF00F:  Serial.println("This is 8"); break; // Button 8
        case 0x1FE9867:  Serial.println("This is 9"); break; // Button 9
        case 0x1FEE01F:  Serial.println("This is 0"); break; // Button 0          
    irrecv.resume(); // Receive the next value

So from the above sketch, we can decode the button from 0-9 and displayed their name on the arduino serial monitor.

So finally we have learned how to decode the IR remote signal using the Arduino. We can make different Arduino projects once we know the ir remote decoding. 

In our next Arduino tutorial, you can learn

13 Comments on “How to Decode IR Remote Control Signals using Arduino”

    1. Hello Chris J,
      The received values are in hexadecimal as shown in the picture.
      And while using those values in programming we should add the 0x before the values.
      This is simply a notation to write hexadecimal values so that compiler and IDE can understand.

      Comment on any other issues.


    1. Hello farzin,
      Step 1: Receive/Decode the TV signal according to the tutorial.
      Step 2: Use the below code to generate/transmit the IR signal from arduino.

      IRsend irsend;

      void setup()

      void loop() {
      irsend.sendNEC(0x1FE50AF,56); // replace 0x1FE50AF hex code by your received code
      Step 3: Apply some condition when to execute the irsend.sendNEC(); function

      Try this and ask if you have any doubt.

      1. Hello admin
        you send cod ialternative hex code tv samsung remote control
        E0E040BF key power but No effect on performance.

        i want recieve remote controle signal byIR reciever and send it to IR transmitter for commonicate between remote control and TV by IR transmitter . i use arduino and need a code to planning this one . what should i do ?

        1. Hello Farzin,
          You just try to decode the code of your TV Remote. If yes, then give me all the code.
          Then I can help you later.
          Here my remote work for(NEC) irsend.sendNEC();{irsend.sendNEC(0x1FE50AF,56);}
          What work for you try it.
          There are a few common protocols the IR Arduino library supports. They are: NEC, Sony SIRC, Philips RC5, Philips RC6, and raw formats. Here are the methods you can use in your Arduino code for different manufacturers:

          Hope you got my point.

          1. Hello admin
            I can give you all of codes.
            I want planning that send information from all remote control to their reciever . my target is reciever sattlite.
            Thank you very much for your help

  1. Hello admin
    my cod
    power 20DE50AF
    OK 20DEB04F
    mute 20DE9867
    1 20DE807F
    2 20DE40BF

    /* send.ino Example sketch for IRLib2
    * Illustrates how to send a code.
    #include // First include the send base
    //Now include only the protocols you wish to actually use.
    //The lowest numbered protocol should be first but remainder
    //can be any order.
    #include // After all protocols, include this
    // All of the above automatically creates a universal sending
    // class called “IRsend” containing only the protocols you want.
    // Now declare an instance of that sender.

    IRsend mySender;

    void setup() {
    delay(2000); while (!Serial); //delay for Leonardo
    Serial.println(F(“Every time you press a key is a serial monitor we will send.”));

    void loop() {
    if ( != -1) {
    //send a code every time a character is received from the
    // serial port. You could modify this sketch to send when you
    // push a button connected to an digital input pin.
    //Substitute values and protocols in the following statement
    // for device you have available.
    mySender.send(NEC,0x20DE50AF, 32);
    //mySender.send(NEC,0x20DE50AF,32);//NEC TV power button=0x20DE50AF
    Serial.println(F(“Sent signal.”));

    Given the above code, how can I send the same code by pressing the same button?

  2. please, I want to design an infrared remote control system for 1 light and fan with speed regulation using ardruino. can you please help me out.

    1. Hi ike,
      I can help you, but without speed regulation of FAN.
      The system will simply ON and OFF both the systems with two respective switches.
      If you are interested then comment below.


Leave a Reply

Your email address will not be published. Required fields are marked *