IR Remote Control Kit (HCKITS0006)

Wireless and wired modules including Bluetooth, Ethernet, and IR kits.
admin
Site Admin
Posts: 866
Joined: Sun Aug 05, 2012 4:02 pm

IR Remote Control Kit (HCKITS0006)

Post by admin » Wed Sep 18, 2013 10:29 am

Image





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 17 buttons and is powered by 1 CR2025 cell battery, which is included in the kit.

For Arduino users please checkout out exclusive library (HCIRNEC) and sketch below

- 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:

  1. /* FILE:    HCIRNEC_IR_Remote_Kit_Example.ino
  2.    DATE:    04/01/20
  3.    VERSION: 1.0
  4.    AUTHOR:  Andrew Davies
  5.    BY:      HobbyComponents.com
  6.    
  7. 04/01/20 version 1.0: Original version
  8.  
  9. This example sketch demonstrates how to use the HCIRNEC library to receive
  10. IR codes using the IR receiver module and remote control found in the Hobby
  11. Components IR remote kit (HCKITS0006).
  12.  
  13. The HCIRNEC library con be downloaded from the software section of our
  14. support forum here:
  15.  
  16. https://forum.hobbycomponents.com/viewtopic.php?f=58&t=2883
  17.  
  18.  
  19. Connect the receiver module from the kit to your Arduino as follows:
  20.  
  21. Module.........Arduino
  22. (-)............GND
  23. (+)............5V for 5V Arduinos (Uno/Nano etc) or 3.3V for 3.3V Arduinos (Due)
  24. (S)............Digital pin 2
  25.  
  26. Caution: Do not connect the module to your Arduino in the above order if your
  27. module is not labelled exactly as above.
  28.  
  29. This library is provided free to support the open source community.
  30. PLEASE SUPPORT HOBBY COMPONENTS so that we can continue to provide free content
  31. like this by purchasing items from our store -
  32.  
  33. HOBBYCOMPONENTS.COM
  34.  
  35.  
  36. You may copy, alter and reuse this code in any way you like, but please leave
  37. reference to HobbyComponents.com in your comments if you redistribute this code.
  38. This software may not be used directly for the purpose of selling products that
  39. directly compete with Hobby Components Ltd's own range of products.
  40. THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
  41. EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
  42. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
  43. HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
  44. INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
  45. REASON WHATSOEVER.
  46. */
  47.  
  48.  
  49. // Include the library
  50. #include "HCIRNEC.h"
  51.  
  52. //Digital pin connected to the S (digital out) pin of the receiver module
  53. #define IRRXPIN 2
  54.  
  55. // Create an instance of the library
  56. HCIRNEC HCIRNEC;
  57.  
  58. // Key code map for the remote control found in the kit
  59. const byte keyMap[][2] = {{0x45, '1'},
  60.                           {0x46, '2'},
  61.                           {0x47, '3'},
  62.                           {0x44, '4'},
  63.                           {0x40, '5'},
  64.                           {0x43, '6'},
  65.                           {0x07, '7'},
  66.                           {0x15, '8'},
  67.                           {0x09, '9'},
  68.                           {0x16, '*'},
  69.                           {0x19, '0'},
  70.                           {0x0D, '#'},
  71.                           {0x18, 'U'},
  72.                           {0x08, 'L'},
  73.                           {0x1C, 'E'},
  74.                           {0x5A, 'R'},
  75.                           {0x52, 'D'}
  76.                           };
  77.  
  78.  
  79. void setup()
  80. {
  81.   Serial.begin(9600);
  82.  
  83.   // Initialise the library to receive Rx codes
  84.   HCIRNEC.initRX(IRRXPIN);
  85. }
  86.  
  87.  
  88. void loop()
  89. {
  90.   int keyName;
  91.  
  92.   // Check for a new code
  93.   byte state = HCIRNEC.newCode();
  94.  
  95.   switch(state)
  96.   {
  97.     case(NEWCODE):  // A new code has been received
  98.       Serial.print("New code: Address = 0x");
  99.       Serial.print(HCIRNEC.address, HEX);
  100.       Serial.print(" code = 0x");
  101.       Serial.print(HCIRNEC.command, HEX);
  102.       Serial.print(" Button name = ");
  103.       keyName = getKey(HCIRNEC.command);
  104.       if(keyName != -1)
  105.         Serial.println((char)keyName);
  106.       else
  107.         Serial.println("Unknown!");
  108.       break;
  109.  
  110.     case(REPEATCODE): // A repeat code has been received
  111.       Serial.println("Repeat code received");
  112.       break;
  113.  
  114.     case(RECEIVEERROR): //An invalid code had been received
  115.       Serial.println("Invalid code received");
  116.       break;
  117.   }
  118. }
  119.  
  120.  
  121.  
  122. // Searches the keyMap array for the received IR code and
  123. // returns the button name. If the IR code is not found
  124. // in the list the function will return a -1.
  125. int getKey(byte code)
  126. {
  127.   byte currRow = 0;
  128.   int keyName = -1;
  129.  
  130.   // Calculate how many rows are in the keyMap array;
  131.   byte numRows = (sizeof(keyMap) / sizeof(keyMap[0]));
  132.  
  133.   // Search for the IR code
  134.   while(currRow < numRows && keyName == -1)
  135.   {
  136.     // If found get the name of the button
  137.     if(keyMap[currRow][0] == code)
  138.       keyName = keyMap[currRow][1];
  139.    
  140.     currRow++;  
  141.   }
  142.   return keyName;
  143. }



Image

The HCIRNEC library con be downloaded from the software section of our
support forum here:

viewtopic.php?f=58&t=2883


Disclaimer: Libraries, example code, and diagrams within this forum thread are provided as an additional free service by Hobby Components and are not sold as part of any product. We do not provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.

steve1001
Posts: 3
Joined: Thu Dec 26, 2019 3:23 am

Re: IR Remote Control Kit (HCKITS0006)

Post by steve1001 » Thu Dec 26, 2019 3:46 am

Hi

I recently received the HCKITS006 kit (a super fast delivery, thanks very much indeed).

The layout on my remote control unit does not match the picture of the remote control in this example.
Hence, the example code does not work for the layout on my remote control unit.

My remote control layout is :-

1 2 3
4 5 6
7 8 9
* 0 #
x up x
left ok right
x down x

This article remote control layout is:-

x up x
left ok right
x down x
1 2 3
4 5 6
7 8 9
* 0 #

Steve

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: IR Remote Control Kit (HCKITS0006)

Post by andrew » Thu Dec 26, 2019 9:03 am

Sorry about that, and thanks for pointing it out. I wasn’t aware that the manufacture had changed the layout. Yours sounds like it’s very similar to the one in the image but I guess the keys have different key codes assigned to them. As it’s boxing day I won’t be able to check the stock until tomorrow but as soon as I can get my hands on from the current stock I’ll check it against the sketch.

One thing that would be very helpful is if you could give me the batch date from the label on the front of the anti-static bag it came in. The batch date will be under our logo on the right-hand side of the label. Thanks.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

steve1001
Posts: 3
Joined: Thu Dec 26, 2019 3:23 am

Re: IR Remote Control Kit (HCKITS0006)

Post by steve1001 » Thu Dec 26, 2019 4:04 pm

Hi Andrew

Thanks for your quick attention. I did not expect anything over the holiday period! Well done.

The HCKITS0006 batch date is "2019 Jul 18 LB025".

After a bit of experimenting, I have adapted the code and can now detect all the button presses perfectly. So, I am sorted and have put the control kit to use in a workshop project

Thanks again.

Steve

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: IR Remote Control Kit (HCKITS0006)

Post by andrew » Fri Dec 27, 2019 9:11 am

Thanks for the information and glad you managed to fix the sketch. As you're no longer waiting on a fix I'll get the example in the first post updated as soon as convenient then.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

hairykrishna
Posts: 2
Joined: Sun May 01, 2022 7:11 pm

Re: IR Remote Control Kit (HCKITS0006)

Post by hairykrishna » Mon May 02, 2022 7:31 pm

I can't seem to get this to compile for a digispark board (basically an attiny85).

C:\Program Files (x86)\Arduino\libraries\HCIRNEC\HCIRNEC.cpp:93:65: error: default argument given for parameter 2 of 'void HCIRNEC::initTX(uint16_t, boolean)' [-fpermissive]
void HCIRNEC::initTX(uint16_t IRTxPin, boolean TxIdleState = LOW)
^
In file included from C:\Program Files (x86)\Arduino\libraries\HCIRNEC\HCIRNEC.cpp:46:0:
C:\Program Files (x86)\Arduino\libraries\HCIRNEC\HCIRNEC.h:71:7: error: after previous specification in 'void HCIRNEC::initTX(uint16_t, boolean)' [-fpermissive]
void initTX(uint16_t IRTxPin, boolean TxIdleState = LOW);
^
exit status 1
Error compiling for board Digispark (Default - 16.5mhz).

Does it use a feature not supported by these chips or something? Works beautifully with an arduino mega.

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: IR Remote Control Kit (HCKITS0006)

Post by andrew » Tue May 03, 2022 10:12 am

I've just uploaded a new version of the library (V1.1) which should hopefully fix the error:

viewtopic.php?f=58&t=2883&p=7321#p7321


Note, to update you can just copy the .cpp and .h files out of the downloaded zip file and paste them over the ones you have in your \Arduino\libraries\HCIRNEC folder
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

hairykrishna
Posts: 2
Joined: Sun May 01, 2022 7:11 pm

Re: IR Remote Control Kit (HCKITS0006)

Post by hairykrishna » Thu May 05, 2022 7:35 am

Amazing - thank you. Better support than hardware I've paid thousands for!

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: IR Remote Control Kit (HCKITS0006)

Post by andrew » Fri May 06, 2022 7:41 am

Thanks for confirming the fix and the feedback is much appreciated.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

ChrisSharp
Posts: 30
Joined: Thu Dec 31, 2020 1:22 pm

Re: IR Remote Control Kit (HCKITS0006)

Post by ChrisSharp » Mon Nov 27, 2023 2:46 pm

Hi,

Have you updated the remote, but not the listing? I'm only counting 17 buttons on my remote, not the 21 in the listing.

Not a problem, just checking I'm not missing something.

Cheers
Chris

Post Reply

Return to “Wireless / Wired”