Reply to topic  [ 1 post ] 
Low profile 21 button infrared IR remote (HCIRRC0001) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 632
Post Low profile 21 button infrared IR remote (HCIRRC0001)
Image

Order yours here

Description:

Low cost, small, low profile 21 key infrared remote control (HCIRRC0001). The remote uses the very common NEC protocol as a transmission method which will work with many types of infrared receivers including our IR receiver (HCSENS0014) and module (HCSENS0010). Used with a receiver this remote is also great for simple microcontroller and robotic projects where a remote control is required.


Specification:

1. Powered by 1x CR2025 button battery, capacity : 160 mah (included with remote)
2. Working Distance: more than 8 m (effected by surrounding environment, the receiver sensitivity etc. )
3. Effective Angle: 60 degrees
4. Surface materials: 0.125 mm PET stick, With effective life : 20000 times.
5. Stable quality, cost-effective
6. Static current 3-5 uA, dynamic current 3-5 mA.


Example Arduino Sketch:

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

18/09/13 Created version 0.1

This is an example sketch which uses the IR remote control and IR receiver module
to receive infrared IR codes sent by the remote. It will then output the name of
the button pressed to the UART.

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

PINOUT (Receiver facing towards you):

MODULE    ARDUINO
OUT       D11             
GND       GND             
VCC       +5V

The example sketch uses the IRremote library writted by Ken Shirriff
(http://arcfn.com).

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 CHANNEL DOWN button */
    case 0xFFA25D:
      strcpy (CodeName, "CH-");
      break;
     
    /* Received code is for the CHANNEL button */
    case 0xFF629D:
      strcpy (CodeName, "CH");
      break;
       
    /* Received code is for the CHANNEL UP button */
    case 0xFFE21D:
      strcpy (CodeName, "CH+");
      break;
             
    /* Received code is for the REWIND button */         
    case 0xFF22DD:
      strcpy (CodeName, "RW");
      break;
             
    /* Received code is for the FAST FORWARD button */
    case 0xFF02FD:
      strcpy (CodeName, "FF");
      break;
             
    /* Received code is for the PLAY/PAUSE button */
    case 0xFFC23D:
      strcpy (CodeName, "PL");
      break;
             
    /* Received code is for the VOLUME DOWN button */
    case 0xFFE01F:
      strcpy (CodeName, "-");
      break;
             
    /* Received code is for the VOLUME UP button */
    case 0xFFA857:
      strcpy (CodeName, "+");
      break;
             
    /* Received code is for the EQ button */
    case 0xFF906F:
      strcpy (CodeName, "EQ");
      break;
             
    /* Received code is for the number 0 button */
    case 0xFF6897:
      strcpy (CodeName, "0");
      break;
             
    /* Received code is for the + 100 CHANEL button */
    case 0xFF9867:
      strcpy (CodeName, "100+");
      break;

    /* Received code is for the +200 CHANEL button */
    case 0xFFB04F:
      strcpy (CodeName, "200+");
      break;       
       
    /* Received code is for the number 1 button */
    case 0xFF30CF:
      strcpy (CodeName, "1");
      break; 

    /* Received code is for the number 2 button */
    case 0xFF18E7:
      strcpy (CodeName, "2");
      break; 
       
    /* Received code is for the number 3 button */
    case 0xFF7A85:
      strcpy (CodeName, "3");
      break; 
                             
    /* Received code is for the number 4 button */
    case 0xFF10EF:
      strcpy (CodeName, "4");
      break; 
                             
    /* Received code is for the number 5 button */
    case 0xFF38C7:
      strcpy (CodeName, "5");
      break;
       
    /* Received code is for the number 6 button */
    case 0xFF5AA5:
      strcpy (CodeName, "6");
      break; 

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


IRremote library snapshot for above sketch:
Attachment:
ArduinoIRremoteMaster.zip


You do not have the required permissions to view the files attached to this post.


Thu May 29, 2014 1:46 pm
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:  
cron
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD