Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

Adafruit_NECremote lib not working with TSOP38238 and mini remote ctrl
Moderators: adafruit_support_bill, adafruit

Adafruit_NECremote lib not working with TSOP38238 and mini remote ctrl

by eduino on Sun Feb 24, 2013 8:20 pm

Hey there,

My project is a servo-enabled, remote controllable heater button (and later on a full-fledged thermostat) since it tends to be pretty cold in my room during winter. But for now, I can't read the codes sent by the remote in the Serial monitor :'(

I am using a UNO board, a TSOP38238 and a mini remote controller bought from adafruit. I've downloaded the lib from Github (https://github.com/adafruit/Adafruit-NE ... ol-library) but I can't get the listener example working using a standard setup (sensor output to pin 2, sensor ground to GND and sensor vcc to +5V). Serial monitor endlessly display the "Timed out waiting!" error message.

I was not sure if IR reception was OK so I plugged in a LED to see if it blinks when receiving signal from the sensor and it does, hence the problem lies elsewhere ...

Picture:
http://imgur.com/uqTL7ld

Code:
/*************************************************** 
  This is an example for the Adafruit NEC Remote Control

  Designed specifically to work with the Adafruit NEC Remote Control
----> http://www.adafruit.com/products/389
  and IR Receiver Sensor
----> http://www.adafruit.com/products/157

  These devices use IR to communicate, 1 pin is required to  
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/
 

#include "Adafruit_NECremote.h"
 
// Connect a 38KHz remote control sensor to the pin below
#define IRpin 2
 
Adafruit_NECremote remote(IRpin);

void setup(void) {
  Serial.begin(9600);
  Serial.println("Ready to decode IR!");
}

int lastcode = -1;

void loop(void) {
  // You can set the listen() time out to 'n' seconds
  int c = remote.listen(1); // seconds to wait before timing out!
  // Or you can wait 'forever' for a valid code
  //int c = remote.listen(); // Without a #, it means wait forever

  if (c >= 0) {
    Serial.print("Received code #");
    Serial.println(c, DEC);
    lastcode = c;
  } else if (c == -3) {
    Serial.print("Repeat (");
    Serial.print(lastcode);
    Serial.println(")");
  } else if (c == -2) {
    Serial.println("Data error");
  } else {
    Serial.println("Timed out waiting!");
  }
}



Thanks for your help,
E.
eduino
 
Posts: 1
Joined: Sun Feb 24, 2013 8:01 pm

Re: Adafruit_NECremote lib not working with TSOP38238 and mini remote ctrl

by beercannon on Tue Feb 26, 2013 2:48 pm

See my thread here:
viewtopic.php?f=25&t=37457

You may be having the same problem I was.. that particular IR sensor is one that strips the 38k pulse and reports only the signal on/off pulses.

beercannon
 
Posts: 85
Joined: Fri Nov 16, 2012 9:16 pm
Location: Pennsylvania, USA