RPi Zero: HDMI CEC turning off TV but not on

  • Hello to everyone! :) As the title suggests, I've hooked an RPi Zero with the latest LE stable (9.2.6) to my TV which is correctly turned off through CEC but not on. I exclude an issue with my RPi nor one with LE so I tend to believe it is something HW related to my TV or maybe, I hope, just something to be fine tuned. I've already digged around and found out that I can poke with CEC by cec-client. From SSH, I've tried

    Code
    echo 'standby 0.0.0.0' | cec-client -s -d 1

    and it turns the TV off just fine but when later on I've tried

    Code
    echo 'on 0.0.0.0' | cec-client -s -d 1

    it seems it just can't connect to the TV anymore as I get no output at all (and the TV doesn't obviously turn on). It seems to me something like the TV isn't listening to CEC commands when in stand-by and I don't think there's much room for improvement should my guess prove to be right.

    Any advice? Thanks in advance to everyone! :)

    EDIT:

    For anyone interested, the use of cec-client is very well documented here, just for reference.

  • Hi and thanks for your reply. Here is the output:

    Not a good sign I believe... Before turning it off, it was:

  • I'll check ASAP but I wouldn't be able to do it immediately as I haven't that TV at hand. Should that one prove to be the explanation (very likely to happen, I had guessed it too), isn't there any workaround to such kind of scenario?

    I don't think so unfortunately, not from the RPi (and, I believe, any other device supporting CEC eventually connected) side but, eventually, only from the TV side with a firmware update for example (and there isn't any available, already checked). Thanks again and have a nice day! :)

  • The workaround is to stop using HDMI CEC ;)

    The major issue is there's almost NO compatibility between HDMI CEC capable devices, every vendor supports a different subset of HDMI CEC features and often it's a nightmare (or it's even impossible) to make it working as you wish.

    This is my experience based on long-time experimenting with 2 TV sets & LibreELEC's HDMI CEC support. Then I gave it up completely.

    So the question is what do you need from HDMI CEC.

    In my case it was just to turn on / off the TV set/display per request from LibreELEC. Even this most simple request did not work on my old LG TV as it was not possible to turn it off through HDMI CEC (the command was accepted but ignored).

    In your case TV accepts power off command but then stops receiving further HDMI CEC commands until turned on manually again. Perhaps there is a sleep command that you can use instead of power off. Also check if your TV does not offer some more deep HDMI CEC configuration.

    As I am using RPi 4B devices, the solution was to use GPIO pins for:

    1) control a relay for powering the TV/display

    2) send IR commands to TV

    A simple additional hardware (a relay, some resistors & transistors and IR diode) is necessary but it works much more universal and 100% reliable.

    Edited 3 times, last by ghtester (February 13, 2022 at 3:07 PM).

  • ghtester

    First of all, thanks for your reply. :) I absolutely praise your approach! It's mine too but this time we're going a bit (more than just a bit) beyond my knowledge given that I'm not that familiar with electronics and I don't know how to build the necessary circuitry! I need to document myself as it is certainly a very interesting approach and it could definitively help me.

    I know CEC is everything but not a standard as it should be and things are often broken. The reason which has led me to think about CEC is quite a strange one. I presume one of the leds backlighting the panel is failing (or its solder joints are, not a great difference anyway) and when I turn the TV on a small portion of the panel shows a shadow because of the missing backlighting. Just turning it off immediately then on again solves the issue and I can continue using the TV for hours with no issues at all, I don't know why honestly speaking. The only explanation I could think of is a bad solder joint which gets healed by the first power on but I don't know how turning it on for just a second could be enough to induce thermal expansion, very strange I have to say!

    I know it can be opened, the panel teared down and the culprit led replaced or its solder joints retouched and I could even do it but it is a matter of hours, a nightmare and even more a waste of time considering we're talking about a cheap TV set used in the kitchen so, instead of just replacing it (producing unnecessary e-waste is one of the things I hate the most), I've thought about reproducing the same by CEC (through a startup script) with the added extra of rendering a failing DVB-T TV a DVB-T2 smart one thanks to LE running on a cheap RPi Zero with an Xbox One tuner connected to it, the both of them already lying around.

    This is my aim. I don't know if an RPi Zero has enough horsepower (probably not but, should that prove to be the issue, I could even switch to something better if I would reach my goal as I'm almost sure it's possible to do) while I definitively know my approach is even stranger than the issue it is intended to solve: these are my mental processes! ;)

    Edited 3 times, last by -=guybrush=- (February 13, 2022 at 6:51 PM).

  • I'll check ASAP but I wouldn't be able to do it immediately as I haven't that TV at hand. Should that one prove to be the explanation (very likely to happen, I had guessed it too), isn't there any workaround to such kind of scenario?

    If you don't have another device to fire a CEC wake-up, you can try to power-off / power-on the RPi Zero. If you didn't changed LE's CEC adapter settings (see input device settings), this should fire the needed CEC event.

    I'm not convinced that it's really a TV issue, because RPi Zero isn't a well-tested device on LE. Read this thread: Click!

  • No problem, I understand your trouble, despite I did not expect the major request reason described. :)

    Please note if there's an issue with a single backlight LED, you can expect some another LEDs failing soon as well...

    BTW. I saw even so burned out backlight LED that the white folio around was burned too. So it might be even dangerous when not fixed. And the recommended fix is to replace the whole backlight if possible.

    FYI there's an example regarding to IR send / receive hardware. Of course the CR2032 battery is not necessary as the circuit can be powered from RPi. https://www.digikey.com/en/maker/blogs…-a-raspberry-pi

    The software utilities are already part of LE and it just need to be configured easily.

  • Da Flex

    Thanks for all your precious advices. I'll check and report back ASAP. We're talking about a quite cheap TV set (though with a good full HD panel, the reason why I'd like to avoid recycling it) so I'm not confident they've put great effort on the firmware side (especially CEC which often fails even on some models from renowned brands) but on the other hand I've understood your point about the RPi Zero.

    ghtester

    I know my detailed escription is of no use for you or anyone else and I apologize (considering it is quite an off topic too) but I didn't know how else to explain what I'm trying to achieve. I couldn't just say "I want to turn the TV on then off then on again.": if I had done it, you had replied "Are you mad or what?" or something similar and you had been right.

    Thanks for the Digikey page: interesting but I'm more interested in the relay thing. Don't worry anyway: I'll try to find out by myself. For what concerns the need for a repair, I obviously agree with you but there are other considerations to be carried out. I wouldn't go into detail otherwise I would make another useless off topic.

    Thanks! :)

  • I agree we are sliding to OT, so the last remark... ;)

    Regarding to relays - it is much more dangerous than IR because of a high voltage in the circuit. So be careful if you don't have an experience with this. There are some nice examples:

    Raspberry Pi power on - enable relay
    There are loads of Youtube videos on how to control a relay, but I simply want to be able to power up my Pi and let it activate a relay. Then, when I power it…
    raspberrypi.stackexchange.com
    How to Control a Relay using Raspberry Pi | Electronics Hub
    In this project, we will learn about Relay and Relay Module, interface a Relay with Raspberry Pi and see how to control a Relay using Raspberry Pi. This…
    www.electronicshub.org
  • ghtester

    Maybe I'm missing something from your first post on the thread but unless I get CEC to work completely so for turning both on (like currently it doesn't) and off the tv, my last resort is the relay because I need to be able to turn the TV on and off through the RPi which can be then controlled by an IR remote so that I'm completely free from CEC gaining at the same time the extra of needing only one remote, the one controlling the RPi. The remote alone shouldn't solve my issue, should it? I don't think so.

    Thanks for your advices, maybe OT but very instructive and useful to have a valid alternative to CEC. Have a nice day! :)

  • Both outlined solutions should work, a relay everytime and IR if your TV can be controlled through IR Remote Control (in this case you can use RPi to send IR commands through a simple HW with IR diode to TV). I am using both methods. IR is more universal (and safe as you don't need to work with High Voltage circuits) so you can record IR commands from original IR Remote Control for any IR controlled device and then send these IR commands from RPi to devices (including but not only power on / power off).

    Only one IR Remote Control is necessary - even from your old TV - to control RPi and RPi can control your TV or another devices around (that are covered by the IR diode range).

    Edited once, last by ghtester (February 14, 2022 at 10:35 AM).

  • Hello again. I'm certainly still missing something. The IR remote is a great deal and I had already thought about that in sinergy with CEC (which unfortunately seems not completely working though I still need to go more into detail carrying on other test) and I'd really like to avoid the relay if possible BUT as previously explained I wanted to automate the on-off-on thing by a startup script. This can be done with CEC (if working completely) and with a relay connected to GPIO but not with an IR remote controlling the RPi (and not the TV), not according to me at least but I could well be mistaken.

    Indeed, given that the Digikey project you've sent to me involves using the RPi both as an IR receiver and sender (while I was thinking about the simpler solution of using it as a receiver only), I can think of making a script to send the IR code to turn on/off the tv to get what I'm looking for but this would force me to put the RPI with all its cables in front of the TV and this is quite a mess while I was planning to fix it to the VESA holes on the back. I may solder both the sender and the receiver connected to the RPi on cables long enough to put them both inside the TV case then just let the cables out of it to connect them to the RPi on the back. A neat approach! Shouldn't I succeed in getting my result by CEC, that would be the path I'll follow!

    Given that by my brief research (still need to deepen it enough), by now it seems to me IR is just a serial interface, I could even think of taking a look at the TV IR receiver and, if possible, disconnect it from the TV itself and route it directly to the RPi then connect the RPi sender line directly to the TV motherboard. Too overkill, I know! ;) I don't think I would do it because I'm almost sure I would end up with a fried RPi or TV motherboard (or even them both if I would be good enough!) but it would be great!

    OT again. I apologize, again. I would only report back the progress with troubleshooting CEC and nothing else but I have to say it has been quite instructive and useful to tidy up my approach. It often (if not always) happens when you're not left alone with your ideas and skills. ;)

    Edited once, last by -=guybrush=- (February 14, 2022 at 11:02 AM).

  • No problem, you don't need to put whole RPi in front. It's all about the IR LED position & power. The cable / wires to IR LED and IR sensor can be long and thin enough so it's up to you which design you select. If you plan to control just your single TV, I believe you can do it so the both IR sensors can be almost invisible, even without opening the TV box.

  • I can confirm the issues with CEC were linked with the TV while LE stable 9.2.6 on the RPi Zero handles it just fine. I've just tried it on a recent Philips model with no issues at all, even after issuing a standby command by cec-client. I'll mark the thread as solved. Thanks to ghtester and Da Flex for their precious support!