Problem with IR receiver and Arduino Uno

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:

/*
 * 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.

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

Thanks a lot! :slight_smile:

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.

Thanks a lot for your suggestion! :wink:

It seems to work good, now.

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

I've read raw data and it worked! :slight_smile: