Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't understand the output #1

Open
calania opened this issue Apr 6, 2020 · 6 comments
Open

Can't understand the output #1

calania opened this issue Apr 6, 2020 · 6 comments

Comments

@calania
Copy link

calania commented Apr 6, 2020

Hello, I have for a while now wanted to move an Arduino program that is controlled by an IR remote over to the raspberry pi. But it has been harder than I expected to find a python package that made decoding ir remotes easy. I found this package and got the example program working to some extent. The thing is that I don't understand what the output means. I am expecting that when I press a button on my remote that I should get a hex value printed. Instead, I get, what to me is a random number.

Starting IR remote sensing using DECODE function and verbose setting equal True Use ctrl-c to exit program Turning off verbose setting and setting up callback 45.14718055725098 72 . 94.50411796569824 72 .

I am guessing that there is some setting that I should change but I can't figure out which. I forexample know that one of my hexcodes are C81 so I have changed in the exaple file so that it is

elif code == 0xC81:
print('D')

But I still only get a dot in the shell. I tried changing

else:
print('.') # unknown code

to

else:
print(code) # unknown code

But then it only prints either a 0 or -1. Does somebody have any idea what is happening?

@BDeliers
Copy link

BDeliers commented Apr 6, 2020

I have the same issue. A temporary solution I found is commenting from line 131 to 143 in IRModule.py. I think the problem is that the code here is only considering start signals from a SparkFun remote, but no other remote.

Maybe @owainm713 could have a solution for us ?

EDIT : after having a look, the real problem is from lines 139 to 143:

    if (pList[sIndex]<4 or pList[sIndex]>11):
        return -1

    if (pList[sIndex+1]<2 or pList[sIndex+1]>6):
        return -1

For example, my remote has these values: 0.6 < pList[sIndex] < 0.8 and 0.15 < pList[sIndex+1] < 0.3. Of course the boundaries are different of those in the conditions. So one solution is to edit the boundaries, another to comment these lines.

I think that the original code works perfectly with a TV remote for example (working for me), but needs to be modified for some other remotes (my HIFI system for example).
My HIFI system sends 16 bits values, while yours sends 12 and SparkFun's sends 32 bits.

@owainm713
Copy link
Owner

Hi, this code is for NEC format IR remotes, so that start condition it is looking for is not specific to the Sparkfun remote (I have other NEC format remotes that it reads ok) so that is the first thing to confirm with the remotes you are working with.

@owainm713
Copy link
Owner

I set up my IR receiver and ran the example program. The two numbers you are seeing e.g. 45.14718055725098 72 . are the IR signal total length in ms and the # of pulses recorded in that signal. There are couple print lines in the main module I forgot to comment out....oops.

To help debug/decode your signal in the example program if you comment out the following lines (79-81) and you will have more time to try decoding/debugging

#print('Turning off verbose setting and setting up callback')
#ir.set_verbose(False)
#ir.set_callback(remote_callback)

@BDeliers
Copy link

BDeliers commented Apr 7, 2020

I'm not very familiar with the different IR protocols; I suppose my remote uses Sharp protocol, as it's a Sharp audio system remote. My data is sent on 16 bits by the way.

@Ashleymerwinraj
Copy link

Action for the single button at single press gives me 2 values thrice in 5 times. Delay in reading and printing the value. Pulse_check runs twice and remote call back prints twice.

Output:

Pulse
118.95608901977539 71
Pulse
Down Arrow
Down Arrow
Pulse
118.96109580993652 71
Down Arrow

@owainm713
Copy link
Owner

The sensor may be picking up a repeat code (i.e. if the button is held down). Try turning the repeat code functionality off and see if it still happens. Use the set_repeat(False) function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants