Reply to topic  [ 5 posts ] 
IR receiver module (HCSENS0010) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 631
Post IR receiver module (HCSENS0010)
Image

Order yours here

Description:
Infrared receiver module uses a 1838 infrared receiver. This is a universal type, with steel, bendable legs.

Size: 6.4 * 7.4 * 5.1MM, acceptance angle 90 °, working voltage 2.7-5.5V.
Frequency 37.9KHZ, receiving distance 18 m.

Daylight rejection up to can 500LUX, electromagnetic interference capability, built-in infrared dedicated IC.
Widely used: stereo, TV, VCR, CD, set-top boxes, digital photo frame, car audio, remote control toys, satellite receivers, hard disk player, air conditioners, heaters, fans, lighting and other household appliances.


Pinout:


Image




Example Arduino Sketch:

Code:
/* FILE:    HC_Exp_Kit_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 (NEC protocol) and IR
receiver module (HCSENS0010) 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                       
VCC       +5V
GND       GND   

Please note: The HCSENS0010 module reverses the order of the VCC and GND pins.
Make sure you connect these pins in the correct order. You can reference the screen
print on the module, or the diagrams in our forum post here:

http://forum.hobbycomponents.com/viewtopic.php?f=74&p=4901

The example sketch uses the IRremote library written 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 recieving 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 POWER button */
    case 0xFFA25D:
      strcpy (CodeName, "PW");
      break;
     
    /* Received code is for the MODE button */
    case 0xFF629D:
      strcpy (CodeName, "MO");
      break;
       
    /* Received code is for the MUTE button */
    case 0xFFE21D:
      strcpy (CodeName, "MU");
      break;
             
    /* Received code is for the PLAY/PAUSE button */         
    case 0xFF22DD:
      strcpy (CodeName, "PL");
      break;
             
    /* Received code is for the REWIND button */
    case 0xFF02FD:
      strcpy (CodeName, "RW");
      break;
             
    /* Received code is for the FAST FORWARD button */
    case 0xFFC23D:
      strcpy (CodeName, "FF");
      break;
             
    /* Received code is for the EQ button */
    case 0xFFE01F:
      strcpy (CodeName, "EQ");
      break;
             
    /* Received code is for the VOLUME - button */
    case 0xFFA857:
      strcpy (CodeName, "-");
      break;
             
    /* Received code is for the VOLUME + button */
    case 0xFF906F:
      strcpy (CodeName, "+");
      break;
             
    /* Received code is for the number 0 button */
    case 0xFF6897:
      strcpy (CodeName, "0");
      break;
             
    /* Received code is for the RANDOM button */
    case 0xFF9867:
      strcpy (CodeName, "RN");
      break;

    /* Received code is for the UD/SD button */
    case 0xFFB04F:
      strcpy (CodeName, "SD");
      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;   
}


Arduino Library:
The above example sketch uses the IR Remote Library written by Ken Shirriff (http://arcfn.com). A know working snapshot can be downloaded here:

Attachment:
ArduinoIRremoteMaster.zip


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


Last edited by admin on Sat May 07, 2016 12:05 pm, edited 2 times in total.

Added diagrams to clarify correct pinout



Tue Sep 24, 2013 3:00 pm
Profile

Joined: Wed Oct 01, 2014 5:40 pm
Posts: 15
Post Re: IR receiver module (HCSENS0010)
I have just purchased thiis component together with your new version of the Uno. I wired the sensor as per your description of the pin outs and the leds on the went out and the UNo seemed inoperative. I suspect that your wiiring of the HCSENS0010 is incorrect as when I swopped the Gnd and Vcc wires the Uno came to life again and the red led on the HCSENS0010 lit up. However I could not get any output showing on the Serial Monitor of the Arduiino. How can I check if the IR sensor is falty?
As a matter of interest I have seen the sensor wiring I have indicated on a Web site which would suggest that your wiring is incorrect.


Fri May 06, 2016 12:57 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 620
Post Re: IR receiver module (HCSENS0010)
I think I can see the issue, the sketch was written for the 1838B sensor (used on this module). The module for some reason reverses the order of the VCC and GND pins (although the screen print is correctly marked). I've just updated the sketch and added diagrams to the first post that will help clarify the correct connection.

Quote:
ow can I check if the IR sensor is falty?


If the power got connected the opposite way then there's a good chance its damaged the sensor. I've sen't you a direct email about it.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Sat May 07, 2016 8:56 am
Profile

Joined: Wed Oct 01, 2014 5:40 pm
Posts: 15
Post Re: IR receiver module (HCSENS0010)
In view of the fact that you now admit that your wiring instructions were incorrect would you be prepared to replace the IR sensor or the new model UNO which may have become damaged due to the incorrect wiring instructions on your site. ? I also see from your new coloured diagram that the data line is shown going to Pin 1 wereas in the original was shown going to Pin 11. Is this correct and how it should work in Pin 1.


Sat May 07, 2016 9:11 am
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 620
Post Re: IR receiver module (HCSENS0010)
Please could you check your email, we've already offered to replace your module as a courtesy. If you now believe that your Uno may not be working we can discuss it there as debugging it in this tread would be off topic.

The diagram has now been removed but I've left the pin-out as this is relevant to the module. Thanks for pointing it out.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Sat May 07, 2016 12:04 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

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