While I was waiting for my HDMI to RS232 converter to do it’s thing, I did some more googling and discovered this forum post (big thanks qwerty_UK for posting!) of Yamaha/NEC IR codes for my Yamaha RX-V767 AV receiver. The scans listed several of the codes I was after, but I had no way to covert them to LIRC format. Since I already knew some of the AV receiver IR codes in LIRC format from irrecord, I thought I’d have a look at converting between the two.
The Yamaha/NEC (YN) codes come in 4 types:
- xx-xx (eg 7E-2A)
- xx-xxxx (eg 7A-532C)
- xxxx-xx (eg 7F01-5A)
- xxxx-xxxx (eg 7F01-5E21)
LIRC required a 32bit number for the Yamaha IR codes. When you match them up, it doesn’t make a lot of sense:
- KEY_POWER: 0x7E8154AB -> 7E-2A
- KEY_AV1: 0x5EA1CA34 -> 7A-532C
- KEY_1: 0xFE808A75 -> 7F01-5A
- KEY_PRESET-: 0xFE807A84 -> 7F01-5E21
In binary however, patterns start to emerge (the xxxx’s are explained later, and the colon is just to split the 32bit number for ease of reading):
- KEY_POWER: 0111 1110 xxxx xxxx : 0101 0100 xxxx xxxx -> 0111 1110 – 0010 1010
- KEY_AV1: 0101 1110 xxxx xxxx : 1100 1010 0011 0100 -> 0111 1010 – 0101 0011 0010 1100
- KEY_1: 1111 1110 1000 0000 : 1000 1010 xxxx xxxx -> 0111 1111 0000 0001 – 0101 1010
- KEY_PRESET-: 1111 1110 1000 0000 : 0111 1010 1000 0100 -> 0111 1111 0000 0001 – 0101 1110 0010 0001
So from this, some rules can be deduced.
For the YN 16bit codes (xx-xx):
- LIRC Byte 1 is YN Byte 1 with nibbles swapped, and nibble bit orders reversed
- LIRC Byte 2 is 0xFF – LIRC Byte 1
- LIRC Byte 3 is YN Byte 2 with nibbles swapped, and nibble bit orders reversed
- LIRC Byte 4 is 0xFF – LIRC Byte 3
For the 2-4 YN 24bit codes (xx-xxxx):
- LIRC Byte 1 is YN Byte 1 with nibbles swapped, and nibble bit orders reversed
- LIRC Byte 2 is 0xFF – LIRC Byte 1
- LIRC Byte 3 is YN Byte 2 with nibbles swapped, and nibble bit orders reversed
- LIRC Byte 4 is YN Byte 3 with nibbles swapped, and nibble bit orders reversed
For the 4-2 YN 24bit codes (xxxx-xx):
- LIRC Byte 1 is YN Byte 1 with nibbles swapped, and nibble bit orders reversed
- LIRC Byte 2 is YN Byte 2 with nibbles swapped, and nibble bit orders reversed
- LIRC Byte 3 is YN Byte 3 with nibbles swapped, and nibble bit orders reversed
- LIRC Byte 4 is 0xFF – LIRC Byte 3
For the YN 32bit codes (xxxx-xxxx):
- LIRC Byte 1 is YN Byte 1 with nibbles swapped, and nibble bit orders reversed
- LIRC Byte 2 is YN Byte 2 with nibbles swapped, and nibble bit orders reversed
- LIRC Byte 3 is YN Byte 3 with nibbles swapped, and nibble bit orders reversed
- LIRC Byte 3 is YN Byte 4 with nibbles swapped, and nibble bit orders reversed
Unfortunately the post is a jpeg scan of a service manual, so I had to enter the codes manually. After a lot of typing, here is the resulting CSV file. To the end of the file I added some extra codes I’d found from my testing.
With the translation figured out, and the codes entered, it was a simple matter to dodgy up some python to generate LIRC codes from the Yamaha/NEC codes.
The program generates a separate LIRC “remote” for each of the zones supported by the chosen receiver, plus an ALL “remote” for codes that don’t apply to specific zone.
Invoking the script is done as follows:
python yamahanec2lirc.py <infile> <device> <product> <id_code> > <output_file>
where:
- infile is the CSV file containing the Yamaha/NEC codes
- device is used to filter the codes for a specific system. Most codes apply to RECEIVER
- product is the receiver to filter the codes for. Valid options are 667, 767, 867, 1067, 2067, 3067
- id_code is the code set to generate (either 1 or 2). The default is 1. The receiver can be configured to accept either the ID1 or ID2 code set, which would allow 2 receivers to work alongside each other without interference.
The generated remote definitions are printed to stdout, and it’s a simple matter to pipe them into a file. For example:
python yamahanec2lirc.py yamaha_rxv.csv RECEIVER 767 1 > yamaha_rxv767.lircd
The resulting output file can be seen here. This is then included into the lircd configuration file (usually /etc/lirc/lircd.conf):
include "/home/nobbin/yamaha_rxv767.lircd"
After restarting lircd, you can use irsend to send these codes to your receiver:
irsend SEND_ONCE RECEIVER_767_MAIN POWER_POWER_ON
Enjoy…
Notes:
The codes have been tested for the RX-V767. The other supported receivers are the RX-V667, RX-V867, RX-V1067, RX-V2067, RX-V3067. However as I don’t have access to any of these, I haven’t tested them.
The ID2 codes haven’t been tested either.
The last column (Export Comment) in the CSV file allows comments to be added to the generated LIRC config file, any text here will appear as a LIRC comment on the line preceding the remote code. If the “export comment” column entry is prefixed with “#”, then the actual remote code will be commented out in the LIRC config file. This allows potentially dangerous codes, like the “self test mode” code, to be commented out, so they can’t be sent accidentally.
The python script contains functions to convert from lirc format into Yamaha/NEC format. Checkout the source if that interests you.
Hello,
I read your post. Very useful. I have yamaha rxv 365 receiver. Trying to generate a lircd.conf without luck.
when i use irsend, nothing happens. Tried many many lircd.conf without success. Also raw codes nothing happens. Do you have an idea how must be a lircd.conf for rxv 365 (RAV34 remote control).Thanks in advance.
Hi Ilker,
A quick google showed up a repair manual for you receiver: http://elektrotanya.com/yamaha_rx-v365_htr-6230_sm.pdf/download.html
On page 97 it lists the Yamaha/NEC IR codes for your remote (RAV34) in the form Custom Code-Data Code (eg standby 7E-7F). Many of these codes are identical to my RX-V767 (eg STANDBY, SCENE1-4, VOLUME+).
You could try using my lircd.conf file: https://github.com/nobbin/infrared/blob/master/remotes/Yamaha_RXV767.lircd and the following command “irsend SEND_ONCE RECEIVER_767_MAIN VOLUME_VOLUME+” to confirm that your IR blaster is working. If it works, it’s a simple matter of entering all the RAV34 codes into a CSV file and running it through yamahanec2lirc.py to generate the lircd.conf.
Also looking at your IR blaster LED though a digital camera, you should be able to see if the LED is flickering when you send commands via irsend.
What IR blaster are you using? All my testing was done with a Microsoft MCE IR Receiver/Blaster.
I have had some problems with “irsend SEND_START” crashing irsend, and refusing to send any more IR commands until I reboot. I think this might be to do with some brokenness in the kernel as it looked like the LIRC drivers were being merged into the kernel input/event device subsystem. This was around version 3.2. I’m not sure what state they are in in current kernels.
Hope this helps.
Hi,
i am using a Raspberry Pi with a Keyes IR Transmitter and IR receiver too. And i configured lirc so i can handle with my LG TV. But like mentioned my problem is my RX V365. So i can confirm my IR Transmitter is working. But my problems generating a right lircd.conf. The one for rx 767 is not working
many greets
So i now i have to put codes from the manual in a csv. Then i can use the python script.
But i have to understand how
WOW, Thank you so much for this. I can now control my Yamaha Pianocraft CRX-E100. All I had were the NEC codes from the Service Manual. I’m running Logitech Media Server with the IRBlaster plugin and my Squeezebox Touch can now control my receiver via freshly soldered IR blaster. Script worked fine on a Raspberry Pi with Squeezeplug. I only had to add my codes to the provided csv file.
I’m glad it helped you out.