convert LIRC file to IRToy raw commands

USB infrared remote control receiver/transmitter. Get one for $20, including worldwide shipping.

convert LIRC file to IRToy raw commands

Postby zoulou » Sat Aug 02, 2014 11:27 am

Hello,

I have a 7 inch touch display Radio/DVD/USB/Navigaton 2-DIN in-dash unit in my car that runs Windows CE 6.0. Additionally I have a DVB-T TV box in my car that I currently need to control with the remote control that came with the DVB-T box.
Instead of taking the remote of the DVB-T box, I want to attach the USB IRToy to the USB port of the car radio and write some software to send the IR commands for next/previous TV channel myself.
I have all necessary software already running, but I face one specific problem. When I can solve this then my project is complete.

My problem: I recorded the next/prev buttons on my Windows PC using the irtoy.exe from the IRToyRecPlay folder. When I tried to play the file again, I found that the DVB-T box does not react on the command.
I tried different other remote controls of my home TVs and found that with the same approach one was working fine, another one however also failed.
So, I tried IrScrutinizer and wow! now also the car DVB-T box does react. I think it is because the DVB-T remote uses NEC1 @ 40kHz, where IRToy defaults to 36kHz.
So now I have 2 known-good recordings done with IrScrutinizer and an export to LIRC format.

But how do I get from a LIRC file to the bytes that I need to send to the IRToy after the Setup sample timer (0x05) and Transmit (0x03) command ?

I've read lots of information from the web and even reviewed the IrScrutinizer source code, but there seems to be no simple LIRC to USBToy transmit commands how-to ...
Any push into the right direction is highly appreciated :-)

Here the LIRC file content.

Code: Select all
# Automatically generated LIRC file
#
# Creating tool: IrScrutinizer version 1.1.0a
# Creating user: zoulou
# CreateDate: Sun Jul 27 13:04:58 CEST 2014
#
# Manufacturer: Ampire
# Model: DVBT400
#
# Export from IrScrutinizer
#
begin remote
   name   FB-DVBT400
   flags   RAW_CODES
   eps   30
   aeps   100
   frequency   40352
   gap   1398078
      begin raw_codes

         name NEXT
            8811 4501 508 583 508 583 508 583
            508 583 508 583 508 583 508 583
            507 1686 507 1686 507 1686 507 1686
            507 1686 507 1686 507 1686 507 1686
            508 583 508 583 507 1686 508 583
            507 1686 507 1686 508 583 508 583
            507 1686 507 1686 508 583 507 1686
            508 583 508 583 507 1686 507 1686
            508 583 491 39765 8811 2272 491 95232
            8811 2272 512
         name PREV
            8811 4523 496 594 496 594 496 594
            496 594 496 594 496 594 496 594
            504 1688 504 1688 504 1688 504 1688
            504 1688 504 1688 504 1688 504 1688
            496 594 496 594 504 1688 504 1688
            504 1688 504 1688 496 594 496 594
            504 1688 504 1688 496 594 496 594
            496 594 496 594 504 1688 504 1688
            496 594 491 39787 8811 2297 505
      end raw_codes
end remote
zoulou
Newbie
Newbie
 
Posts: 5
Joined: Sat Jun 21, 2014 11:57 am

Re: convert LIRC file to IRToy raw commands

Postby Qwlciguk » Sun Aug 03, 2014 12:55 am

zoulou wrote:Hello,

I have a 7 inch touch display Radio/DVD/USB/Navigaton 2-DIN in-dash unit in my car that runs Windows CE 6.0. Additionally I have a DVB-T TV box in my car that I currently need to control with the remote control that came with the DVB-T box.
Instead of taking the remote of the DVB-T box, I want to attach the USB IRToy to the USB port of the car radio and write some software to send the IR commands for next/previous TV channel myself.
I have all necessary software already running, but I face one specific problem. When I can solve this then my project is complete.

My problem: I recorded the next/prev buttons on my Windows PC using the irtoy.exe from the IRToyRecPlay folder. When I tried to play the file again, I found that the DVB-T box does not react on the command.
I tried different other remote controls of my home TVs and found that with the same approach one was working fine, another one however also failed.
So, I tried IrScrutinizer and wow! now also the car DVB-T box does react. I think it is because the DVB-T remote uses NEC1 @ 40kHz, where IRToy defaults to 36kHz.
So now I have 2 known-good recordings done with IrScrutinizer and an export to LIRC format.

But how do I get from a LIRC file to the bytes that I need to send to the IRToy after the Setup sample timer (0x05) and Transmit (0x03) command ?

I've read lots of information from the web and even reviewed the IrScrutinizer source code, but there seems to be no simple LIRC to USBToy transmit commands how-to ...
Any push into the right direction is highly appreciated :-)

Here the LIRC file content.

Code: Select all
# Automatically generated LIRC file
#
# Creating tool: IrScrutinizer version 1.1.0a
# Creating user: zoulou
# CreateDate: Sun Jul 27 13:04:58 CEST 2014
#
# Manufacturer: Ampire
# Model: DVBT400
#
# Export from IrScrutinizer
#
begin remote
   name   FB-DVBT400
   flags   RAW_CODES
   eps   30
   aeps   100
   frequency   40352
   gap   1398078
      begin raw_codes

         name NEXT
            8811 4501 508 583 508 583 508 583
            508 583 508 583 508 583 508 583
            507 1686 507 1686 507 1686 507 1686
            507 1686 507 1686 507 1686 507 1686
            508 583 508 583 507 1686 508 583
            507 1686 507 1686 508 583 508 583
            507 1686 507 1686 508 583 507 1686
            508 583 508 583 507 1686 507 1686
            508 583 491 39765 8811 2272 491 95232
            8811 2272 512
         name PREV
            8811 4523 496 594 496 594 496 594
            496 594 496 594 496 594 496 594
            504 1688 504 1688 504 1688 504 1688
            504 1688 504 1688 504 1688 504 1688
            496 594 496 594 504 1688 504 1688
            504 1688 504 1688 496 594 496 594
            504 1688 504 1688 496 594 496 594
            496 594 496 594 504 1688 504 1688
            496 594 491 39787 8811 2297 505
      end raw_codes
end remote


I have never seen any IR device that was that picky about the exact frequency. It's quite common to be able to send 56 KHz IR and a device designed for 38 KHz still responds with no issue. The IR demod used in the vast majority of devices, has a really wide passband, that still has 60% or more response at a frequency offset of 50% from nominal.

That said, obviously something is wrong with the IR Toy recorded signals vs the IR Scrutinizer recorded signals via IR Toy. It's not all that hard to convert between LIRC and IR Toy native format.

LIRC format is a series of on/off pairs. The first number is how many microseconds the burst is on, followed by the second number which is the number of microseconds that the burst is off. Notice that the final "off" burst time is never present.

IR Toy native format is similar, except that instead of each count being 1 us, each count is 21.333 us. After the final "on" burst, there is a 0xFFFF terminator. Also, IR Toy format is binary vs LIRC which is text.

If you post a hex dump of an IR Toy record/play file for a given key and the LIRC file for the same key recorded via IR scrutinizer, it should be fairly simple to figure out what the difference is that makes it not work.
Qwlciguk
Full Member
Full Member
 
Posts: 111
Joined: Sat Nov 19, 2011 7:48 pm

Re: convert LIRC file to IRToy raw commands

Postby Barf » Mon Aug 04, 2014 1:56 am

zoulou wrote:...
But how do I get from a LIRC file to the bytes that I need to send to the IRToy


Sending an IR signal to the 'toy is not THAT easy, it involves timing and checking return values and such. It is not just the matter of transforming a string into another representation. So I suggest that you use one existing driver. For example the one in IrScrutinizer :-).

Assuming that Java is an allowed solution, I would suggest that you try to write a program like this (Java >= 7):

Code: Select all
// This code is in the public domain.

package javaapplication47;

import org.harctoolbox.IrpMaster.IrSignal;
import org.harctoolbox.harchardware.ir.IrToy;

public class JavaApplication47 {

    public static void main(String[] args) {
        try {
            String parameters = null;
            switch (args[0]) {
                case "NEXT":
                    parameters = "D=128 F=154";
                    break;
                case "PREVIOUS":
                parameters = "D=128 F=158";
                    break;
                default:
                    System.err.println("Unknown command");
                    System.exit(1);
            }
            IrSignal irSignal = new IrSignal("IrpProtocols.ini", "NEC1", parameters);
            IrToy irToy = new IrToy("/dev/ttyACM0");
            irToy.open();
            irToy.sendIr(irSignal, 1, null);
            irToy.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

which would generate the signals you want and send iit to the 'toy. Note that this is examle code, but should be enough to try the idea. You will need IrpProtocols.ini, IrpMaster.jar, HarcHardware.jar, antlr-3.4-complete.jar, and rxtx.jar and you need to have librxtxSerial in your java.library.path.(All contained in IrScrutinizer dist.)

If you have a working LIRC setup, including a working IrToy driver, that should also work. But that is a big IF.
Barf
Jr. Member
Jr. Member
 
Posts: 62
Joined: Mon Jul 07, 2014 3:12 pm

Re: convert LIRC file to IRToy raw commands

Postby zoulou » Wed Aug 06, 2014 2:21 pm

Thanks Barf, however Java is indeed a problem. My WinCE device does not bring any Java runtime with it.

So, following Qwlciguk's approach...

This is the irtoy.exe recorded hexdump for the button "NEXT"

00 9E 00 D3 00 19 00 1B 00 18 00 1B 00 18 00 1B
00 18 00 1B 00 18 00 1B 00 18 00 1B 00 18 00 1B
00 18 00 4F 00 18 00 4E 00 19 00 4E 00 19 00 4E
00 19 00 4E 00 19 00 4E 00 19 00 4E 00 19 00 4E
00 19 00 1B 00 18 00 1B 00 18 00 4E 00 19 00 1B
00 18 00 4E 00 19 00 4E 00 19 00 1B 00 18 00 1B
00 17 00 4E 00 19 00 4E 00 19 00 1B 00 18 00 4E
00 19 00 1B 00 18 00 1B 00 18 00 4E 00 19 00 4E
00 19 00 1B 00 18 07 47 00 9E 00 6A 00 19 11 6E
00 9E 00 6A 00 19 FF FF

And this is the button "PREV":

00 9E 00 D3 00 19 00 1B 00 18 00 1B 00 18 00 1B
00 18 00 1B 00 18 00 1B 00 18 00 1B 00 18 00 1B
00 18 00 4E 00 19 00 4E 00 19 00 4E 00 19 00 4F
00 18 00 4E 00 19 00 4E 00 19 00 4E 00 19 00 4E
00 19 00 1B 00 17 00 1B 00 18 00 4E 00 19 00 4E
00 19 00 4E 00 19 00 4E 00 19 00 1B 00 18 00 1B
00 18 00 4E 00 19 00 4E 00 19 00 1B 00 18 00 1B
00 18 00 1B 00 18 00 1B 00 18 00 4E 00 19 00 4E
00 19 00 1B 00 18 07 47 00 9E 00 6A 00 19 11 6F
00 9E 00 6A 00 19 FF FF

The LIRC file for NEXT and PREV is in post #1

I really appreciate your help.
zoulou
Newbie
Newbie
 
Posts: 5
Joined: Sat Jun 21, 2014 11:57 am

Re: convert LIRC file to IRToy raw commands

Postby Qwlciguk » Wed Aug 06, 2014 4:56 pm

zoulou wrote:Thanks Barf, however Java is indeed a problem. My WinCE device does not bring any Java runtime with it.

So, following Qwlciguk's approach...

This is the irtoy.exe recorded hexdump for the button "NEXT"

01 9E 00 D3 00 19 00 1B 00 18 00 1B 00 18 00 1B
00 18 00 1B 00 18 00 1B 00 18 00 1B 00 18 00 1B
00 18 00 4F 00 18 00 4E 00 19 00 4E 00 19 00 4E
00 19 00 4E 00 19 00 4E 00 19 00 4E 00 19 00 4E
00 19 00 1B 00 18 00 1B 00 18 00 4E 00 19 00 1B
00 18 00 4E 00 19 00 4E 00 19 00 1B 00 18 00 1B
00 17 00 4E 00 19 00 4E 00 19 00 1B 00 18 00 4E
00 19 00 1B 00 18 00 1B 00 18 00 4E 00 19 00 4E
00 19 00 1B 00 18 07 47 00 9E 00 6A 00 19 11 6E
00 9E 00 6A 00 19 FF FF

And this is the button "PREV":

00 9E 00 D3 00 19 00 1B 00 18 00 1B 00 18 00 1B
00 18 00 1B 00 18 00 1B 00 18 00 1B 00 18 00 1B
00 18 00 4E 00 19 00 4E 00 19 00 4E 00 19 00 4F
00 18 00 4E 00 19 00 4E 00 19 00 4E 00 19 00 4E
00 19 00 1B 00 17 00 1B 00 18 00 4E 00 19 00 4E
00 19 00 4E 00 19 00 4E 00 19 00 1B 00 18 00 1B
00 18 00 4E 00 19 00 4E 00 19 00 1B 00 18 00 1B
00 18 00 1B 00 18 00 1B 00 18 00 4E 00 19 00 4E
00 19 00 1B 00 18 07 47 00 9E 00 6A 00 19 11 6F
00 9E 00 6A 00 19 FF FF

The LIRC file for NEXT and PREV is in post #1

I really appreciate your help.


The main discrepancy that I see between the LIRC file and the IRtoy.exe recorded file (after converting) is that the "lead in" sections are too short in the IRToy.exe recorded file. The very first byte should be a 0x01 rather than 0x00. That byte is the MSB (big endian) of the "lead in" burst on time and having it be 0x009E makes it much shorter than the converted LIRC file value of 0x019D. The 9D vs 9E isn't a big deal. It would work either way, but the most significant byte of 0x00 vs 0x01 is a huge deal. I have noticed that the IRToy does tend to record the "lead in" times much shorter than reality. I'm guessing that this has to do with the AGC response time in the demod detector. Holding the remote closer to the sensor may help in that regard. Then again, if I understood correctly, the LIRC file also came from the IRToy via IR Scruitinizer. So, it too should have been affected by the short lead-in time detection.

If you find all of the lead-ins in the IRtoy.exe recorded files and set the most significant byte to 0x01, I expect that you will have a much better chance of the device responding when sending the file. If the file only had one lead-in, I suspect that you wouldn't see any issue, but the fact that there are several, means that the sections following the 2nd/3rd etc lead-in will be too early for the device and that is likely why the transmission is not being recognized.

Here's what I got when converting the "next" key from the LIRC file to IRToy format:


01 9D 00 D3 00 18 00 1B 00 18 00 1B 00 18 00 1B
00 18 00 1B 00 18 00 1B 00 18 00 1B 00 18 00 1B
00 18 00 4F 00 18 00 4F 00 18 00 4F 00 18 00 4F
00 18 00 4F 00 18 00 4F 00 18 00 4F 00 18 00 4F
00 18 00 1B 00 18 00 1B 00 18 00 4F 00 18 00 1B
00 18 00 4F 00 18 00 4F 00 18 00 1B 00 18 00 1B
00 18 00 4F 00 18 00 4F 00 18 00 1B 00 18 00 4F
00 18 00 1B 00 18 00 1B 00 18 00 4F 00 18 00 4F
00 18 00 1B 00 17 07 48 01 9D 00 6B 00 17 11 70
01 9D 00 6B 00 18 FF FF


Compare that, to what you recorded and you'll quickly see the discrepancies in lead-in times. Differences of 1 count in the least significant byte will not make any difference, but in the MSB, it makes a huge difference in the duration. Understand that the fix isn't just a blind process of adding 1 to the most significant byte of the lead in burst. That just happens to work in the specific case shown here. The real issue is that the IRToy's reliance on timing the output of the demod, makes it susceptible to gross errors as seen here. I believe that IR Scrutinizer has the option to "sanitize" or something like that, the sloppy timings received from the IRToy and force them conform to the well defined norms for the detected IR protocol, but I don't remember the details. You'd still need to convert from LIRC or other exported format, to IR Toy format though.
Qwlciguk
Full Member
Full Member
 
Posts: 111
Joined: Sat Nov 19, 2011 7:48 pm

Re: convert LIRC file to IRToy raw commands

Postby Simpkins » Wed Aug 06, 2014 5:46 pm

Remember, there are bugged versions of irtoy.exe out there that do not return the correct MSB value, it only sends back 0. There is a thread on this forum about it somewhere but I could not find it yet.
Simpkins
Newbie
Newbie
 
Posts: 25
Joined: Mon Jul 21, 2014 12:23 pm

Re: convert LIRC file to IRToy raw commands

Postby Simpkins » Wed Aug 06, 2014 6:01 pm

Simpkins
Newbie
Newbie
 
Posts: 25
Joined: Mon Jul 21, 2014 12:23 pm

Re: convert LIRC file to IRToy raw commands

Postby Qwlciguk » Wed Aug 06, 2014 6:59 pm

Simpkins wrote:Remember, there are bugged versions of irtoy.exe out there that do not return the correct MSB value, it only sends back 0. There is a thread on this forum about it somewhere but I could not find it yet.


Ahh, that explains why IR Scrutinizer was able to capture correctly, but the irtoy.exe in the V222 distribution does not.

Now, if we could just get rid of that ~3 second pause after sending, that irtoy.exe does. IR Scrutinizer is able to send via the IR Toy without that 3 second pause. I looked at the source code, but could not figure out where the 3 second pause was coming from.
Qwlciguk
Full Member
Full Member
 
Posts: 111
Joined: Sat Nov 19, 2011 7:48 pm

Re: convert LIRC file to IRToy raw commands

Postby Simpkins » Wed Aug 06, 2014 7:25 pm

Have a look at the very bottom of main.c.

This is what I have:

#ifdef _WIN32
Sleep(50); // windows: Sleep for 2000 milliseconds
#else
sleep(2); // linux: sleep for 2 secs
#endif

I may have already shortened the windows delay, can't remember but I hope that is what you are looking for.
Simpkins
Newbie
Newbie
 
Posts: 25
Joined: Mon Jul 21, 2014 12:23 pm

Re: convert LIRC file to IRToy raw commands

Postby Barf » Thu Aug 07, 2014 4:58 am

Ok, guys, so you have persuaded me that there is such an animal like "IrToy format", sort-of. So I decided to add it to IrScrutinizer. Fortunately,it is quite easy, see http://www.harctoolbox.org/IrScrutinize ... rt+formats

So, add this stuff
Code: Select all
<exportformat name="IrToy" extension="txt" multiSignal="false" simpleSequence="true">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <!--xsl:param name="noRepeats" select="4"/-->
    <xsl:param name="period" select="21.3333"/>
    <xsl:output method="text" />

    <xsl:template match="/remotes">
<xsl:apply-templates select="remote[position()=1]/commandSet[position()=1]/command[position()=1]"/>
    </xsl:template>

    <xsl:template match="command">
        <xsl:apply-templates select="raw"/>
    </xsl:template>

    <xsl:template match="raw">
        <xsl:apply-templates select="intro/*"/>
        <xsl:call-template name="repeat"/>
        <xsl:apply-templates select="ending/*"/>
    </xsl:template>

    <xsl:template name="repeat">
         <xsl:param name="n" select="number($noRepeats)"/>
         <xsl:if test="not($n = 1)">
             <xsl:call-template name="repeat">
                 <xsl:with-param name="n" select="$n - 1"/>
             </xsl:call-template>
         </xsl:if>
         <xsl:apply-templates select="repeat/*"/>
    </xsl:template>

    <xsl:template match="gap|flash">
        <xsl:variable name="periods" select="floor(number(.) div $period)"/>
    <xsl:call-template name="hexnum">
        <xsl:with-param name="value" select="floor($periods div 256)"/>
    </xsl:call-template>
    <xsl:call-template name="hexnum">
        <xsl:with-param name="value" select="$periods mod 256"/>
    </xsl:call-template>
    </xsl:template>

    <xsl:template name="hexnum">
        <xsl:param name="value"/>
        <xsl:call-template name="hexdigit">
            <xsl:with-param name="val" select="floor($value div 16)"/>
        </xsl:call-template>
        <xsl:call-template name="hexdigit">
            <xsl:with-param name="val" select="$value mod 16"/>
        </xsl:call-template>
        <xsl:text> </xsl:text>
    </xsl:template>

    <xsl:template name="hexdigit">
        <xsl:param name="val"/>
           <xsl:value-of select="substring('0123456789ABCDEF',$val+1,1)"/>
        </xsl:template>
</xsl:stylesheet>
</exportformat>

to the exportformats.xml, for example just before the last line reading </exportformats>. There will now be a new export format "IrToy", that however only takes a single signal, the first one in the export. (Note that it does not adjust the last duration to FFFF, possibly it should.)

I have noticed that the IRToy does tend to record the "lead in" times much shorter than reality. I'm guessing that this has to do with the AGC response time in the demod detector.

Well, some people distrust demodulating receivers for capturing,,, But the Lirc file posted has 8811 microseconds for the leadin, shorter than the theoretical number of 9024. but not very much, so that is probably not an issue. (There is a reason why it it called "lead-in".)
Barf
Jr. Member
Jr. Member
 
Posts: 62
Joined: Mon Jul 07, 2014 3:12 pm

Re: convert LIRC file to IRToy raw commands

Postby Qwlciguk » Thu Aug 07, 2014 9:56 am

Barf wrote:Ok, guys, so you have persuaded me that there is such an animal like "IrToy format", sort-of. So I decided to add it to IrScrutinizer. Fortunately,it is quite easy, see http://www.harctoolbox.org/IrScrutinize ... rt+formats

So, add this stuff
Code: Select all
<exportformat name="IrToy" extension="txt" multiSignal="false" simpleSequence="true">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <!--xsl:param name="noRepeats" select="4"/-->
    <xsl:param name="period" select="21.3333"/>
    <xsl:output method="text" />

    <xsl:template match="/remotes">
<xsl:apply-templates select="remote[position()=1]/commandSet[position()=1]/command[position()=1]"/>
    </xsl:template>

    <xsl:template match="command">
        <xsl:apply-templates select="raw"/>
    </xsl:template>

    <xsl:template match="raw">
        <xsl:apply-templates select="intro/*"/>
        <xsl:call-template name="repeat"/>
        <xsl:apply-templates select="ending/*"/>
    </xsl:template>

    <xsl:template name="repeat">
         <xsl:param name="n" select="number($noRepeats)"/>
         <xsl:if test="not($n = 1)">
             <xsl:call-template name="repeat">
                 <xsl:with-param name="n" select="$n - 1"/>
             </xsl:call-template>
         </xsl:if>
         <xsl:apply-templates select="repeat/*"/>
    </xsl:template>

    <xsl:template match="gap|flash">
        <xsl:variable name="periods" select="floor(number(.) div $period)"/>
    <xsl:call-template name="hexnum">
        <xsl:with-param name="value" select="floor($periods div 256)"/>
    </xsl:call-template>
    <xsl:call-template name="hexnum">
        <xsl:with-param name="value" select="$periods mod 256"/>
    </xsl:call-template>
    </xsl:template>

    <xsl:template name="hexnum">
        <xsl:param name="value"/>
        <xsl:call-template name="hexdigit">
            <xsl:with-param name="val" select="floor($value div 16)"/>
        </xsl:call-template>
        <xsl:call-template name="hexdigit">
            <xsl:with-param name="val" select="$value mod 16"/>
        </xsl:call-template>
        <xsl:text> </xsl:text>
    </xsl:template>

    <xsl:template name="hexdigit">
        <xsl:param name="val"/>
           <xsl:value-of select="substring('0123456789ABCDEF',$val+1,1)"/>
        </xsl:template>
</xsl:stylesheet>
</exportformat>

to the exportformats.xml, for example just before the last line reading </exportformats>. There will now be a new export format "IrToy", that however only takes a single signal, the first one in the export. (Note that it does not adjust the last duration to FFFF, possibly it should.)

I have noticed that the IRToy does tend to record the "lead in" times much shorter than reality. I'm guessing that this has to do with the AGC response time in the demod detector.

Well, some people distrust demodulating receivers for capturing,,, But the Lirc file posted has 8811 microseconds for the leadin, shorter than the theoretical number of 9024. but not very much, so that is probably not an issue. (There is a reason why it it called "lead-in".)


Thanks very much for adding this. One small issue though, after I added the section to the xml file, I can now select IR Toy format for export, but the exported file is text and not binary. The irtoy.exe program only reads/writes binary format files.

I'm still of the opinion that recording the output of the demod, results in less accurate timing than recording the raw detector like the IR Widget does. How important this is in a given case, is hard to tell. It's easy to see on a 'scope. Generally, the demod is somewhat slow to respond initially but then artificially extends the duration past when the IR pulses actually stop. That tends to result in burst values that are too long, but there are other cases where the signal may be weaker and the initial slowness to respond to the start of the burst outweighs the extension at the end of the burst and the recorded burst ends up much shorter than it really was. Recording the raw detector output removes such inaccuracies and gives you the frequency of the IR pulses automatically.
Qwlciguk
Full Member
Full Member
 
Posts: 111
Joined: Sat Nov 19, 2011 7:48 pm

Re: convert LIRC file to IRToy raw commands

Postby Barf » Thu Aug 07, 2014 11:30 am

Where are specification/documentation & sources for this program irtoy[.exe]?
Barf
Jr. Member
Jr. Member
 
Posts: 62
Joined: Mon Jul 07, 2014 3:12 pm

Re: convert LIRC file to IRToy raw commands

Postby Qwlciguk » Thu Aug 07, 2014 4:36 pm

Barf wrote:Where are specification/documentation & sources for this program irtoy[.exe]?


http://dangerousprototypes.com/docs/USB ... pplication

From spending time monitoring the serial communication to/from the irtoy.exe program and the IRToy, the bytes sent by irtoy.exe to the IR Toy to send IR, are precisely the binary contents of the file and are precisely the same bytes that IR Scrutinizer sends to the IR Toy to send the same IR.
Qwlciguk
Full Member
Full Member
 
Posts: 111
Joined: Sat Nov 19, 2011 7:48 pm

Re: convert LIRC file to IRToy raw commands

Postby zoulou » Sat Aug 09, 2014 6:24 am

I used the bugfixed irtoy.exe from the link above: viewtopic.php?f=29&t=4404
With this I am able to record and play the NEXT key and the DBT-T box reacts on it. Great!
However, doing the same with the PREV key, the box does NOT react. Very strange.

Btw. I noticed the bugfixed irtoy.exe records only 144 bytes, where the original recorded 152 bytes. But remember, the recorded NEXT key with 144 bytes works. I just wanted to mention this.

Then I patched the lead-ins in my (152 bytes) file for the PREV key that I recorded with the original irtoy.exe exactly how Qwlciguk showed above in post viewtopic.php?f=29&t=6678#p59001
Means, I changed 3 bytes in the file from 00 to 01 exactly at the positions that are marked red in Qwlciguk's post.
And now also the PREV key is recognized by the DVB-T box.

So, my problem is solved and I can continue to finalize my small project using the USB IRToy.
Thank you very much. A great forum!
zoulou
Newbie
Newbie
 
Posts: 5
Joined: Sat Jun 21, 2014 11:57 am

Re: convert LIRC file to IRToy raw commands

Postby Simpkins » Sun Aug 10, 2014 3:20 am

zoulou wrote:
Btw. I noticed the bugfixed irtoy.exe records only 144 bytes, where the original recorded 152 bytes. But remember, the recorded NEXT key with 144 bytes works. I just wanted to mention this.


NEC protocol should return 136 bytes but as there is a repeat sequence 0.1 seconds after the button press it is more often the case that 144 bytes are returned. If you are tardy on the button then you get two repeats and therefore 152 bytes. Get really slack and then it is 160, 168 etc.
Simpkins
Newbie
Newbie
 
Posts: 25
Joined: Mon Jul 21, 2014 12:23 pm

Next

Return to USB Infrared Toy