Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by BeerCannon on Mon Feb 25, 2013 11:27 am

Hi,

I'm attempting to use LadyAda's Adafruit_NECremote library and the example 'listener' app to decode the Mini Remote Control (http://www.adafruit.com/products/389) with an Arduino UNO R3 and a Vishay TSOP38238 (38k IR Sensor).

Currently, I just have the sensor inserted into the Arduino digital outputs (5, 6 and 7) as such:

Sensor pin 1 (out) -> Arduino digital pin 5
Sensor pin 2 (GND) -> Arduino digital pin 6, set LOW in code
Sensor pin 3 (Vs) -> Arduino digital pin 7, set HIGH in code

I compile and upload the example "listener" code, ensuring the IR pin is set to 5 in code, and also set pins 6 and 7 to output, and then to LOW and HIGH respectively in the setup().

When I open the serial monitor, I just get timeout messages when I try to use the remote (which I understand uses NEC codes).

The sensor itself is good, because I can decode a Sony remote with no changes to the circuit, using another IR library.

I did remove the plastic shipping tab from the battery compartment of the Mini Remote Control! :mrgreen:

At this point I'm wondering if there's a compatibility issue with my IR sensor and the Mini Remote, or if there might be something in the Adafruit_NECremote.h that I can define or change to get it working?

Thanks for any input. I also tried putting the sensor on a mini-breadboard, jumping the output to an Arduino digital I/O pin, and connecting the other pins directly to GND and +5V on the Arduino, but with the same results.

Datasheet for sensor: http://www.vishay.com/docs/81733/tsop382.pdf
User avatar
BeerCannon
 
Posts: 85
Joined: Fri Nov 16, 2012 8:16 pm
Location: Pennsylvania, USA

Re: Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by attermann on Mon Feb 25, 2013 3:24 pm

I am using the same sensor in my project, but I'm using an Apple remote which is also NEC-compatible. I didn't have any luck with the Adafruit_NECremote library either, so I switched to the IRremote library from Ken Shirriff (http://www.righto.com/2009/08/multi-pro ... brary.html). It works pretty well for simple projects, although it can do better with some tuning (ie, setting MARK_EXCESS to 0 for the TSOP38238 sensor). I have run into some issues using IRremote with more complex projects lately though, especially when using along with the Servo library. They both use hardware timers, and somehow the IRremote library causes jitter in the servo (likely signal timing issue). I am working on a solution for this though, so if you encounter it, let me know and I'll share.

Good luck,

Chad.
attermann
 
Posts: 6
Joined: Sun Feb 24, 2013 2:41 pm

Re: Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by adafruit_support_rick on Mon Feb 25, 2013 5:44 pm

The Vishay part strips the 38KHz PCM frequency. You're going to get pulse widths corresponding to the signal on/off times, as opposed to the 38KHz square-wave.

The adafruit library is designed to demodulate the PCM, and so it is expecting to see 38KHz pulse-widths. You can modify the library, or you can look for a library that works with demodulated signals.
User avatar
adafruit_support_rick
 
Posts: 8585
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by BeerCannon on Mon Feb 25, 2013 5:47 pm

attermann,

I'm not ready to give up on the Adafruit library just yet. I did download Chris Young's object-oriented retooling of Ken Shirriff's library, but I haven't installed or looked at it yet. (And it was Ken Shirriff's library that I used to decode the Sony remote without making any physical changes to the circuit.)
Last edited by BeerCannon on Mon Feb 25, 2013 5:49 pm, edited 2 times in total.
User avatar
BeerCannon
 
Posts: 85
Joined: Fri Nov 16, 2012 8:16 pm
Location: Pennsylvania, USA

Re: Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by BeerCannon on Mon Feb 25, 2013 5:48 pm

Ahh, driverblock our posts just crossed. Thanks for the details. I will look into modifying the Adafruit library as needed. Thanks!
User avatar
BeerCannon
 
Posts: 85
Joined: Fri Nov 16, 2012 8:16 pm
Location: Pennsylvania, USA

Re: Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by BeerCannon on Fri Mar 01, 2013 9:47 pm

Just out of curiosity, is there another IR sensor that *will* work with the Adafruit NEC IR library, 'as-is''?

It may be quicker than researching the IR protocols and re-writing code to get things working with the one I have.
User avatar
BeerCannon
 
Posts: 85
Joined: Fri Nov 16, 2012 8:16 pm
Location: Pennsylvania, USA

Re: Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by adafruit_support_rick on Fri Mar 01, 2013 11:06 pm

User avatar
adafruit_support_rick
 
Posts: 8585
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by BeerCannon on Fri Mar 01, 2013 11:59 pm

Hmm, that's the very one I'm using..
User avatar
BeerCannon
 
Posts: 85
Joined: Fri Nov 16, 2012 8:16 pm
Location: Pennsylvania, USA

Re: Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by BeerCannon on Sat Mar 02, 2013 12:13 am

I think I found the problem.. the Mini Remote appears to be bad. I used a cell phone camera to look at it, and I see nothing when I press keys. The battery checks out okay around 3.3 volts.
User avatar
BeerCannon
 
Posts: 85
Joined: Fri Nov 16, 2012 8:16 pm
Location: Pennsylvania, USA

Re: Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by adafruit_support_rick on Sat Mar 02, 2013 7:25 am

Just checking voltage with a multimeter is not necessarily a good test. Do you have another battery you can try?
User avatar
adafruit_support_rick
 
Posts: 8585
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by BeerCannon on Sat Mar 02, 2013 10:38 am

I don't have another CR2025.. I have CR2032s around. This one can power an ultra-bright LED really well, so I'm pretty sure the battery is fine.

At any rate, I'm just going to order another Mini Remote (along with more Adafruit goodies). It would cost nearly as much to replace the battery anyway. Kicking myself for not figuring it out sooner..
User avatar
BeerCannon
 
Posts: 85
Joined: Fri Nov 16, 2012 8:16 pm
Location: Pennsylvania, USA

Re: Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by adafruit_support_rick on Sat Mar 02, 2013 12:38 pm

We wouldn't make you buy another remote. Email support@adafruit.com with a link to this thread and ask for a replacement.
User avatar
adafruit_support_rick
 
Posts: 8585
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Trouble with IR decoding: Arduino UNO, NEC remote, 38k sensor

by BeerCannon on Sat Mar 02, 2013 11:47 pm

Thanks, but I just won an Ultimate GPS shield last weekend in the "Ask an Engineer" chat. I'd feel bad making noise over a $5 remote when I've just been the beneficiary of such kindness. I ordered a new remote tonight, with some other stuff.. hopefully I'll get it mid-week and have my ArdBot2 working from IR by next weekend.
User avatar
BeerCannon
 
Posts: 85
Joined: Fri Nov 16, 2012 8:16 pm
Location: Pennsylvania, USA