Adafruit_NECremote lib not working with TSOP38238 and mini remote ctrl

by eduino on Sun Feb 24, 2013 7: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 ( ... 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 ...


  This is an example for the Adafruit NEC Remote Control

  Designed specifically to work with the Adafruit NEC Remote Control
  and IR Receiver Sensor

  These devices use IR to communicate, 1 pin is required to  
  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.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 (");
  } else if (c == -2) {
    Serial.println("Data error");
  } else {
    Serial.println("Timed out waiting!");

Thanks for your help,
Posts: 1
Joined: Sun Feb 24, 2013 7:01 pm

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

by BeerCannon on Tue Feb 26, 2013 1:48 pm

See my thread here:

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.
User avatar
Posts: 85
Joined: Fri Nov 16, 2012 8:16 pm
Location: Pennsylvania, USA