Pages: [1]   Go Down
Author Topic: Problem with IR receiver and Arduino Uno  (Read 1246 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 413
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using IRemote library to try to receive IR signal from a generic TV remote controller: at the moment, i'm using the demo example available with the library and i'm able to detect the IR signals but, in the serial monitor, it always prints 0 and not the signal value.

I'm using the IR TSOP2438 receiver (i connected the OUT pin to Arduino UNO PIN 11), this is its datasheet: TSOP2438.

And this is the code:

Code:
/*
 * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
}

When i press a button from the IR remote controller, serial monitor always prints 0 value.

Can you help me to solve this problem, please? I'd like to print the correct received values.
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
   Its possible that you IR Receiver and IR Transmitter are in different ranges. The receiver I use is tuned to signals around 40Khz, but from what I have seen others may be above or below this range.

   A simple way to check whether you IR Receiver is working is to create a standalone circuit with the receiver connected to an LED.

There is an example circuit using a few AA Batteries an LED and a Resistor here, there is also lots of useful background information -

http://www.ladyada.net/learn/sensors/ir.html

Duane B

rcarduino.blogspot.com
Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 413
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot! smiley
Logged

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 29
Posts: 2244
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In addition to the frequency your receiver is also designed for PCM encoding.

The IRremote library also has some debugging routines: adding "#define DEBUG" to IRremote.h appears to print a "MARK" or "SPACE" on the serial monitor when a high/low is seen by the receiver.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 413
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot for your suggestion! smiley-wink

It seems to work good, now.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hey
      i also wanted to work with ir receiver, but my  IRremote lib demo program doesn,t work
     can  u tell me why
 
      have a great day 
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 413
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've read raw data and it worked!  smiley
Logged

Pages: [1]   Go Up
Jump to: