I doubt I’ll actually publish this skill though. I could now create a web shortcut on my android phone to turn on my tv with 1 touch! In the end, this wasn’t enough, and I am now creating an Alexa skill to control power and mute with my voice. Once I ran minicom to get the settings properly configured on the serial adapter, I could just redirect an echo to the device and send commands. I had to change the permissions on /dev/ttyUSB0 to read-write for all (that’s 0666 in linux permission codes) if I wanted any user other than root to be able to connect. I had to do a firmware update ( sudo rpi-update from the command line) to get the USB-serial adapter to connect to the TV, but once that was done I could connect with minicom set to use /dev/ttyUSB0. The raspberry pi (3rd gen) that I used had ubuntu mate installed. At this point I realized that I could have used the built in serial connections on the GPIO pins, but I already had the working USB connection, so I just kept using that. I decided I should pull my old raspberry pi out of the closet and set it up as a server with a rudimentary TV control API. Ka 00 00 This was great, but plugging in a laptop, launching a terminal and typing a command is definitely not an improvement over finding the remote (or pressing the power button on the tv). Here is an example for the power on command. The third group is the value for the command, like on or off for the power command, or the volume level for the volume command. I just use 00 which is the “all sets” code. The second is the set ID, and as far as I can tell this is only important if you have multiple sets daisy chained together. The first group contains the COMMAND1 and COMMAND2 characters. The way to type these codes is in 3 groups, each separated by a space, then followed by carriage return command (this means pressing the Enter key in an interactive terminal). I found the LG command codes here (PDF) (link is now dead as of Dec 2019, try this ). In putty, I left “flow control” at the default XON/XOFF option. Specifically, that means 9600 baud, 8 data bits, no parity bit, and 1 stop bit. The common “9600 8N1” settings did the trick. I opened up putty and configured it based on a little googling. I opened the device manager to find out which COM port was assigned to the adapter (it was COM3 – typical). My laptop is running Windows 10 and luckily the USB-serial adapter is truly plug and play. My wife (who is much more slender than I am) provided some valuable assistance in this step. My tv is on a slim mount on the wall, so it was a little bit difficult to get the 3.5mm plug all the way in.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |