CIRCA unravelled

Discussion in 'Infrared (NIRT, IR Reader) and CIRCA' started by Will, Mar 28, 2005.

  1. Will

    Will

    Joined:
    Aug 3, 2004
    Messages:
    27
    Likes Received:
    0
    Location:
    Sunshine Coast
    Good news for anyone automating Home Theatre

    I'm sure that many of you, who have been working with InfraRed control, have already struck problems with automating equipment predictably.

    Many manufacturers issue remote controls for their equipment, with only a necessary subset, of the complete IR command set. Problems arise specifically, when you have to use a menu system to reach a particular function (eg sleep, component input), or the biggest problem, toggling power and not knowing whether the equipment is in the ON or OFF state.

    To help solve some of these problems, most manufacturers have an additional instruction set, known as 'Discrete' commands. These discrete instructions often include a dedicated POWER ON and POWER OFF.

    Problem 1. How do we find these codes?
    Answer. There are several options here
    1. Check the users documentation to find the appropriate codes
    2. Contact the manufacter and request the full instruction set
    3. Use a third party resource that has already done the hard work, such as www.remotecentral.com (Discrete Hunter forum)


    Problem 2. How do we convert the instructions into Circa XML format?
    Answer. I have chosen, possibly the easiest format to explain, and the most common, readily comparible format to Circa, Philips Pronto Hex.

    In this example I will be using the discrete 'OFF' command for a Panasonic Plasma TV, specifically a TH42PA20U model. I'm certain the command works with several different Panasonic Plasma TV's.
    If you successfully find discrete codes for your equipment, they will generally look something something like this:

    Power OFF:
    0000 0071 0000 0032 0080 003f 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0010 0010 0010 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0010 0010 0030 0010 0a98


    1. Copy and paste the codes into Notepad
    2. Note the second code, 0071 which is 113 in Decimal, this relates to the carrier frequency (Calculated by using 1000000 / N * 0.241246 where N is the Pronto value.
    3. Delete the first four codes (eg 0000 0071 0000 0032) and the last code (eg 0a98)

    You will notice that the rest of the codes are made up of only a few different numbers. These numbers represent time periods and here is where it gets interesting.

    Pronto measures time in cycles, so the actual period of time is dependent upon the carrier frequency.
    Circa measures time directly in milliseconds. If you examine the end of a devices XML file, you will see a protocol definition containing a list of Vocabulary elements. ie this excerpt from the learned remote codes for the Panasonic Plasma.

    PHP:
    <ProtocolDef>
        <
    Name>PANASONICEUR511281</Name>
        <
    CarrierFreq>36364</CarrierFreq>
        <
    FrameRate>134</FrameRate>
        <
    Format>I</Format>
        <
    Pframes>
          <
    Pframe>
            <
    Name>I</Name>
            <
    Type>Data</Type>
          </
    Pframe>
        </
    Pframes>
        <
    MinFrames>4</MinFrames>
        <
    MaxFrames>255</MaxFrames>
        <
    Vocabulary>
          <
    VocabularyElement>
            <
    Name>A</Name>
            <
    Duration>444</Duration>
          </
    VocabularyElement>
          <
    VocabularyElement>
            <
    Name>B</Name>
            <
    Duration>1297</Duration>
          </
    VocabularyElement>
          <
    VocabularyElement>
            <
    Name>C</Name>
            <
    Duration>1754</Duration>
          </
    VocabularyElement>
          <
    VocabularyElement>
            <
    Name>D</Name>
            <
    Duration>3504</Duration>
          </
    VocabularyElement>
        </
    Vocabulary>
      </
    ProtocolDef>
    You see here that Vocabulary element A is 444 milliseconds and so on.
    It becomes quite apparent that the duration codes in the Pronto Hex relate directly to these Vocabulary elements. eg.
    A = 444 = 0010Hex = 16 cycles
    B = 1297 = 0030Hex = 48 cycles
    C = 1754 = 003fHex = 63 cycles
    D = 3504 = 0080Hex = 128 cycles

    These are educated guesses, to be certain you could apply the formula 1000000 / carrier freqency * cycles to see that these assumtions are correct. Don't be alarmed if the numbers don't match exactly. InfraRed has a tolerance for around a 10% variation.

    Now back in Notepad

    4. Select 'Edit' then 'Replace'
    5. Find '0010' and replace it with 'A' (please don't include the inverted comma's) then select 'Replace All'
    6. Find '0030' and replace it with 'B' then select 'Replace All'
    7. Continue replacing the hex codes with the Circa Vocabulary elements as in the above table.
    8. Find ' ' and replace with nothing then select 'Replace All' (to remove all spaces)

    Now you will have a string of all capitalised letters looking something like this:
    DCAAABAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAABABABABABABAAAAABABABABABABAAABA
    What we have here is a series of letters that relate to durations.

    InfraRed instructions are a series of pulsed light of varying intervals. In Pronto, every second code relates to the light OFF duration and the rest are light ON durations.
    Circa determines the the light ON period by using a capital letter and the light OFF period with a lower case letter. So now you will have to manually change every second letter in the string to a lower case letter. You should end up with something like this:
    DcAaAbAaAaAaAaAaAaAaAaAaAaAaAbAaAaAaAaAaAaAaAaAaAbAaAaAaAaAaAaAaAaAbAbAbAbAbAbAaAaAbAbAbAbAbAbAaAbA

    So if you now paste the following into the XML file

    PHP:
                <IRCommand>
                  <
    Name>
                    
    OFF
                  
    </Name>
                  <
    IconName />
                  <
    Continuous />
                  <
    Frames>
                    <
    Frame>
                      <
    Name>I</Name>
                      <
    IRcode>        DcAaAbAaAaAaAaAaAaAaAaAaAaAaAbAaAaAaAaAaAaAaAaAaAbAaAaAaAaAaAaAaAaAbAbAbAbAbAbAaAaAbAbAbAbAbAbAaAbA
                      
    </IRcode>
                    </
    Frame>
                  </
    Frames>
                </
    IRCommand>
    You will create a Circa command, accessible by importing the XML file into Circa.


    There are other formats available to convert from, I have chosen the easiest to explain and the most common, readily comparible format to Circa.


    Tips:

    Microsoft Excel has functions for converting Hex to Decimal, though you may have to select 'Tools', 'Add-Ins' and select the 'Analysis Tool Pack' first.
    Functions are 'Hex2Dec(Hexnumber)', 'Dec2Bin(Decimalnumber)'

    Some Pronto codes have a few extraneous pieces on the end, usually after a long pause. I have found, so far, that the tailing codes can be safely ignored.

    I have had great success converting, even generating, commands from other formats. I should warn that a good understanding of both the IR protocol you are using and Binary is necessary. The following links are essential reading for anyone persuing this line of interest.


    IR Protocol Knowledge Base
    ProntoEdits IR Display Format
    The Tonto Project
    Bi-Phase IR RC5 format


    Good luck to you all. I hope this helps some of you considering expensive and inelegant solutions involving LED readers, General Input Modules and other monitoring devices.
     
    Will, Mar 28, 2005
    #1
  2. Will

    Richo

    Joined:
    Jul 26, 2004
    Messages:
    1,257
    Likes Received:
    0
    Location:
    Adelaide
    Good work Will!

    What you post seems to be pretty much on the ball. Thanks also to Gavin for his work in providing hex format info as well.

    The code interpretation won't be changing for the next version of Circa, although expect the XML format to alter a fair bit.

    Circa V2 is in active development at the moment (massive changes!) so if you have any specifc thoughts on what you would like to see, let me know.

    Also I will look at releasing the official format infomation as well, should make it easier for enterprising individuals to make a more complete conversion tool. I will ask the powers-that-be.
     
    Richo, Mar 29, 2005
    #2
  3. Will

    Htnut

    Joined:
    Aug 4, 2004
    Messages:
    97
    Likes Received:
    0
    Location:
    Sydney
    The Pronto .ccf format is almost a de-facto standard now.The are many codes available on remote central in .ccf format. A .ccf import function would be a valuable feature for Circa V2
     
    Htnut, Mar 29, 2005
    #3
  4. Will

    Will

    Joined:
    Aug 3, 2004
    Messages:
    27
    Likes Received:
    0
    Location:
    Sunshine Coast
    Thanks Richo,

    Gavin tied it up for me with the keys to Circa code. I did a few searches for IR protocols, a little reading and the rest of it I worked out during the Easter break.... and John (my CBUS course presenter) said it couldn't be done... Cheers John ;)

    I have to agree with HTNUT, a ccf to CIRCA converter would be great way of tapping a huge home automation resource. It's been 15 years since I last wrote software but I'm contemplating learning Visual C++ just to write a converter myself. :rolleyes:
     
    Will, Mar 29, 2005
    #4
  5. Will

    Richo

    Joined:
    Jul 26, 2004
    Messages:
    1,257
    Likes Received:
    0
    Location:
    Adelaide
    I'm not sure how much I should say on this topic, and there is a lot that can be said, but I assure you CIS is very aware of this. The problems aren't technical, put it that way. It is something we are constantly trying to reslove.
     
    Richo, Mar 29, 2005
    #5
  6. Will

    Sergio

    Joined:
    Apr 18, 2005
    Messages:
    28
    Likes Received:
    0
    How about this way?

    I found text below in AMX manual for program IREdit
    "Discrete IR Hex Codes
    Hex format codes available only online. Therefore, hex format codes cannot be captured from manufacturer's remote by IRIS and added into an .IRN or .IRL/.IRV file.
    IREdit utilizes the base format (raw oscillated code) of the hex codes (available at www.remotecentral.com).
    Discret hex codes can be imported into IREdit via wizard process".

    Is it possible to add this feature to CIRCA?
     
    Sergio, Sep 10, 2005
    #6
  7. Will

    Richo

    Joined:
    Jul 26, 2004
    Messages:
    1,257
    Likes Received:
    0
    Location:
    Adelaide
    It is certainly on the todo list and is a desired feature.
     
    Richo, Sep 12, 2005
    #7
  8. Will

    MrEcosse

    Joined:
    Aug 5, 2004
    Messages:
    22
    Likes Received:
    0
    Fantastic Help

    This is really useful, just shelled out on a Clipsal IR reader and it won't read the one remote I just have to get into the system. It uses an NEC protocol but doesn't follow the complementing rules for some reason. The Remote Central article is well worth reading too.

    Just one question could be daft but how do you work out the Frame Rate in the XML file?
     
    MrEcosse, Sep 14, 2005
    #8
  9. Will

    coppo

    Joined:
    Sep 7, 2004
    Messages:
    221
    Likes Received:
    10
    Location:
    Adelaide
    code importing

    From all the times i have asked previously about CCF support for CIRCA,
    the normal problems come down to legal issues.

    Whilst any of you out there are within your rights to do what ever you want,
    typically without legal ramifications..

    ie : if it works for your project .. great .. and away you go.

    From a company perspective.... there are proprietary issues, the same as
    CIS would be if someone was chopping up the c-bus protocol then
    distributing it.

    You will also notice that people posting info on this topic will commonly put a
    disclaimer about.. if it dont work.. dont hold me responsible. CIS would be held responsible
    regardless so you might now better understand some of our previous replies.

    CIS, has in the past, helped people out by doing the following:
    You source the IR codes suitable for a pronto pro
    You supply them to CIS
    CIS loads them into a pronto pro that we have.
    CIS learns from the pronto pro into our 5100RP reader unit.
    We then send you back the xml "formatised" code

    This has worked well for us in the past, however please do not expect a same day turn around for the learnt codes.

    hopefully as richo posts we may see some changes in the future.
     
    Last edited by a moderator: Apr 19, 2006
    coppo, Apr 19, 2006
    #9
  10. Will

    Gavin Nation

    Joined:
    Aug 3, 2004
    Messages:
    32
    Likes Received:
    0
    This may help

    Here is a spreadsheet that may help with the above. Paste in your HEX code and press the button.

    You will ne the Analysis toolkit for Excel and then follow Wills assembly instructions from above.

    This is supplied 'as is' and all that usual stuff. I have used it may times and it works, but no doubt as soon as someone else uses it, it wont.

    But any comment on errors gratefully accepted.

    Yep, its big, lots of formulae.

    Gavin

    PS Thanks JohnC, please be warned the spreadsheet only works on Excel 2002 and later. You must also have a medium macro security level and enable the macro to run.
     

    Attached Files:

    Last edited by a moderator: Jun 30, 2006
    Gavin Nation, Jun 30, 2006
    #10
  11. Will

    JohnC

    Joined:
    Apr 6, 2005
    Messages:
    554
    Likes Received:
    1
    Location:
    Sydney
    Gavin, couple of problems...

    1) Had to save the file to local drive (ie: not run it inside IE web browser), then enable 'Prompt for Macro Execution' then re-open in the real Excel. No big deal, but could confuse some people.

    2) I don't have a Pronto, so I left the default string in the input box... clicked THE BUTTON and got a Runtime Error 1004 (see attached).

    3) Debug screen also attached - something wrong with the sort method on the block (I didn't bother trying to de-engineer to find out what or why) - I assume that perhaps the method is not available in this "old" version of VB ?

    This comp runs XP SP2, Excel 2000 (9.0.6926 SP-3).

    ----------------------

    Note, I was just testing the code, I have no actual need for it :)
    Cheers, John
     

    Attached Files:

    JohnC, Jun 30, 2006
    #11
  12. Will

    Gavin Nation

    Joined:
    Aug 3, 2004
    Messages:
    32
    Likes Received:
    0
    Yep, method problem

    Hmm, written on XP SP2, Excel 2002. Tried on another laptop with Excel 2000 and same problem as yourself. Had this problem with other macros and have given up writing for Excel 2000. Seems to be Sort method most of the time. Might have a go over the weekend getting it to work on 2000 version.

    Thanks anyway
    Gavin
     
    Gavin Nation, Jun 30, 2006
    #12
  13. Will

    Beerygaz

    Joined:
    Dec 25, 2005
    Messages:
    52
    Likes Received:
    0
    Location:
    Johannesburg, South Africa
    Guys, I'm about to take the plunge and get a couple of 5034's. I know CIRCA doesn't have the right codes built in and CIRCA 2.x is now out. Does this post still apply to 2.x? Will I still be able to make me an XML file and use Gavin N's spreadsheet to get the Pronto codes converted?

    Thanks
    Gaz.
     
    Beerygaz, Jan 24, 2007
    #13
  14. Will

    Richo

    Joined:
    Jul 26, 2004
    Messages:
    1,257
    Likes Received:
    0
    Location:
    Adelaide
    The XML structure in Circa 2 has changeds slightly. But the information regarding the protocol formats and definition strings is all the same. I have never tested Gavin's stuff, but if it worked before, the same core info applies to Circa 2.
     
    Richo, Jan 24, 2007
    #14
  15. Will

    bennett01

    Joined:
    Apr 30, 2007
    Messages:
    3
    Likes Received:
    0
    Sorry i just don't get it!
    I have a major problem with :
    1. the maths doesn't make sense
    2. the Onkyo Receiver and DVD in a major showroom is not responding to the codes i've captured. Learned them with the ir learner. applied them to the nirt with circa. the led flashes and the devices do nothing.

    Explain:
    1. The maths. Note on page 1:
    You see here that Vocabulary element A is 444 milliseconds and so on.
    It becomes quite apparent that the duration codes in the Pronto Hex relate directly to these Vocabulary elements. eg.
    A = 444 = 0010Hex = 16 cycles
    B = 1297 = 0030Hex = 48 cycles
    C = 1754 = 003fHex = 63 cycles
    D = 3504 = 0080Hex = 128 cycles

    These are educated guesses, to be certain you could apply the formula 1000000 / carrier freqency * cycles to see that these assumtions are correct. Don't be alarmed if the numbers don't match exactly. InfraRed has a tolerance for around a 10% variation.

    Doing the math on your first example 1000000/36364*16 = 1.7187328 ????
    444 Decimal = 01BC hex

    2. In the case of my installation ..........
    When the data is read from the xml file it's already in the format required. eg EdAaAbAa...etc etc. Feed that via circa to the nirt and noone is playing. It fires the emitter but the receiver is not impressed. Even copied the codes to a marantz pronto and then copied them in to find they do not work either, but i get strange results from the xml file. Long and short presses produce radically different results. does it really have to be this complex?
    When i check remote central, they have listed some of the hex discrete codes for Onkyo products. Not the exact model numbers i'm dealing with. But none the less when i compare those Hex combinations with what you are describing here they do not match.
    Any suggestions on how i might resolve this?
    Would copying the codes off remote central and converting to xml work. If so, what frequency is used for the math? and the formula?

    Have programmed the panasonic projector using all the same gear and found it works flawlessly. It was soooooo easy!

    Try explaining what is wrong to someone like my client, who finds it hard to program their VCR timer?!! They just want it to work!
     
    bennett01, Jun 20, 2007
    #15
  16. Will

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,427
    Likes Received:
    64
    Location:
    Adelaide
    Math Correction

    I think if you get the order of operation correct you'll find it's right..

    (1000000/36364) * 16 = 439.9956

    Nick
     
    NickD, Jun 21, 2007
    #16
  17. Will

    bennett01

    Joined:
    Apr 30, 2007
    Messages:
    3
    Likes Received:
    0
    Nick,
    Thank you for the explanation. Can you go further and show you get 444 = 0010 Hex?
    And then how i can get that to convert to a code stream to suit my problem devices?
    Thanks for the help.
     
    bennett01, Jun 21, 2007
    #17
  18. Will

    Will

    Joined:
    Aug 3, 2004
    Messages:
    27
    Likes Received:
    0
    Location:
    Sunshine Coast
    Onkyo Receivers

    From memory (I have and Onkyo TX-NR801) the trouble you are having with your Onkyo receiver, is most likely that they don't just use one protocol. You will find that the different groups of buttons use different protocols. Try learning a few different button groups' protocols and see what you get.

    A trap for the new player is also to turn off your laptops IR port while you are learning codes. The laptops IR port is constantly searching for other IR equipment and if you happen to have the IR learner in close proximity it will be receiving interference from your laptop.

    I'm sorry this is only brief, but I hope it helps for the moment.
     
    Will, Jun 21, 2007
    #18
  19. Will

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,427
    Likes Received:
    64
    Location:
    Adelaide
    I thought I just did that?

    Forgive me I've I've misunderstood your question and am stating the obvious, but 0010 hex = 16 decimal, so 16 * (1000000/36364) ~= 440 (as close as you can get to 444 in increments of (1000000/36364).

    You mention that you have access to a pronto.. perhaps you could learn both the code from your remote AND the "same" code from the NIRT into the pronto and compare the resulting pronto files.. this may help you track down why the "same" code from the NIRT doesn't work.

    Nick
     
    NickD, Jun 22, 2007
    #19
  20. Will

    muppets

    Joined:
    Oct 26, 2007
    Messages:
    98
    Likes Received:
    0
    Is there any reason there has not been a programming facility implemented that operates over the cbus network?
    I have asked my wholesaler for the usb programming cable that appears in the catalogue (due 2007) and it appears like most of the gear "clipsal" that was due out this year is still lost in transit. (Still waiting for the 30 series f-type to rca inserts).

    I would buy a programming cable as they are not expensive however serial ports are becoming scarce these days and the only one I have involves jumpstarting an old box we have in the shed.
     
    muppets, Oct 29, 2007
    #20
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.