Adafruit_NECremote lib not working with TSOP38238 and mini remote ctrl

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Adafruit_NECremote lib not working with TSOP38238 and mini remote ctrl

Postby eduino » 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 (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 7:01 pm

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

Postby BeerCannon » Tue Feb 26, 2013 1: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.
User avatar
BeerCannon
 
Posts: 67
Joined: Fri Nov 16, 2012 8:16 pm
Location: Pennsylvania, USA


Return to Other Arduino products from Adafruit

Who is online

Users browsing this forum: No registered users and 4 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [114]

Raspberry Pi[82]
 
FLORA[24]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[12]
Arduino[60]
 
NETduino[14]
 
BeagleBone[23]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[39]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[9]


 
Breakout Boards[35]
LCDs & Displays[49]
Components & Parts[70]
Batteries & Power[54]
EL Wire/Tape/Panel[52]
LEDs[112]
 
Wireless[16]
Cables[66]
 
Lasers[6]
Sensors/Parts[147]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[41]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[25]


 
Stickers[41]
 
Skill badges[55]
 
Books[26]
 
Circuit Playground[7]
 
Gift Certificates[4]