Reply to topic  [ 1 post ] 
IR Remote Control Kit (HCKITS0006) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 670
Post IR Remote Control Kit (HCKITS0006)
Image

Order yourshere

The Hobby Components IR Remote Control Kit has a transmission frequency of 38KHz and uses the NEC protocol. Depending on the surrounding environment, it has a launch distance of more than 8 meters with an effective angle of 60 degrees. The remote itself has 21 buttons and is powered by 1 CR2025 cell battery, which is included in the kit.

- Sticking Material: 0.125mm PET
- Static Current: 3~5uA, Dynamic Current: 3~5mA

You can purchase this kit here.

IR Receiver pinout

1) GND
2) +5V
3) Signal out

Package contents
1 x Remote controller
1 x IR receiver module
1 x LED
1 x Dupont cable

Example Arduino Sketch

Code:
/* FILE:    ARD_IR_Remote_Kit_Example_HCKITS0006
   DATE:    03/09/13
   VERSION: 0.1
   
REVISIONS:

18/09/13 Created version 0.1

This is an example of how to use the Hobby Components IR remote control kit.
The example sketch uses the IRremote library written by Ken Shirriff
(http://arcfn.com). This library is designed for multiple remote protocols, however
the protocol used by the remote control in this kit uses is the NEC protocol.

This example sketch uses the IR receiver module supplied with the kit to receive IR
codes sent by the remote and displays the button name for each code received with
the UART.

To connect the module to your Arduino please see the following pinout:

PINOUT:

MODULE    ARDUINO
GND       GND             
VCC       +5V             
S         D11

You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used for the purpose of promoting or selling products
that directly compete with Hobby Components Ltd's own range of products.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER. */

/* Include the IRremote library */
#include <IRremote.h>

/* Define the DIO pin used for the receiver */
#define RECV_PIN 11

/* Structure containing received data */
decode_results results;

/* Used to store the last code received. Used when a repeat code is received */
unsigned long LastCode;

/* Create an instance of the IRrecv library */
IRrecv irrecv(RECV_PIN);

void setup()
{
  /* Configure the serial port to display the received codes */
  Serial.begin(9600);
  /* Start receiving codes */
  irrecv.enableIRIn();
  /* Initialise the variable containing the last code received */
  LastCode = 0;
}

/* Main program */
void loop()
{
  /* Has a new code been received? */
  if (irrecv.decode(&results))
  {   
    /* If so get the button name for the received code */
    Serial.println(GetIRIndex(results.value));
   
    /* Start receiving codes again*/
    irrecv.resume();
  }
}

/* Function returns the button name relating to the received code */
String GetIRIndex(unsigned long  code)
{
  /* Character array used to hold the received button name */
  char CodeName[3];
 
  /* Is the received code is a repeat code (NEC protocol) */
  if (code == 0xFFFFFFFF)
  {
    /* If so then we need to find the button name for the last button pressed */
    code = LastCode;
  }
 
  /* Find the button name for the received code */
  switch (code)
  {
    /* Received code is for the UP button */
    case 0xFF629D:
      strcpy (CodeName, "UP");
      break;
     
    /* Received code is for the DOWN button */
    case 0xFFA857:
      strcpy (CodeName, "DN");
      break;
       
    /* Received code is for the LEFT button */
    case 0xFF22DD:
      strcpy (CodeName, "L");
      break;
             
    /* Received code is for the RIGHT button */         
    case 0xFFC23D:
      strcpy (CodeName, "R");
      break;
             
    /* Received code is for the OK button */
    case 0xFF02FD:
      strcpy (CodeName, "OK");
      break;
             
    /* Received code is for the number 1 button */
    case 0xFF6897:
      strcpy (CodeName, "1");
      break;
             
    /* Received code is for the number 2 button */
    case 0xFF9867:
      strcpy (CodeName, "2");
      break;
             
    /* Received code is for the number 3 button */
    case 0xFFB04F:
      strcpy (CodeName, "3");
      break;
             
    /* Received code is for the number 4 button */
    case 0xFF30CF:
      strcpy (CodeName, "4");
      break;
             
    /* Received code is for the number 5 button */
    case 0xFF18E7:
      strcpy (CodeName, "5");
      break;
             
    /* Received code is for the number 6 button */
    case 0xFF7A85:
      strcpy (CodeName, "6");
      break;

    /* Received code is for the number 7 button */
    case 0xFF10EF:
      strcpy (CodeName, "7");
      break;       
       
    /* Received code is for the number 8 button */
    case 0xFF38C7:
      strcpy (CodeName, "8");
      break; 

    /* Received code is for the number 9 button */
    case 0xFF5AA5:
      strcpy (CodeName, "9");
      break; 
       
    /* Received code is for the number 0 button */
    case 0xFF4AB5:
      strcpy (CodeName, "0");
      break; 
                             
    /* Received code is for the number * button */
    case 0xFF42BD:
      strcpy (CodeName, "*");
      break; 
                             
    /* Received code is for the number # button */
    case 0xFF52AD:
      strcpy (CodeName, "#");
      break;
         
    /* Received code is an error or is unknown */
    default:
      strcpy (CodeName, "??");
      break;
    }
   
    /* Save this code incase we get a repeat code next time */       
    LastCode = code;
    /* Return the button name for the received code */
    return CodeName;   
}


Wed Sep 18, 2013 10:29 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD