View Full Version : Need help sending codes with PIR-1

October 19th, 2013, 07:21 AM
(I'm posting here b/c I'm not using Girder or Netremote.)

I just purchased a PIR-1 for the exclusive purpose of using a computer to automatically send IR remote codes to a TV. I don't need any complicated software to perform such a simple task, and was under the impression when I bought it that I could use the free Command Line tool in the SDK to do this, but so far, no luck.

Using the "PIRLIB_EXAMPLE.EXE" in the SDK, I can "listen" for my remote and it shows the codes when pressing a button. But when I use the same program to Send the same code in the proper format, nothing happens. Typing just "PIRLIB_EXAMPLE.EXE" with no parameters lists the three ways in which the command is used. I'm not sure what "set Digital IO" is for.

Here is my procedure: (I renamed "PIRLIB_EXAMPLE.EXE" to just "PIRLIB.EXE" for convenience)

From the Windows Run command, I open a DOS "CMD" window and navigate to the folder where "PIRLIB.EXE" resides.
I test my remote with: "PIRLIB.EXE listen", press the Power button on my remote facing the PIR-1. The code appears (a long string of 4-digit numbers) and I press "Q" to quit listening.
I then execute the following command to save the code to a text file to ensure no mistakes: "PIRLIB.EXE listen > code.txt", press the Power button on my remote, then Quit. (You can't see your actions while doing this, but it works.)
I edit "code.txt" to the following command: PIRLIB.EXE 2 0 "{the long string of numbers in the text file, enclosed in quotes}" and rename the file "power.bat".
Double-click on "power.bat". Nothing happens.

(Note, every time I "listen", the code for the same button is different.)

I've tried other "bitmask" ("2") and "repeat" ("0") values to no avail. The unit is directly facing my receiver (line of sight, unobstructed) barely 10 feet away. Holding it closer within 6 feet makes no difference. If the unit can't even reach 6 feet, it's useless to me. What am I doing wrong? I need this to control the TV in my mother's hospital room. Thx.

October 20th, 2013, 03:07 PM
Post the actual contents of the batch file here. (Zip it up first)

October 20th, 2013, 04:46 PM
Hi Ron, thanks for the reply. Attached is my test .bat file along with working "pir" file from "IR Studio". Note that while the bat says "pirlib 0 0", I have tried other values to no avail. And the CCF string has been changed multiple times.

Also, the CCF code that works in "IR Studio", only works when clicking the top-most "Play" button. The other two do nothing (even with the lengthy CCF string inserted in the box below.)

Thanks again.

October 20th, 2013, 05:07 PM
The PIRLIB stuff needs a code in CCF format. This is an industry standard way of describing IR codes. To get this format from IR Studio you need to hit "Calculate CCF" You'll get a code that looks like this:

0000 006E 0000 0022 0156 00A9 0014 0014 0014 0040 0014 0040 0014 0040 0014 0014 0014 0040 0014 0040 0014 0014 0014 0040 0014 0014 0014 0014 0014 0014 0014 0040 0014 0014 0014 0014 0014 0040 0014 0040 0014 0014 0014 0040 0014 0040 0014 0040 0014 0014 0014 0014 0014 0014 0014 0014 0014 0040 0014 0014 0014 0014 0014 0014 0014 0040 0014 0040 0014 0040 0014 05EF

That is the input that the PIRLIB stuff needs. You were trying to give it the IR Studio IR signal.

So instead try this:

pirlib 3 3 0000 006F 0000 0032 0083 0042 000F 0012 000F 0033 000F 0012 0010 0011 000F 0012 0010 0011 000F 0012 000F 0011 0010 0011 000F 0011 0010 0011 000F 0012 0010 0011 0010 0032 0010 0011 000F 0011 0010 0011 000F 0012 0010 0011 000F 0012 0010 0011 0010 0032 0010 0011 0010 0032 000F 0012 000F 0011 0010 0032 0010 0032 0010 0033 000F 0011 0010 0011 000F 0011 0010 0032 0010 0011 0010 0032 0010 0032 0010 0033 000F 0033 000F 0011 0010 0011 0010 0032 000F 0012 000F 0011 0010 0011 000F 0011 0010 0011 000F 0012 0010 0033 000F 0A57

the bitmask 3 means transmit from the built-in emitter as well as the plug-in.

The other 3 is the number of repeats to send.

A Valid CCF code for the PIR-1 always starts with a 0000 (indicating a RAW CCF code)

October 20th, 2013, 06:05 PM
Hey Ron, thanks. Your new code worked (after putting the CCF in quotes.)

The CCF I used was first from the CLI's "listen" command and later (the one I sent you) from "IT Studio". I had tried it using "3 3" before and that didn't work. Please tell me what you changed in the CCF and how you knew to change it.


October 20th, 2013, 06:18 PM
I took your power.PIR file and loaded it in IR Studio. (making sure I have no other IR codes loaded, so clear both top and bottom before loading). Then press "Calculate CCF" in the menu or toolbar. This will output that CCF code.

There is a subtle (to the viewer) but important difference between listening for IR signals and learning an IR code. The first gives a finger print of an IR code, a way to recognize it again later but not the full information. Learning actually grabs the exact timings and modulation frequency that the remote is using. This learning is what you need to do to be able to send the IR signal out again.

October 20th, 2013, 06:47 PM
Thanks. I was having no luck using that method until I noticed that my CCF contained two separate codes, one for each signal-graph. Only using the top CCF like you did appears to have done the trick.

I have now converted all the codes from a duplicate remote to the TV in my mother's hospital room and won't be able to test the results until tomorrow. I'll let you know how it goes.


(PS: is the CLI's "listen" command just bad? It outputs a different value each time, which never work anyway.)

October 20th, 2013, 06:56 PM

CLI: nope not bad, those values need to be finger printed. (or fuzzy matched ) they are passed none finger printed just developers can do their own finger printing/fuzzy matching.

October 21st, 2013, 02:44 PM
Damn, the unit did not work at the hospital (there was no way to test beforehand). I don't know why.

Suspecting that maybe my duplicate remote might somehow be just different enough so that the signal the PIR-1 recorded and then played back was incompatible, I brought the remote from the hospital home to try recording codes directly from it.

However, I noticed (continue to notice) that every time I record a particular button using "IR Studio", the CCF is different every time. That should not be. Any ideas?

October 21st, 2013, 02:54 PM
It's not uncommon for CCF codes to change slightly between recordings. Also some remotes use a toggle bit they change more significantly alternating between two IR codes.

Next time it might be good to give me a call when you are at the hospital. I'll be out of office again tomorrow afternoon until the 24 in the afternoon. But call anytime outside of that. When you are at the facility.

October 21st, 2013, 04:38 PM
Thanks. You'll need to resend your number to my email address. I am unable to find it. I visit the hospital on M/W/F afternoons.

The discrepancy between IR codes each time I record the same button varies wildly, sometimes producing a lengthy CFF and sometimes just a few lines long. Right now, I'm testing repeated recordings of a single button, and if the first/last four quartets are similar (or identical), I'm trusting that to be the mostly likely correct code. Not the most efficient method I'm afraid.

October 21st, 2013, 05:01 PM
Lets try and talk on Friday. I'll send you my number.

October 23rd, 2013, 03:03 PM
I got the unit to do what I needed after installing "IR Studio" on the PC in Mom's hospital room and repeatedly trying codes till I found ones that worked. Thx.

October 24th, 2013, 11:36 AM
Excellent!! Glad it's working for you.

IR Codes can be a bit of an art form.

October 27th, 2013, 02:36 PM
The codes I entered the other day suddenly stopped working for some reason. No clue why.

I will go through the process again Monday afternoon and enter all new codes, but I sure hope this isn't going to be a recurring problem.

October 28th, 2013, 08:59 AM
That's strange. I've not seen that happen, ever.

Possible causes.

1. It's a toggle code and you didn't notice this in the beginning (unlikely )
2. Emitter came of the TV or PIR is not in line of sight of TV

October 28th, 2013, 03:56 PM
2. Emitter came of the TV or PIR is not in line of sight of TV
When I asked my sister yesterday where the Box was, she said, "In front of the TV". Actually, it was directly UNDER the TV. The nurses had moved it.

I taped a piece of paper to the table, drew a box around the PIR-1, and left a note not to move it from this space. :)

(The Box did fail in one respect: every once and a while, the TV seems to just ignore the code, like it is being sent too fast. Sending the code a second time usually does it. I installed "LogMeIn" on the PC in my mother's room so I can resend codes on demand if necessary.)

October 28th, 2013, 04:05 PM
Instead of having the PIR-1 box in a certain spot you can also use an IR emitter (https://secure.promixis.com/store/Stick-on-IR-Transmitter-invisible.html) stuck onto the TV,... less obtrusive. We're about to put new stick on emitters in our store that are considerable more affordable (-40%), with the same quality. We were able to cut out the middle-man when sourcing them.

Try increasing the repeat count if a code is not being recognized every time. That might help too.

October 28th, 2013, 04:21 PM
I considered an emitter, but I can't see the sensor on the front of the TV (well hidden beneath black plastic) to know exactly where to place it. Also, I don't want to cover up the sensor because others are still using the standard TV remote.

I thought the "count" maxed at 3, but if I continue to have problems, I'll try higher values (assuming 0-9?). Thanks.

October 28th, 2013, 04:55 PM
You can find the position by continually emitting volume up or down and moving the emitter back and forward till you find a spot with good reception. Also it doesn't fully block the input especially if it's slightly off to the side. (never had trouble with it blocking the normal remote).

Count goes way up to 250

October 28th, 2013, 07:38 PM
I may need to try that. I'm trying to send codes remotely using LogMeIn by running the batch files on the remote PC, and they are having no effect. Works when I'm in the room running them directly, but not by remote. (What a pain.)

I need to place a mirror in the room so I can see the TV over the webcam (this is getting too complicated.)