Your Universal Remote Control Center
RemoteCentral.com
General Pro Remotes Forum - View Post
Previous section Next section Previous page Next page Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Page 1 of 3
Topic:
Convert Short Hex IR Codes to Pronto Compatible Hex Codes
This thread has 31 replies. Displaying posts 1 through 15.
Post 1 made on Friday August 30, 2013 at 01:29
Achin
Long Time Member
Joined:
Posts:
August 2013
32
I am working on universal remote, i have 40BF30CF IR CODE now please anyone guide me how can I convert that IR code into Pronto hex code in JAVA as the Yamaha Pronto IR Hex Converter converts.in this link [Link: dl.dropboxusercontent.com] for example I put the above IR code into box and click on generates button then i got the Pronto hex code as output I have Pronto Hex Code And I want to convert the above into wave file to and after converting I also want to play the wave file with Medial player and i have device which generates the signal when i connect that to my android phone on 3.5mm jack
Post 2 made on Monday September 2, 2013 at 16:15
Barf
Long Time Member
Joined:
Posts:
August 2013
350
First of all, there is no such thing as "short hex ir codes". (Actually, there is, but it is something completely different.) You are likely using the Shirriff library for Arduino, which, if I understand things correctly, provides a something like a partial decode for NEC1 signals and others. This may not be the best place to ask for support for Shiiiff's library... I plan to look into it in the near future. If so, you can use IrMaster (or IrpMaster, from the command line or through Java API), using the protocol nec1-f16: first 8bits for D, next 8 for S, the rest (16) for F; do not forget to prefix the hexadecimal numbers by "0x". Assuming this, the given number corresponds to

0000 006C 0022 0002 015B 00AD 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0016 0016 0016 0016 05F7 015B 0057 0016 0E6C

which can be shorter described as NEC1, device = 64, function=207.

I have described in your other thread how to convert this to wave from Java. I do not know Android hardware or the Medial player.
OP | Post 3 made on Thursday September 5, 2013 at 00:53
Achin
Long Time Member
Joined:
Posts:
August 2013
32
hi, thanks for your help, that really helps me, first i will tell you about my hardware you can check this link [Link: righto.com]
and to use this we have to download the software also ,
when i press the any button of my TV this will capture the signal genertaed by the TV remote and on the serial monitor(software for the hardware i'm using) it gives me some hex value like 40BF58A7 and from Yamaha Pronto IR Hex Converter you can check this link [Link: dl.dropboxusercontent.com]
i will put that hex value into the box and click the generate button and it gives me Pronto hex code and from, that Pronto hex code i will make a wave file from using your code and when i play that wave file from my mobile which is having a device connected to 3.5 mm jack that will generates the signal and the signal is captured by the serial monitor of arduino but not working on my TV
for eg i press the menu button of my sansui tv in front of my device and that gives me this value 40BF30CF
and i put this value into Yamaha Pronto IR Hex Converter that gives me the Pronto hex code of this value and using this value i have generates a wav file using your code but when i play this wav file from my mobile (having device which generates the signal) that did not work for my TV , i mean the menu is not opening
from this value 40BF30CF , it gives me the following Pronto hex code
0000 006D 0022 0002 0155 00AA 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0015 0015 0040 0015 0040 0015 0040 0015 0015 0015 0040 0015 05ED 0155 0055 0015 0E47
and i have created a wave file from this code
try {

IrSignal irSignal = Pronto.ccfSignal("0000 006D 0022 0002 0155 00AA 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0040 0015 0040 0015 0040 0015 0015 0015 0040 0015 05ED 0155 0055 0015 0E47");
ModulatedIrSequence modulatedIrSequence = irSignal.toModulatedIrSequence(1);

Wave wave = new Wave(modulatedIrSequence, 44100, 16, 2, true, true, true, false);
wave.export(new File("servOK2.wav"));

}catch(IrpMasterException ex) {
Logger.getLogger(IrpMaster.class.getName()).log(Level.SEVERE, null, ex.toString());
}
and when i play this from my mobile i did not work and it did not open yhe menu but it is detectable by my hardware i'm using
Post 4 made on Thursday September 5, 2013 at 02:05
3FG
Select Member
Joined:
Posts:
August 2009
1,861
When using the Yamaha Pronto IR Hex Converter, it is necessary to put a space between the first 2 bytes and the second 2 bytes.  Use 40BF 30CF instead of 40BF30CF.  The Pronto Hex you generated using 40BF30CF decodes as 0x000080DD, and of course it doesn't work.

It is far better to use instead IrMaster, because it gives you the facility to enter the above bytes and to then decode the generated Pronto Hex to see if it is reasonable.  Select NEC1, enter 0x40 into the D field and 0x30 into the F field. leaving S blank.  
0000 006C 0022 0002 015B 00AD 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0016 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0041 0016 0041 0016 05F7 015B 0057 0016 0E6C

We don't need to enter the BF or CF into IrMaster.  Note that in your decode 40 and BF add to FF, and 30 and CF add to FF.  That's a characteristic of the simplest form of NEC, so IrMaster can calculate the BF and CF values. We ususally describe this as NEC1 device 64, function 48.  If the first two bytes don't add to 0xFF, then enter the first byte into D and the second byte into S.  Finally if the 3rd and 4th bytes don't add to 0xFF, use NEC1-f16 as Barf described above.  Of course you can always use NEC1-f16 if you don't mind typing in all 4 bytes.

Last edited by 3FG on September 5, 2013 02:15.
OP | Post 5 made on Thursday September 5, 2013 at 03:43
Achin
Long Time Member
Joined:
Posts:
August 2013
32
thanks for reply,
i will explain a bit more first you can see this video and i have sansui tv as you can see in this video he is getting the IR code just pressing the button of remote in-front of the arduino hardware, and i am using the same hardware to detect the IR code for e.g., when i press my sansui TV Power button infront of the device i am getting this code 40BF48B7 and i have converted from this Ir hex code to Pronto hex code and make wav using IrMaster but it is not working. my TV is not getting ON/Off.
i have another query , can we convert this 40BF48B7 ir code into pronto hex codes in JAVA , i mean via coding ?
Post 6 made on Thursday September 5, 2013 at 14:45
Barf
Long Time Member
Joined:
Posts:
August 2013
350
On September 5, 2013 at 03:43, Achin said...
....
i have another query , can we convert this 40BF48B7 ir code into pronto hex codes in JAVA , i mean via coding ?

There are at least two ways: Either add

[protocol]name=rawnecirp={38.4k,564}<1,-1|1,-3>(16,-8,A:32,1,-78,(16,-4,1,-173)*)[A:0..4294967295]
to the end of IrpProtocols.ini and use code like

HashMap parameters = new HashMap();
parameters.add("A", Long.ParseLong("40BF48B7", 16));
IrSignal irSignal = new IrSignal("IrpProtocols.ini", "rawnec", parameters);


How to get from an IrSignal to a Wave, I have shown in previous posts.

Or you can use the existing nec1-f16 protocol:

HashMap parameters = new HashMap();
long A = Long.parseLong("40BF48B7", 16);
long D = (A & 0xff000000L) >> 24;
parameters.add("D", D);
long S = (A & 0x00ff0000L) >> 16;
parameters.add("S", S);
long F = A & 0xffffL;
parameters.add("F", F);
IrSignal irSignal = new IrSignal("IrpProtocols.ini", "nec1-f16", parameters);


It is really easy!

I will address the wave problems in the other thread.

Last edited by Barf on September 5, 2013 15:32.
OP | Post 7 made on Friday September 6, 2013 at 02:33
Achin
Long Time Member
Joined:
Posts:
August 2013
32
hi, i will give description of my wave hardware as you asked me in my another thread, you can check in this link about my hardware [Link: rtfms.com]
in the 4th picture , i am using the same device, i mean the two LEDs which are connected to 3.5 mm jack.
now i have used your above codes and i have some issues -
i have sansui TV, and i have capture it's POWER button IR code 40BF48B7 and when i capture it's IR code from different angles of my remote, it gives me 40BF48B7 this IR code , i mean to say whatever be the position of my remote it gives me this 40BF48B7 static value,
and using your above code i have created a wav file and when i play this wave in-front of my IR capturing device it gives me different Ir code value from one position,I am not understanding why it is giving me different value from same position and my TV is not getting ON/OFF . i am using the below code , i have used both code

HashMap parameters = new HashMap();
long A = Long.parseLong("40BF48B7", 16);
long D = (A & 0xff000000L) >> 24;
parameters.put("D", D);
long S = (A & 0x00ff0000L) >> 16;
parameters.put("S", S);
long F = A & 0xffffL;
parameters.put("F", F);
IrSignal irSignal = new IrSignal("IrpProtocols.ini", "nec1-f16", parameters);

System.out.print(irSignal);

ModulatedIrSequence modulatedIrSequence = irSignal.toModulatedIrSequence(1);

Wave wave = new Wave(modulatedIrSequence, 48000, 8, 2, false, false, true, false);
wave.export(new File("Newfile6.wav"));

and i also used this code

[protocol]name=rawnecirp={38.4k,564}<1,-1|1,-3>(16,-8,A:32,1,-78,(16,-4,1,-173)*)[A:0..4294967295]
to the end of IrpProtocols.ini and use code like

HashMap parameters = new HashMap();
parameters.add("A", Long.ParseLong("40BF48B7", 16));
IrSignal irSignal = new IrSignal("IrpProtocols.ini", "rawnec", parameters);


Post 8 made on Saturday September 7, 2013 at 11:54
3FG
Select Member
Joined:
Posts:
August 2009
1,861
I took a look at Shirrif's code. It appears that he is incorrectly decoding the NEC IR protocol. NEC defined the custom code (sometimes called the device number) and data codes (sometimes called function numbers) with the least significant bit sent first in each byte.
So his decode 40BF48B7 turns into 02FD12ED, also known as NEC device 2, function 18.  Try that instead.   Even better, post the raw IR capture so we can decode the signal.

ETA:  See pages 59 and 60 of this document for a description of the NEC IR protocol (simplest version).  You'll see that the least signficant bit is sent first.

Last edited by 3FG on September 7, 2013 14:50.
OP | Post 9 made on Monday September 9, 2013 at 02:03
Achin
Long Time Member
Joined:
Posts:
August 2013
32
thanks for reply
here is my raw ir codes for 40BF48B7.(my sansui tv power button code).
raw data Freq=38400Hz [9024,-4512,564,-564,564,-564,564,-564,564,-564,564,-564,564,-564,564,-1692,564,-564,564,-1692,564,-1692,564,-1692,564,-1692,564,-1692,564,-1692,564,-564,564,-1692,564,-1692,564,-1692,564,-1692,564,-564,564,-1692,564,-1692,564,-564,564,-1692,564,-564,564,-564,564,-564,564,-1692,564,-564,564,-564,564,-1692,564,-564,564,-39756][9024,-2256,564,-96156][]
Post 10 made on Monday September 9, 2013 at 14:27
3FG
Select Member
Joined:
Posts:
August 2009
1,861
The timing list shows that the correct decode is device 0x40, function 0xB7, or device 64, function 183 in decimal.  So when calling IrpMaster 40BF48B7 should be changed to 40BFB748.
OP | Post 11 made on Wednesday September 11, 2013 at 06:42
Achin
Long Time Member
Joined:
Posts:
August 2013
32
hi, i have told you about my hardware that only give the Protocol like in this case 40BF48B7 my hardware give that it is nec protocol , but can i need to know which sub type of nec protocol the remote is based on. whether to use nec1, nec2 or nec f16.
OP | Post 12 made on Wednesday September 11, 2013 at 06:49
Achin
Long Time Member
Joined:
Posts:
August 2013
32
i have another thing to ask
i have hex code 20DFFF00
and when i play this one in front of my hardware to detect the protocol it some times gives me raw code like Received unknown code, saving as raw
m8800 s4450 m350 s750 m450 s600 m450 s1800 m450 s600 m450 s650 m450 s650 m350 s700 m500 s600 m450 s1750 m450 s1750 m450 s650 m450 s1700 m450 s1800 m400 s1750 m500 s1750 m450 s1700 m500 s1750 m450 s1800 m450 s1850 m450 s1800 m450 s1800 m500 s1750 m450 s1850 m450 s1800 m450 s650 m450 s700 m450 s650 m450 s700 m450 s650 m450 s650 m500 s650 m450 s650 m450
Pressed, sending
Sent raw
Released

and some times gives me
Received NEC: 20DFFF00
Pressed, sending
Sent NEC 20DFFF00
Pressed, sending
Sent NEC repeat
Pressed, sending
Sent NEC repeat
please can you explain this thing, is it something wrong in my detection hardware?
Post 13 made on Wednesday September 11, 2013 at 12:39
3FG
Select Member
Joined:
Posts:
August 2009
1,861
The raw data in Post #9 is NEC1.
Post 14 made on Wednesday September 11, 2013 at 16:20
Barf
Long Time Member
Joined:
Posts:
August 2013
350
try adding the protocol below to the end of IrpProtoocols.ini, and use your full 32-bit number as F for IrMaster (prepend by 0x) and IrpMaster.

[protocol]
name=necShirrif
irp={38.4k,564}<1,-1|1,-3>(16,-8,F:8:24,F:8:16,F:8:0,F:8:8,1,-78,(16,-4,1,-173)*)[F:0..4294967295]
OP | Post 15 made on Thursday September 12, 2013 at 05:07
Achin
Long Time Member
Joined:
Posts:
August 2013
32
ok, the above helps me and i have found another strange thing
as i have told you that when i press my sansui TV power button, on the Serial monitor i got 
Received NEC: 40BF48B7
Pressed, sending
Sent NEC 40BF48B7
Pressed, sending
Sent NEC repeat
Pressed, sending
Sent NEC repeat
Pressed, sending
Sent NEC repeat
Pressed, sending
Sent NEC repeat
Pressed, sending


and using the above Hex code 40BF48B7 i have created a wav file and when i play this wav file then in the serial monitor i got
Received NEC: repeat; ignoring.
Pressed, sending
Sent NEC 0
Pressed, sending
Sent NEC repeat
Pressed, sending
Sent NEC repeat
Pressed, sending
Sent NEC repeat
and the code i have used is below
 HashMap parameters = new HashMap();
        
        long A = Long.parseLong("40BF48B7", 16);//02FD12ED//40BF48B7
        long D = (A & 0xff000000L) >> 24;
        parameters.put("D", D);
        
        long S = (A & 0x00ff0000L) >> 16;
        parameters.put("S", S);
        
        long F = A & 0xffffL;
        parameters.put("F", F);
        
        IrSignal irSignal = new IrSignal("IrpProtocols.ini", "nec1-f16", parameters);//NEC1-f16(nec1-f16) //NEC1
 
        System.out.println("raw data "+irSignal);
        System.out.println("Pronto "+irSignal.ccfString());
        
        ModulatedIrSequence modulatedIrSequence = irSignal.toModulatedIrSequence(1);
        //Wave wave = new Wave(modulatedIrSequence, 48000, 8, 1, false, true, true, false);
        Wave wave = new Wave(modulatedIrSequence, 48000, 8, 2, false, false, true, false);
        wave.export(new File("Powebutton.wav"));
 
 and my raw and pronto code is 
raw data Freq=38400Hz [9024,-4512,564,-564,564,-564,564,-564,564,-564,564,-564,564,-564,564,-1692,564,-564,564,-1692,564,-1692,564,-1692,564,-1692,564,-1692,564,-1692,564,-564,564,-1692,564,-1692,564,-1692,564,-1692,564,-564,564,-1692,564,-1692,564,-564,564,-1692,564,-564,564,-564,564,-564,564,-1692,564,-564,564,-564,564,-1692,564,-564,564,-39756][9024,-2256,564,-96156][]
Pronto 0000 006C 0022 0002 015B 00AD 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0041 0016 0041 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0016 0016 0041 0016 0016 0016 05F7 015B 0057 0016 0E6C
but it not working my TV is not getting ON/OFF
 
Page 1 of 3


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse