FYI: 44 button IR remote for your projects

I thought this might be of some interest to those who need a simple method to send keyboard data to their Arduino projects.
IR keypad used:
http://www.dipmicro.com/store/RGB-LEDCTL-RM44
See the sketch below for implementation.
Attached is a modified Library to handle code IR reception.
Enjoy.

//
//44 button IR remote
//NEC - IR code
//LarryD
//
//This task demonstrates interfacing to a 44 button IR remote 
//which is commonly available on EBay for $3 - $5 USD.
//These remotes usually come with a controller which includes a
//all in one IR detector and amplifier similar to TSOP38238.
//Remove the detector from the controller for this discussion.
//See: https://www.sparkfun.com/datasheets/Sensors/Infrared/tsop382.pdf
//Hook the sensor to Pin D2 for this sketch,
//for reference, see: https://learn.sparkfun.com/tutorials/ir-control-kit-hookup-guide
//Interrupt 0 (pin D2) is used to achieve fast receive response.
//
// Rev 1.0 January 1, 2015
//==========================================


//Original library was from
//https://github.com/adafruit/Adafruit-NEC-remote-control-library
//however, to remove blocking it was modified and assigned the name:
//Adafruit-NECremote44.h Adafruit-NECremote44.cpp

#include "Adafruit-NECremote44.h" 

const byte irPin = 2;
Adafruit_NECremote remote(irPin);

volatile byte irFlag = 0;

const byte buttonCode[44] = {
  0x5C,0x5D,0x41,0x40,
  0x58,0x59,0x45,0x44,
  0x54,0x55,0x49,0x48,
  0x50,0x51,0x4D,0x4C,
  0x1C,0x1D,0x1E,0x1F,
  0x18,0x19,0x1A,0x1B,
  0x14,0x15,0x16,0x17,
  0x10,0x11,0x12,0x13,
  0xC,0xD,0xE,0xF,
  0x8,0x9,0xA,0xB,
  0x4,0x5,0x6,0x7
}; //END of buttonCode Array

const byte ASCIIcode[44] = {
  0x31,0x32,0x33,0x34,
  0x35,0x36,0x37,0x38,
  0x39,0x30,0x2A,0x23,
  0x41,0x42,0x43,0x44,
  0x45,0x46,0x47,0x48,
  0x49,0x4A,0x4B,0x4C,
  0x4D,0x4E,0x4F,0x50,
  0x51,0x52,0x53,0x54,
  0x55,0x56,0x57,0x58,
  0x59,0x5A,0xFA,0xFB,
  0xFC,0xFD,0xFE,0xFF
}; //END of ASCIIcode Array 

//================================================
void setup(void) 
{
  Serial.begin(115200);
  attachInterrupt (0, irISR, FALLING);  // attach interrupt handler
} //         END of setup()

//================================================
void loop(void) 
{

  //check if there is a code is coming in
  if(irFlag)
  {
    //Button retrieval
    int code = getCode();
    if (code >= 0) 
    {
      //button code to ASCII code conversion
      for (int i = 0; i < 44; i++)
      {
        if (buttonCode[i] == code)
        {
          Serial.println(char(ASCIIcode[i]));
          break;
        } 
      }
    }
  } //END of Button retrieval

  // Other loop stuff goes here

}//         END of loop()


//================================================
int getCode()
{
  detachInterrupt (0);

  //get the code received from the remote
  int c = remote.listen(-1); //a negative defaults to a code length of 80ms  
  irFlag = 0; //re-enable code capturing 
  attachInterrupt (0, irISR, FALLING);  

  return c;

}  //END  of getCode()


//================================================
// Interrupt Service Routine (ISR)
void irISR ()
{
  irFlag = 1;
}  // end of irISR()

Edit: ******* Changed interrupt to FALLING *******

2014-12-31_12-48-05.jpg

Adafruit-NECremote44.zip (4.26 KB)

Very cool!

Here are 1:1 PDFs for the overlays.
One for Portrait and one for Landscape.
Print them on a gummed label, laminate, then place overlay on the original.

NOTE:
If you decide to use the Landscape overlay, you will have to make the appropriate changes to the ASCIIcode array.

For your applications.

  • Only takes one GPIO Pin D2 or D3.
  • Rather than using buttons as inputs send a button press from the keyboard. (no wires!).
  • Control relays directly from the keyboard.
  • Set timing values ex. time of day, delays, on times . . .
  • Set the intensity of a LED
    etc.

KeyPad 44 Button PORT.pdf (188 KB)

KeyPad 44 Button.pdf (379 KB)

What! No "P"?

Thanks. Got to fix that :-[

I found the P :cold_sweat:

Here are the Landscape arrays:

//  P o r t r a i t 
/*
const byte buttonCode[44] = {
  0x5C,0x5D,0x41,0x40,
  0x58,0x59,0x45,0x44,
  0x54,0x55,0x49,0x48,
  0x50,0x51,0x4D,0x4C,
  0x1C,0x1D,0x1E,0x1F,
  0x18,0x19,0x1A,0x1B,
  0x14,0x15,0x16,0x17,
  0x10,0x11,0x12,0x13,
  0xC,0xD,0xE,0xF,
  0x8,0x9,0xA,0xB,
  0x4,0x5,0x6,0x7
}; //END of buttonCode Array

const byte ASCIIcode[44] = {
  // 1    2    3    4
  0x31,0x32,0x33,0x34,
  // 5    6    7    8
  0x35,0x36,0x37,0x38,
  // 9    0    *    #
  0x39,0x30,0x2A,0x23,
  // A    B    C    D
  0x41,0x42,0x43,0x44,
  // E    F    G    H
  0x45,0x46,0x47,0x48,
  // I    J    K    L
  0x49,0x4A,0x4B,0x4C,
  // M    N    O    P
  0x4D,0x4E,0x4F,0x50,
  // Q    R    S    T
  0x51,0x52,0x53,0x54,
  // U    V    W    X
  0x55,0x56,0x57,0x58,
  // Y    Z    
  0x59,0x5A,0xFA,0xFB,
  //
  0xFC,0xFD,0xFE,0xFF
}; //END of ASCIIcode Array 
*/

//  L a n d s c a p e
///*
const byte buttonCode[44] = {
  0x4,0x8,0xC,0x10,0x14,0x18,0x1C,0x50,0x54,0x58,0x5C,
  0x5,0x9,0xD,0x11,0x15,0x19,0x1D,0x51,0x55,0x59,0x5D,
  0x6,0xA,0xE,0x12,0x16,0x1A,0x1E,0x4D,0x49,0x45,0x41,
  0x7,0xB,0xF,0x13,0x17,0x1B,0x1F,0x4C,0x48,0x44,0x40
}; //END of buttonCode Array

const byte ASCIIcode[44] = {
  // 1    2    3    4    5    6    7    8    9    0    -  
  0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x30,0x2D,
  // Q    W    E    R    T    Y    U    I    O    P    ^
  0x51,0x57,0x45,0x52,0x54,0x59,0x55,0x49,0x4F,0x50,0x5E,
  //Shift A    S    D    F    G    H    J    K    L    v
  0xFC,0x41,0x53,0x44,0x46,0x47,0x48,0x4A,0x4B,0x4C,0x7E,
  //<     Z    X    C    V    B Space   N    M Enter   >    
  0x3C,0x5A,0x58,0x43,0x56,0x42,0x20,0x4E,0x4D,0x0A,0x3E
}; //END of ASCIIcode Array 
//*/

Edit:

Added sketch as of January 21, 2015 and added schematic

//***********************************************************************************
//44 button IR remote
//NEC - IR code
//LarryD
//
//This task demonstrates interfacing to a 44 button IR remote 
//which is commonly available on EBay for $3 - $5 USD.
//These remotes usually come with a controller which includes a
//all in one IR detector and amplifier similar to TSOP38238.
//Remove the detector from the controller for this discussion.
//See: https://www.sparkfun.com/datasheets/Sensors/Infrared/tsop382.pdf
//Hook the sensor to Pin D2 for this sketch,
//for reference, see: https://learn.sparkfun.com/tutorials/ir-control-kit-hookup-guide
//Interrupt 0 (pin D2) is used to achieve fast receive response.
//See also: http://forum.arduino.cc/index.php?topic=289446.msg2024776#new
//
//Most Arduino boards have two external interrupts: numbers 0 (on digital pin 2) and 1 (on digital pin 3). 
//The table below shows the available interrupt pins on various boards. 
//Board       int.0  int.1  int.2  int.3  int.4  int.5 
//Uno, Ethernet   2      3      -      -      -      -    
//Mega2560        2      3     21     20     19     18 
//Leonardo        3      2      0      1      7      -
//
//
// Rev 1.0    January 1, 2015 - Original sketch
// Rev 1.01   January 2, 2015 - Added Landscape orientation
// Rev 1.02   January 4, 2015 - Added Sonalert pin 7 to GND. Provides feedback with each key press.
//
//***********************************************************************************


//Original library was from
//https://github.com/adafruit/Adafruit-NEC-remote-control-library
//however, to remove blocking it was modified and assigned the name:
//Adafruit-NECremote44.h Adafruit-NECremote44.cpp

#include "Adafruit-NECremote44.h" 

const byte irPin = 2;
Adafruit_NECremote remote(irPin);
const byte tonePin = 7;            //sonalert connected here 1.02

volatile byte irFlag = 0;

//  Portrait keypad definitions
/*
const byte buttonCode[44] = {
 0x5C,0x5D,0x41,0x40,
 0x58,0x59,0x45,0x44,
 0x54,0x55,0x49,0x48,
 0x50,0x51,0x4D,0x4C,
 0x1C,0x1D,0x1E,0x1F,
 0x18,0x19,0x1A,0x1B,
 0x14,0x15,0x16,0x17,
 0x10,0x11,0x12,0x13,
 0xC,0xD,0xE,0xF,
 0x8,0x9,0xA,0xB,
 0x4,0x5,0x6,0x7
 }; //END of buttonCode Array
 
 const byte ASCIIcode[44] = {
 // 1    2    3    4
 0x31,0x32,0x33,0x34,
 // 5    6    7    8
 0x35,0x36,0x37,0x38,
 // 9    0    *    #
 0x39,0x30,0x2A,0x23,
 // A    B    C    D
 0x41,0x42,0x43,0x44,
 // E    F    G    H
 0x45,0x46,0x47,0x48,
 // I    J    K    L
 0x49,0x4A,0x4B,0x4C,
 // M    N    O    P
 0x4D,0x4E,0x4F,0x50,
 // Q    R    S    T
 0x51,0x52,0x53,0x54,
 // U    V    W    X
 0x55,0x56,0x57,0x58,
 // Y    Z    
 0x59,0x5A,0xFA,0xFB,
 //
 0xFC,0xFD,0xFE,0xFF
 }; //END of ASCIIcode Array 
 */

//  Landscape keypad definitions 1.01

const byte buttonCode[44] = {
  0x4,0x8,0xC,0x10,0x14,0x18,0x1C,0x50,0x54,0x58,0x5C,
  0x5,0x9,0xD,0x11,0x15,0x19,0x1D,0x51,0x55,0x59,0x5D,
  0x6,0xA,0xE,0x12,0x16,0x1A,0x1E,0x4D,0x49,0x45,0x41,
  0x7,0xB,0xF,0x13,0x17,0x1B,0x1F,0x4C,0x48,0x44,0x40
}; //END of buttonCode Array

const byte ASCIIcode[44] = {
  // 1    2    3    4    5    6    7    8    9    0    -  
  0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x30,0x2D,
  // Q    W    E    R    T    Y    U    I    O    P    ^
  0x51,0x57,0x45,0x52,0x54,0x59,0x55,0x49,0x4F,0x50,0x5E,
  //Shift A    S    D    F    G    H    J    K    L    v
  0xFC,0x41,0x53,0x44,0x46,0x47,0x48,0x4A,0x4B,0x4C,0x76,
  // <    Z    X    C    V    B Space   N   M NewLine  >    
  0x3C,0x5A,0x58,0x43,0x56,0x42,0x20,0x4E,0x4D,0x0A,0x3E
}; //END of ASCIIcode Array 



//================================================
void setup(void) 
{
  Serial.begin(115200);
  attachInterrupt (0, irISR, FALLING);  // attach interrupt handler
} //         END of setup()

//================================================
void loop(void) 
{

  //**************************************
  //check if there is a code is coming in
  if(irFlag)
  {
    //Button retrieval
    int code = getCode();
    if (code >= 0) 
    {
      //button code to ASCII code conversion
      for (int i = 0; i < 44; i++)
      {
        if (buttonCode[i] == code)
        {
          tone(tonePin,3400,100);
          Serial.print(char(ASCIIcode[i]));
          break;
        } 
      }
    }
  } //END of if(irflag) //Button retrieval
  //**************************************

  // Other loop stuff goes here

}//         END of loop()


//================================================
int getCode()
{
  detachInterrupt (0);

  //get the code received from the remote
  int c = remote.listen(-1); //a negative says the IR meassage is ~80ms 

  irFlag = 0; //re-enable code capturing 
  attachInterrupt (0, irISR, FALLING);  

  return c;

}  //END  of getCode()


//================================================
// Interrupt Service Routine (ISR)
void irISR ()
{
  irFlag = 1;
}  // end of irISR()