I have a TV as secondary PC monitor and console output, and I would like to build something to control it from the PC sources—turning on and off, volume and such. In short, a program to emulate my TV remote control.

I have no idea where to start, any suggestion?

  • 1
    I found another answer regarding CEC over at SuperUser.
    – JPhi1618
    Commented Sep 12, 2017 at 15:48

3 Answers 3


It depends on you skills and what exactly do you want to achieve. First of all it's wondering if you want a UI or a terminal-like script.

If you want a UI, and know Python, I'd go with QT or TK to create the interface. Then, use Serial to send messages to any MCU (Arduino or similar) and read those messages in the MCU. Once you got the message you can send the proper signal with an IR emitter.

To get the proper codes to send, you can either look for the codes online (rather difficult to find) or get a IR receiver and read the codes.

If you want a solution that uses your smartphone, you can use Blynk to control the monitor from whenever in the world. The process will be similar to the computer part, but, create the UI will be as simple as drag and drop.

  • I'm quite skilled in computers but a total zero in electronics, but the python + arduino looks quite what i had in mind, just one question what are QT ans TK? first time i heard those Commented Sep 12, 2017 at 9:29
  • QT and Tk are two different ways of create a UI. If you have nice programming skills I'll go with TK: wiki.python.org/moin/TkInter It's quite easy to get that up and running. Seems like a nice project. I wan't to do something like that but to control my AC.
    – Luis Diaz
    Commented Sep 12, 2017 at 9:50

You can do this a little easier (missing out the hardware building) by using something like a RedRat USB Ir blaster (http://www.redrat.co.uk/products/). They also do network attached versions that you can control via ethernet.

Another option is direct serial port control, LG TV's used to come with a RS232 port on the back that you could use to turn the TV on/off, change channel and input. Newer versions tend to have a USB socket on the back that you can plug a USB to serial adapter to do the same (though the last time I tried I could not turn the TV on from standby as the USB port got powered off). https://www.hardill.me.uk/wordpress/2010/02/26/a-different-kind-of-tv-remote-control/

Sony TV's that include Android TV have a Network API that you can use to control them. (nodejs library to control Sony Bravia with Android TV https://github.com/alanreid/bravia)

And finally there is HDMI CEC control, this is an extension to the HDMI spec that allows channel changes and other control over the HDMI cable. A raspberry pi can be set up to send these signals (https://www.raspberrypi.org/forums/viewtopic.php?t=15749). If you have the right HDMI CEC enabled graphics card you may be able to do this from a normal PC.

  • Cool! I've a LG TV. Will try to do that, just for fun :) Do you have a link or how to? Thanks!
    – Luis Diaz
    Commented Sep 12, 2017 at 15:28
  • I've added a link to the answer
    – hardillb
    Commented Sep 12, 2017 at 15:29
  • If your computer's graphics card does not support HDMI-CEC, it's possible to use a CEC injector, such as one from Pulse-Eight. These devices are connected in between the computer and display, and can inject HDMI-CEC commands via the libCEC library over USB. (Disclaimer: I've used these devices in some of my hobby projects but I do not work for Pulse-Eight) Commented Sep 13, 2017 at 1:13

There are generally 2 ways to control TVs:

  1. IR
  2. RS-232

Newer TVs might have Ethernet or Wi-Fi connections available, and also some level of support for CEC. You might be able to control them over the network with a manufacturer-specific app, but probably not via a documented protocol. CEC control was very spotty when it came out. I'm not sure if it's gotten more robust in the past couple of years.

There are DIY and commercial options for IR and RS-232. The internet has no shortage of DIY guides for Arduinos and Raspberry PIs over IR.

In the Professional AV field, RS-232 control is what's most often used. Basically, you open a telnet session on a com port, spew some commands, and the TV does stuff. The protocol documents for the 232 ports are usually available on the manufacturers website, or as part of a users manual, and there's usually a section for the command protocol. You may need a physical adapter for the RS-232 port. For example, 3.5mm to DB9, or RS-232c to DB9. Keep in mind that RS-232 and network based control gives your program feedback, while IR does not.

The OP settled on CEC, but anyone else will need to start with the specific make/model of the TV before you can attempt to figure out what its control options are (IR, 232, network, etc). Commercial TVs always have 232 ports, while residential TVs might or might not.

If you want to futz with ProAV stuff, you can usually get it online for pretty cheap. However, the software is harder to come by. Most often, the manufacturer won't give you their free software unless you're in a business relationship with them. Brands to look for: Savant, Crestron, Extron, Control4, or a company that has a booth at Infocomm (AV tradeshow).

I don't feel like I need a disclaimer, but I do work in Professional AV. Not at any of the companies listed.

Not the answer you're looking for? Browse other questions tagged or ask your own question.