M1XSP + LG LCD TV

drvnbysound

Senior Member
Alright guys I've done a LOT of searching and haven't been able to find an answer, so I'm looking for some help...
 
As the thread title states I've got a M1XSP connected to the RS-232C port of my LG LCD TV. The LG protocol is included as part of the owners manual - easy enough. I'm able to send commands to the TV just fine; I can power it on/off, change it's input etc. My issue is that I can't figure out how to get the return messages from the TV; I know they are being sent, but I haven't figured out the syntax of what the Elk 'Text' needs to be to "receive" them.
 
If you aren't familiar I will explain a small portion of the LG protocol. For power, the transmission instruction is: [k][a][ ][Set ID][ ][Data][Cr] ; For the Data, 00 is OFF and 01 is ON. My Set ID is 01. So if I want to power ON the TV I send: ka 01 01Cr; or in Elk terms: ka 01 01^M
 
As mentioned above, my problem is the receipt of the Acknowledgement messages. When the TV receives the Power command and returns an Acknowledgement message in the following syntax: [a][ ][Set ID][ ][OK][Data][x]; so when viewed via Telnet I receive the following when the TV is powered on: a 01 OK01x
 
I assume part of my issue is that the Acknowledgement message doesn't end with a Cr, but rather the terminating character is always 'x' .... and I'm not sure how to handle that in Elk 'language'
 
Any ideas?
 
If you use HyperTerminal/Putty to send the Acknowledgement message with a CR appended, do you get the desired response from the ELK?  If yes, then it wouldn't be too difficult to program a small microcontroller to relay all of the LG TV messages with a CR appended.
 
jpmargis said:
If you use HyperTerminal/Putty to send the Acknowledgement message with a CR appended, do you get the desired response from the ELK?  If yes, then it wouldn't be too difficult to program a small microcontroller to relay all of the LG TV messages with a CR appended.
 
I hadn't tried to send the Acknowledgement message via Telnet yet... only other various test messages. I will go try sending the identical message now and report back.
 
That said, I haven't programmed a microcontroller in at least 7-8 years. I was really hoping that I could do this with the XSP alone without having to add additional equipment :( Argh!
 
Elk does not need a CR to receive a message, if you define a message as 01 OK01x, then Elk should trigger on its receipt.
 
When I define the ACK Text in Elk RP as: a 01 OK01x^M     and send that via Telnet (which requires me to press Enter to send the message, thus inserting the Cr) Elk responds accordingly.
 
However, when I define the ACK Text as: a 01 OK01x     which is what the TV outputs (as listed in the documentation and inspected via Telnet) Elk does not seem to be reading the message.
 
Note, that I have a simple rule setup to turn On/Off a phantom output based on the receipt of the message.
 
I just realized that the XSP I have has firmware version 1.0.48.... 1.0.50 is the current version. I'm going to update that now and will report back.
 
I'm also going to see if there have been any firmware updates on the TV... if I can't get the XSP to respond without the Cr, maybe LG provided an update which added one :praying:
 
In other news, in my search for answers I also found this LG resource site, which is dedicated to their RS-232 protocol: http://www.lgrs232.com/ 
 
UPDATE: After updating the XSP firmware, I see no change (wasn't really expecting one).
 
picta said:
Elk does not need a CR to receive a message, if you define a message as 01 OK01x, then Elk should trigger on its receipt.
 
I found this earlier (info circa 2006): "The carriage return character should be (^M) and it MUST be included in the text string you write using ELK-RP "Texts" section. TIP: When writing your text in RP, use the provided pulldown box "Insert" to place the carriage return at the end. (^M is an ASCII 13) The transmitting equipmnet MUST also include the ^M on the end of its text."
 
Info above found here: http://m1dealer.elkproducts.com/index.php?module=phpwsbb&PHPWSBB_MAN_OP=view&PHPWS_MAN_ITEMS[]=191
 
Tried a few more things this evening; still no joy. I guess I will be sending an email over to Elk support later tonight/tomorrow and see if they can provide any additional insight.
 
I have LG TVs connected to my HAI OP2 panel, and it can receive the strings. I thought I had this working in the past with my Elk also, but when I checked the old code I found that the serial communication with TV was handled from homeseer, which then would set a flag in the Elk. So I have to retract my statement about not needing CR, most likely it is still required :(
 
picta said:
I have LG TVs connected to my HAI OP2 panel, and it can receive the strings. I thought I had this working in the past with my Elk also, but when I checked the old code I found that the serial communication with TV was handled from homeseer, which then would set a flag in the Elk. So I have to retract my statement about not needing CR, most likely it is still required :(
 
Thanks for checking into that... although definitely :(
 
I don't want to have to run software JUST for this... I'm doing everything that I want from the Elk alone right now.
 
jpmargis said:
If you use HyperTerminal/Putty to send the Acknowledgement message with a CR appended, do you get the desired response from the ELK?  If yes, then it wouldn't be too difficult to program a small microcontroller to relay all of the LG TV messages with a CR appended.
 
Based on the most recent information, can you point me in a direction for the microcontroller solution? Do you have any experience doing this? Seems that this may be the most economical solution for me...
 
This is on the large size, but it will serve your purpose.  Sparkfun sells it for $16.95.  You will also need the ATmega328P microcontroller, also from Sparkfun, for another $4.30 and a 9 volt wall wart.  The UART demo software on the Olimex web site is VERY close to what you need!  The bad news is that you will need Atmel Studio 6.1 and a compatible programmer to modify the demo code and load it into the microcontroller.
 
jpmargis said:
This is on the large size, but it will serve your purpose.  Sparkfun sells it for $16.95.  You will also need the ATmega328P microcontroller, also from Sparkfun, for another $4.30 and a 9 volt wall wart.  The UART demo software on the Olimex web site is VERY close to what you need!  The bad news is that you will need Atmel Studio 6.1 and a compatible programmer to modify the demo code and load it into the microcontroller.
 
Thanks for the suggestion! As mentioned above, I haven't messed with any microcontrollers in quite a while and I won't claim to know much. Having said that, based on some initial research of my own (and also based on their popularity), is there any reason that you didn't or wouldn't suggest an Arduino? I'm assuming it's just as capable of doing what I need...
 
First, it's twice the cost when you include the required RS-232 to TTL converter.  Second, the RS-232 to TTL converter sticks out perpendicular to main Arduino board which negates any size advantage and makes it more difficult to package.  (I guess you could make a cable to get it parallel.)  But, yes, it is capable as evidenced by many, many high school science fair projects!
 
I found the RS-232 shield, which mounts on top of the Uno board; the connectors/cables would be parallel to the main board and my SMC backplate (my M1XSP is mounted flat, with the RS-232 parallel to the backplate as well). My SMC (as most are) is ~3.5" deep, so I don't think there would be any issue with form factor/space.
 
Regarding the cost, the solution you posted is $21 for the board and microcontroller, add a few dollars for the wall wart... and I'm not sure what the cost of a compatible programmer is (??)
 
I think the Arduino would be ~$50 for everything that would be needed. I'm not sure that it would be double the cost, but it's still relatively cheap compared to all of the other components...
 
Additionally, the fact that the Arduino is 12VDC means that I wouldn't need an additional power supply, because my SMC has an 8-port 12VDC Leviton module already. I'll probably go this route as it seems that there would be a LOT of support available, and I was thinking about getting my younger brother a starter kit for Christmas anyway.
 
Back
Top