Go Down

Topic: Receiving Different IR Codes From Same Remote/Button (Read 3216 times) previous topic - next topic

AJKnoch

I am working on a project that detects what button was pressed and displays it on a LCD screen.

I am using this library for handling receiving the IR codes: https://github.com/shirriff/Arduino-IRremote

Everytime I press the same button on my Time Warner Cable remote I get different results.

What is the cause of this and how can I account for it?

Code: [Select]
#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn();
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume();
  }
}

JimboZA

Are you sure it's always different?

I found that I got two different codes with some buttons, and it alternated between the two.

For example the "down" button produces either a 1041 or 3089 and I just used the || (the "or") in my code like this:

Code: [Select]
   if (results.value == 1041 || results.value == 3089)
      {
         // do stuff
      }
Arduino ethernet server here.... http://jimboza.gotdns.com:8085/

No PMs for help please

AJKnoch

I just pressed the same button 25x and these are the values I received,

3653895 - 14 Times
421066283 - 1 Time
615415119 - 2 Times
604317718 - 2 Times
1358155102 - 1 Time
35434315 - 1 Time
609534435 - 2 Times
325791992 - 2 Times

JimboZA

Ok, you got me stumped there. No idea why that could be, but I have limited experience of using the IR I must say.
Arduino ethernet server here.... http://jimboza.gotdns.com:8085/

No PMs for help please

AJKnoch

It has stumped me too. I have tried multiple different remotes and they all work like expected with only one code per button but this Time Warner Cable remote keeps sending different values...

JimboZA

Perhaps it's some kind of proprietary security thing, where the receiver can unravel the "arbitrary" string and act on it, without having to know in advance what strings might arrive. But then, why does the one string score 14/25....

Arduino ethernet server here.... http://jimboza.gotdns.com:8085/

No PMs for help please

AJKnoch

So there really isn't a way to get a 100% recognition rate for the codes?

JimboZA

Well you could do your 25 click test a few more times until you think you have seen them all, and then "or" them like I had above.

But it could just simply be that the remote you have doesn't work on the "one button- one (or two) code" principal? Have you any documentation on what that remote is supposed to produce?
Arduino ethernet server here.... http://jimboza.gotdns.com:8085/

No PMs for help please

AJKnoch

I am not sure where I would find that information. The booklet that it came with is available here: http://www.universalremote.com/resources/pdfs/UR5U-8520L.pdf  but there's no information on such and I'm not sure where else to look.

JoshD

Try this sketch to spit out a nicely formatted list of on/off pulses in microseconds:

https://github.com/smokeyser/Remote2/blob/master/Contrib/rawirdecode.ino

It's just the ir decode sketch from adafruit.com with a function added (printpulses3) which spits out the pulses in array format that can be copied and fed into the IRremote lib's sendRaw function.  You can take a look at the rest of the project if you want to see how I used it.  The issue you're experiencing may be more obvious when you look at the received signals in a less condensed format, though.

Around here the cable company (comcast) has started to use the XMP protocol which makes decoding a bit trickier.  I had no luck reading it with adafruit's ir sensor and had to order a new one from digi-key that supports XMP.  So if changing the formatting of the output doesn't help solve/spot the problem, you may want to google your remote and find out if it's using XMP or some other protocol.  FWIW, you don't really need to be able to properly decode their protocol.  You just need to understand it well enough to get a good signal recording that you can duplicate.

Oh, one last thing...  The ir decoders from vishay are pretty sensitive. If that's what you're using, you may want to wire it up according to the datasheet's example with the cap and resistor to clean up the output a little if you haven't done that already.

fungus

#10
Feb 18, 2013, 03:56 am Last Edit: Feb 18, 2013, 04:03 am by fungus Reason: 1

Are you sure it's always different?

I found that I got two different codes with some buttons, and it alternated between the two.

For example the "down" button produces either a 1041 or 3089 and I just used the || (the "or") in my code like this:


Yep. This is so you can tell when the user lifts his finger and presses the same button again (as opposed to holding the button down and sending the same code multiple times).

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

JimboZA

Quote
you don't really need to be able to properly decode their protocol....


True.... but he does need to know that he's covered all the possibilities with enough testing to ensure that in a few weeks a button doesn't generate a code he didn't see in testing and thus didn't cater for.

I guess that's what you meant by:

Quote
understand it well enough to get a good signal recording that you can duplicate
Arduino ethernet server here.... http://jimboza.gotdns.com:8085/

No PMs for help please

fungus

#12
Feb 18, 2013, 03:59 am Last Edit: Feb 18, 2013, 04:05 am by fungus Reason: 1

I just pressed the same button 25x and these are the values I received,

3653895 - 14 Times
421066283 - 1 Time
615415119 - 2 Times
604317718 - 2 Times
1358155102 - 1 Time
35434315 - 1 Time
609534435 - 2 Times
325791992 - 2 Times



Maybe it's because the receiver frequency doesn't match the transmitter frequency very well so you get glitches (IR remotes don't all use the same modulation frequency).

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

JimboZA

Quote
Maybe it's because the receiver frequency doesn't match the transmitter frequency very well


Good point: when I bought my 38 receiver, they shop had 37.5 as well.
Arduino ethernet server here.... http://jimboza.gotdns.com:8085/

No PMs for help please

fungus


Quote
Maybe it's because the receiver frequency doesn't match the transmitter frequency very well


Good point: when I bought my 38 receiver, they shop had 37.5 as well.


My VISHAY IR receiver datasheet lists variants at 30, 33, 36, 36.7, 38, 40 and 56 kHz. They use a bandpass filter so there's a bit of tolerance but maybe that remote is transmitting at 33 or 40kHz.

PS: You could hook an oscilloscope to the transmitter LED to find out...

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Go Up