Keyes IR Remote Sensor

Keyes IR SensorIR remote

My Bluetooth Remote Control Robot kit also comes with a Keyes Infrared remote sensor and a command .

IR command

You’ll need to install the IR Remote library for this to work. You can get it from github – Arduino-IR. To install, just follow the instructions provided in the README file.

If you want, you can learn a bit more about the IR protocol in the Ken Shirriff’s blog (link below).

This sensor has three PINS, from left to right : GND (-), VCC (2nd PIN), SIGNAL (S).

Let’s connect this to the Arduino. The signal PIN connect to digital PIN 11 (If you choose another, please change it in the sketch below).

Here is the result, from pressing buttons on the remote:



23 Replies to “Keyes IR Remote Sensor

  1. Error on this sketch

    C:Program FilesArduinolibrariesRobotIRremotesrcIRremoteTools.cpp:5:16: error: ‘TKD2’ was not declared in this scope
    int RECV_PIN = TKD2; // the pin the IR receiver is connected to

    Wat to do, i am a beginner.

    Thanks Bert

      1. Hi Bert !

        What libraries did you download ?
        You have to download the correct libraries and put them in the libraries folder – after that, you must rename the library.

        If you download the one i mention in here, after you download it and unzip it, you must renamed it to IRremote . After that, close the Arduino IDE and open it again.

        For your error, and following the path, you didn’t rename it to IRremote – You leaved it as RobotIRremote… You must rename the folder to IRremote – (Again, if you have the Arduino IDE open, you must close it and open it again !

        Hope that helps.

        Best luck !

    1. #include
      IRsend irsend;

      void setup ()
      Serial.begin (9600);

      void loop () {
      if ( ()! = -1) {
      for (int i = 0; i <3; i ++) {
      irsend.sendSony (0xa90, 12); // Sony TV Power code
      delay (100);

      This is the code.
      I've done the steps to give up. and rename to IRremote
      The error remains the same.
      At every sketch.

      Arduino version 1-0.6

      Greetings Bert

      1. Hello Ken.

        It works !!
        I have reset everything, including the P.C
        The I.R now displays the code on the screen.
        I often see FFFFFF among the other code.
        Is that normal?

        Many thanks for your help
        70 years old but not too old to learn.

        Greetings Bert.

  2. Not working yet!

    sketch_feb25a.ino: In function ‘void loop()’:
    sketch_feb25a:11: error: ‘amp’ was not declared in this scope
    sketch_feb25a:11: error: expected )' before ';' token
    sketch_feb25a:11: error: expected
    ;’ before ‘)’ token

    1. Hi Wagner !

      Please remove the amp; word from your code and replace it with the ampersand character. It’s a typo that got there when I migrated my blog from another server. My apologies.

      I’ll update the code !

      It should be “irrecv.decode(&results)”

  3. Your page was incredibly helpful in making my hardware work. A massive thanks from Toronto – your work is greatly appreciated!


    1. Hi Brunce !

      Heres the Link again:

      In the right side of the github page, there’s a button to download a ZIP with all the files.
      Once you download it, unzip it and move the resulting directory – from “Arduino-IRremote-master” to “IRremote” – and move it to your Arduino libraries folder.

      Close the Arduino IDE and open it again. Now you should have the library available to you.

      Best luck

      Bruno Santos

  4. Hi, i’m new to arduino world, the code works fine, but i didn’t understand the object declared on line 5:

    decode_results results;

    Its probably a stupid doubt.


    1. Hi Karl.
      Is not a stupid doubt, is pertinent.

      decode_results is a structure (of the library) that will decode the information received – if you give a look into the examples of the library – the IRrecvDump example, you will understand it .


  5. Arduino: 1.6.8 (Windows 7), Board: “Arduino Due (Programming Port)”

    In file included from C:\Users\Hesham\Documents\Arduino\libraries\IRremote\IRremote.h:24:0,

    from C:\Users\Hesham\Documents\Arduino\libraries\IRremote\IRremote.cpp:25:

    C:\Users\Hesham\Documents\Arduino\libraries\IRremote\IRremote.cpp: In function ‘void TIMER2_COMPA_vect()’:

    C:\Users\Hesham\Documents\Arduino\libraries\IRremote\IRremoteInt.h:92:26: error: ‘PORTB’ was not declared in this scope

    #define BLINKLED_ON() (PORTB |= B00100000)


    C:\Users\Hesham\Documents\Arduino\libraries\IRremote\IRremote.cpp:189:10: note: in expansion of macro ‘BLINKLED_ON’

    else BLINKLED_ON() ; // if no user defined LED pin, turn default LED pin for the hardware on


    C:\Users\Hesham\Documents\Arduino\libraries\IRremote\IRremoteInt.h:93:27: error: ‘PORTB’ was not declared in this scope

    # define BLINKLED_OFF() (PORTB &= B11011111)


    C:\Users\Hesham\Documents\Arduino\libraries\IRremote\IRremote.cpp:191:10: note: in expansion of macro ‘BLINKLED_OFF’

    else BLINKLED_OFF() ; // if no user defined LED pin, turn default LED pin for the hardware on


    Multiple libraries were found for “IRremote.h”
    Used: C:\Users\Hesham\Documents\Arduino\libraries\IRremote
    Not used: C:\Program Files (x86)\Arduino\libraries\IRremote
    exit status 1
    Error compiling for board Arduino Due (Programming Port).

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    I keep getting the above error? any idea what to do ?

  6. Hi HESHAM !

    I believe that you have multiple IRremote libraries and Arduino doesn’t know which one to use. Second, the error reported is on the library and not in your code.
    I haven’t used an Arduino Due so I can’t comment if that’s something with that, but it doesn’t appear to be.
    Please remove all of the libraries for IRremote and try this one:

    Is for Arduino Due – i think the more recent versions don’t support it already.

    Best regards

    1. Hello.

      If you recieve only FFFFFFFF code, check for LD on IR reciever. If it blinks, but you do not touch the remote – it is overwhelmed by some IR source. Try to shield it and try again.

  7. libraries\RobotIRremote\IRremoteTools.cpp.o:(.bss.irrecv+0x0): multiple definition of irrecv'

    sketch\sketch_nov29a.ino.cpp.o:(.bss.irrecv+0x0): first defined here

    libraries\RobotIRremote\IRremoteTools.cpp.o: In function beginIRremote()’:

    D:\Mixly0.94\arduino-1.6.9\libraries\RobotIRremote\src/IRremoteTools.cpp:14: multiple definition of `results’

    sketch\sketch_nov29a.ino.cpp.o:C:\Users\Milky_Way\Documents\Arduino\sketch_nov29a/sketch_nov29a.ino:11: first defined here

    collect2.exe: error: ld returned 1 exit status

    exit status 1

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.