Making an IR to RS232 adapter

Forum for the discussion of JP1 Interfaces, hardware hacks, etc.

Moderator: Moderators

Post Reply
madmalkav
Posts: 63
Joined: Thu Sep 01, 2011 7:44 am

Making an IR to RS232 adapter

Post by madmalkav »

As LG discrete codes are lacking a lot of functions I'm making this adapter to have full control of my device. I will post here my advances and question, and when finished the code and other needed info.

My first question is: there a way to see NEC device/subdevice combinations not in use by any remote to use it on my device?

EDIT: seems like I'm having a bad time understanding the relationship between what I have configured in Remote Master and what the Arduino decodes, i.e.

4B6040BF

Vol+ 61381 183 6 none 2 NEC1 BF 00

Seems easier with Sony protocols:

9EB92

Menu Up 63134 190 Sony20 26 73 121 9E 5B

(I know that 92 is the subdevice 73 from the setup protocol window on RM and 9E is part of the hex, I just don't understand what is that B in the middle)
madmalkav
Posts: 63
Joined: Thu Sep 01, 2011 7:44 am

Post by madmalkav »

Ok, got it, Sony 20 is a 20 bits string formed with 7 bits for the OBC, 5 bits for the Device and 8 bits for the subdevice. Bits are inverted, so i.e. 121 decimal is ‭01111001 binary and 10011110 in this format, right?
Barf
Expert
Posts: 1522
Joined: Fri Oct 24, 2008 1:54 pm
Location: Munich, Germany
Contact:

Post by Barf »

My first question is: there a way to see NEC device/subdevice combinations not in use by any remote to use it on my device?
Hard to get a really reliable answer, but you can use the "Lookup tool" of this forum. Tried it for a minute, and it seems like no-one is using device 75.

You appears to be using the Arduino and the Shirriff IR library. This does not use a parametrization compatible with the usage e.g. in this forum. Speaking of NEC1, if I recall it correctly, the bytes of the four bytes are D, S, F. and F inverted, but in the wrong bit-order, i.e., Shirriff uses MSB-first order, while NEC1 officially interprets the bytes in the LSB-first order.

Using an Arduino Mega, a max232-based converter, an old Oppo DVD, and a random old remote, and my previous work in https://github.com/bengtmartensson/AGirs I was able to cook up a prototype (Opponator), contained in the Git-stuff mentioned. Can this serve as inspiration?
pH7_jp1
Posts: 485
Joined: Sun Sep 14, 2003 4:17 pm
Location: Sterling Heights, MI

Post by pH7_jp1 »

Edit - OOPS. Barf just posted why you probably don't want this, but just in case, You might be interested in this: http://www.righto.com/2009/09/arduino-u ... d-and.html I was able to use this code to receive and store IR codes, recognize which command was received, and send out a stored command. It can decode and encode NEC commands pretty well.
madmalkav
Posts: 63
Joined: Thu Sep 01, 2011 7:44 am

Post by madmalkav »

Thanks a lot guys. I already got good part of the work done, currently I'm doing a PC program to convert a spreadsheet to the code for the Arduino.
The spreadsheet holds Function Name, Sony20 device, Sony20 subdevice, OBC and RS232 command. Most of the code is already written and this program will take that spreadsheet and generate the cases for a switch instruction.
madmalkav
Posts: 63
Joined: Thu Sep 01, 2011 7:44 am

Post by madmalkav »

First version of the project uploaded to:

https://github.com/madmalkav/IR2RS232

Everyone be aware that barf's code is orders of magnitude better than mine, I'm doing this as a learning experience but sooner or later will try to modify the code to use his aproach.

I have tested this with my PC, tomorrow I will try with my TV. I'm pretty sure repeats aren't going to work. I'm also pretty sure repeats in Sony20 are just 0xFFFFFFFF so I will have to modify my code to detect that and issue previous command if detected. Perhaps also a timer to so the repeats aren't too fast.

Image
Post Reply