Using Raspberry Pi to turn TV on and off directly (not using infrared) [closed]

I am creating a device that requires a TV to be powered on and off when commanded by the code in my Raspberry Pi 3 B+. The Raspberry Pi also needs some sensing ability to know if the TV is on or off, so it can execute the turn on function when necessary, or turn it off when necessary. I am going to eliminate the IR sensor on the TV so it can't be messed with by remotes. I am going to be controlling two TV's in this fashion, independent of one another. My TV has the generic button circuit board that is typical on TV's and monitors. All in all, I am not sure how I will do this from a hardware perspective.

closed as unclear what you're asking by Dmitry Grigoryev, Sean Houlihane, RoyC, Finbarr, Lior BiliaSep 14 '18 at 12:44

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• There are a few things you have not explain... Let me provide some examples from what you're telling us. First: "so it can execute the turn on function when necessary, or turn it off when necessary." What is the necessity and what is the condition of that necessity? Second: "I am going to be controlling two TV's in this fashion, independent of one another." Do you have an idea of how you want to turn on these devices separately? Is it a solenoid that will toggle a switch, how will you turn on the TV? – KingDuken Sep 6 '18 at 23:10
• There's also conflicting information. It sounds like you want to turn on a TV but somehow the TV needs to know if it's on or off. If the TV is off, what will the RPi do? If the TV is on, what will the RPi do? Obviously when the TV is off, you need to turn it on automatically somehow. But with this logic, it sounds like you want to turn on the TV automatically when it's off, thus keeping the TV on all the time and no way to turn it off automatically. – KingDuken Sep 6 '18 at 23:12
• So my advice for you is to forge up some state diagram before trying to understand what hardware you need. You need a state diagram because your idea right now conflicts with each other attributes of what you need to get done and there's no organization of what you need to do and how you will do it. – KingDuken Sep 6 '18 at 23:20
• @nick481 to be clear, what you want to do is quite possible. You can use the power LED signal to power optoisolators if you want. My tv has red if it has power(can turn on) and green if it's actually turned on. you can parallel a second switch to the power button to turn it off and on. Isolating the pi from the TV is wise at minimum and may be necessary. You can do this at a very low electronics skill level but be aware that line voltage devices may have dangerous voltages left behind in capacitors even after unplugged, so you would be wise to meter before you touch. – K H Sep 6 '18 at 23:42
• You already have a high level answer to control it over hdmi, but if you need a low level answer that will work with non-hdmi or a TV without CEC. If you have the CEC thingy it looks like you can control the TV somewhat in-depth though. – K H Sep 6 '18 at 23:49

You can use CEC (via HDMI) - I use libcec to turn my TV on and off with a RPi running a media centre. It also allows you to monitor the power state of the TV with the RPi.

• I didn't know that this existed. Thanks! – bitsmack Sep 6 '18 at 23:50
• That is perfect and just what I was looking for. Just need to make sure my TV has CEC enabled. – Nick481 Sep 7 '18 at 13:22

Simple method is using an IR Blaster cable, a IR transmitter tapped over the Tv's IR sensor, and a opto sensor over the Tv's power led. This would prevent other remotes from working by physically covering the sensor, and would avoid having to modify the TV internally. Existing RPi tv control code can work. The opto sensor is how you tell of the tv is on.

• I like this. Simple and direct. – bitsmack Sep 7 '18 at 0:52

You did not specify which TV you want to control, so I don't know if it possible for you.

I did same for my TV which has RS232 communication for command interface. So I opened TV and disconnected PCB with IR module (and hardware buttons) and connected to RS232 via level shifter, it worked perfectly.

• Now we don't know what TV you have either. – Transistor Sep 7 '18 at 9:36
• Model of my TV has no connection to pressence of RS232 connection on OPs TV. – Rokta Sep 7 '18 at 9:50
• @Rokta You might as well include that information just in case someone else finds this question. Wisdom of the Ancients – Andrew Morton Sep 7 '18 at 11:08
• My TV is a 32" Sceptre 720P LED. It is a budget tv which is why we chose it for our product we are developing. I am not sure about the communication interface. It does not have CEC so I can't control it with that unfortunately. It is a bare bones tv, with basically just the state switch power button and a power light. – Nick481 Sep 8 '18 at 18:20
• @Nick481 I quickly checked your model (x322bv-sr) and it does not have (outside) acess to RS232, so you will have to find other solution – Rokta Sep 10 '18 at 6:17