Category Archives: Programming

LG TV controller

Behind my LG TV there is a RS232 port. I have always been curious what that port does. Then I read the manual (after 5 years of curiosity) and apparently you can control almost everything in the TV with simple serial commands and it´s well documented in the manual.

The commands are built in three segments: “[COMMAND] [TV ID] [VALUE]”. For example, if I would like to turn on my TV, the command is Serial.println(“ka 01 01”), where “ka” is the command for power. To turn it off again I use Serial.println(“ka 01 00”). You can also check if the TV is on or off via the command Serial.println(“ka 01 FF”) and it will return “a 01 OK01” (on) or “a 01 OK00” (off).

After testing the commands from my computer via null modem cable I ordered a RS232 to TTL converter module. A simple way to use software serial to control RS232. The hardware is simple to set up. I use a 5v Arduino Mini Pro, the RS232 to TTL, mini usb BOB (only for power source) and of course the NRF24L01 radio with a socket adapter to communicate with my MySensors gateway.

I bought this one: RS232 To TTL Converter Module

• Connect the radio like always.
• Connect the VCC on RS232 to 5v, ground to ground, RX to D6 and TX to D7

Schematic for LG TV controller

Here is the code to get everything running. This code is written to communicate with MySensors gateway.