Go Down

Topic: Problem with IR receiver and Arduino Uno (Read 1 time) previous topic - next topic

marcus barnet

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: [Select]
/*
* 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.

DuaneB

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
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com


Chagrin

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.

marcus barnet

Thanks a lot for your suggestion! ;)

It seems to work good, now.

raees

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 

marcus barnet


Go Up