Power Up Pi via HDMI/CEC
#1
I'm new here so hi to all and I would certainly appreciate any assistance offered.

My problem is this ... I have a RPi setup as a media player behind my Samsung TV/Monitor called a P22770HD. It is essentially a monitor with a TV tuner built in. It has Anynet support (CEC) I have it plugged in via HDMI with a good quality cable and have tried two USB power supplies which are greater than 1 mAh rating.

I'm running currently Openelec but have also tried Raspbmc which both react the same way. The issue being when I shut down the TV with the Sammy remote the TV shuts down as does the Pi but when you turn it back on it wont power back up with the remote. The settings in the Rpi are set to shut down in the CEC settings.

So I turn the pi off at the wall then turn it back on which it boots up but brings up an error message about an incorrect shut down and data loss.

Is there something I'm missing here, my understanding was when you press the remote anything connected via hdmi with CEC setting enabled would boot up?

I have tried the Suspend option in CEC settings and that appears to work ok but all LED's are still lit on the board which makes me think its not really suspended at all.

Any ideas greatly appreciated.
Reply
#2
The Pi never shuts off in the traditional sense, even when "powered off". When you boot a Pi, a value is read from a special memory location very early in the boot sequence and if set it causes the CPU to be held in a reset state, so when you "power off" a Pi this special memory location is set and the Pi rebooted, hey presto you have a Pi which is "Powered off". The only way to clear the memory location is by physically removing power so it's not possible to "power on" a "powered off" Pi using HDMI unless the HDMI is somehow controlling the power (perhaps powering the Pi via a TV USB port).

The Pi also has no suspend support.

If you're powering your Pi using a wall charger, you'd be better off just leaving the Pi always on, even when the TV is off - it won't be using much electricity.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#3
Thanks for the prompt reply. I don't have a problem with the Pi staying on at all. From what i have read I was under the impression the Pi could be controlled remotely with the TV remote via HDMI/CEC. Overall it does a good job and I have no problem navigating around the menus with the TV remote but when I saw the CEC settings which had the option to suspend or shutdown I assumed thats what it would do.

So the settings in the CEC section dont relate to the Pi is that correct? More for a HTPC system ?

Thanks for your assistance
Reply
#4
You can most certainly control a Pi over HDMI using CEC and your TV remote control, it's just that once you have "powered off" the Pi (which doesn't really power it off, it just leaves it stuck doing nothing but using minimal power) there is then no way to restart the Pi without first removing power from the Pi. So don't power off the Pi, unless you really want to shut it down (perhaps for maintenance).

Set CEC to "Ignore" when the TV is switched off. The Suspend option doesn't apply to the Pi and should have no effect.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#5
Thanks for your input .... much appreciated
Reply
#6
(2013-09-26, 06:14)Milhouse Wrote: You can most certainly control a Pi over HDMI using CEC and your TV remote control, it's just that once you have "powered off" the Pi (which doesn't really power it off, it just leaves it stuck doing nothing but using minimal power) there is then no way to restart the Pi without first removing power from the Pi. So don't power off the Pi, unless you really want to shut it down (perhaps for maintenance).

Set CEC to "Ignore" when the TV is switched off. The Suspend option doesn't apply to the Pi and should have no effect.

I know this post is older, but it's the closest I could find to what I needed. I am relatively new to KODI (6 months) and am getting rid of a cheap Chinese box to do a clean install and my own build. I just ordered a RPi2. My question is this, I connect to my receiver via HDMI and a power cord so both the receiver and box shut off and power on at the same time. From everything I have been reading, it's easier to just keep the RPi2 powered on. If I keep it plugged in to an always on supply, the HDMI connection should not power it down, correct?
Reply
#7
Correct you HDMI on the TV will not power down your pi. Oh and your Chinese remark ! LOL They also make the pi.
One HTPC Windows 7 pro 64x running WMC with 2 HDhomeRun on Comcast 6 tuners with MCEbuddy
WD MyCloud 24TB over Netgear network | 6500 movies and 40,000+ TV Show episodes
Reply
#8
(2016-02-21, 01:09)Rickt1962 Wrote: Oh and your Chinese remark ! LOL They also make the pi.

Only very early ones. These days they're made in Newport, Wales.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#9
(2016-02-21, 01:31)DarrenHill Wrote:
(2016-02-21, 01:09)Rickt1962 Wrote: Oh and your Chinese remark ! LOL They also make the pi.

Only very early ones. These days they're made in Newport, Wales.

Well unless the Chinese are selling Pirated ones. I purchased 2 new Pi-2 last month from element14 and its stamped made in PRC
"People's Republic of China"
One HTPC Windows 7 pro 64x running WMC with 2 HDhomeRun on Comcast 6 tuners with MCEbuddy
WD MyCloud 24TB over Netgear network | 6500 movies and 40,000+ TV Show episodes
Reply
#10
A Simple circuit to power up Pi via HDMI/CEC.

Hi all, here is how I solved the problem of booting up Rpi running LibreElec (OpenElec) with TV remote using HDMI CEC.

1. Some background.

1.1. After you shut down Rpi using LibreElec menu or via LibreElec CEC control by powering down the TV
the Rpi enters "dormant" state waiting for low pulse on GPIO03 (pin 5) to boot up.

1.2 When you power the TV up it sends a whole bunch of CEC packages on HDMI : ~ 3sec long burst of pulses.
Actually observed it on 32" JVC TV and 47" Vizio TV but most likely any CEC enabled TV will query its HDMI
neighbours at power up.

2. Solution.

2.1. Use CEC pulses generated by the TV at power up to boot up the Rpi.

2.2. I connected the CEC wire from HDMI connector directly to the pin 5.
The Rpi did wake up but hang at the attempt to play a movie.

2.3. What I found was that the Rpi could not tolerate that many pulses on GPIO03 specifically at boot time -
possibly too many unexpected interrupts. Later during normal operation the CEC bursts were making no harm.

2.4. Now the solution is to use a pulse extender - something that will turn that deadly initial burst into one long pulse.

2.5. I tried CD4098 monostable with R=1M and C=10uF and found that at 3.3V it was so weak that could not pull down the GPIO pin.
Added a transistor to the output of the 4098 and it worked, the Rpi booted up and functioned normally.

2.6. Later I also found out that transition time of the trailing (positive) edge of the extended pulse did not matter at all
and arrived at the circuit consisting of one P-channel MOSFET, one N-channel MOSFET one 10uF capacitor and one 2M resistor.

2.7. I used ZVP4424A for P-ch and 2N7000 for N-ch MOSFET. Any small MOSFETS will work as long as absolute value of the Vgs is below 3V.

2.8. Receiving P-ch mosfet can probably be replaced with a PNP transistor (did not try it).
The output transistor must be of MOSFET type to provide that long of extension.
Large values of capacitor an resistor should take care of the Vgs variation.

Code:
-------------------------------------------------------------------------------------------

                               |-------------------------------------->  pin 1 +3.3V
                               |  
     To HDMI CEC        G      | S                       D
     HDMI pin13   <--------|---|                   |------------------>  pin 5 GPIO03 (Boot)
     Mini HDMI pin 14      |   |                   |
                           |-->|  P-ch MOSFET      |<--|  N-ch MOSFET
                           |      ZVP4424A       G |   |  2N7000
                           |---|------------|------|---|      
                               | D          |          | S               Rpi pins
                               |           ---         |
                             -----  10uF   | |  2M     |
                             -----         | |         |
                               |           | |         |
                               |           ---         |
                               |            |          |
                               --------------------------------------->  pin 6 GND

                          Rpi CEC boot circuit
Sorry for the ASCII art, I could not find a way to attach graphics.


2.9. The circuit is so small that I soldered the components directly to the pins on the Rpi board.

2.10. For connection to the CEC I had to scratch off the coating and solder a thin wire to the PCB
trace fixing the wire with glue later. It was easier than soldering directly to the pins of the HDMI connector.

2.11. I tried the circuit on Rpi B gen1 and Rpi Zero W. Two Rpi Zero W players running LibreElec with this circuit have been
working with no problems for 2 months on two TVs - 32" JVC and 47" Vizio. The players take power from the USB ports of the TVs.

2.12. I set CEC options in LibreElec to shut down the Rpi on power down of the TV and simply turn the TV off.
After turning off the TV still keeps the Rpi powered allowing it to complete the shutdown sequence and remain in the
"dormant" state. When I power the TV up it subsequently boots up the Rpi. Of course at that time the Rpi must have already
reached the "dormant" state.

A note on HDMI-to-mini-HDMI cables for Rpi Zero W.
It looks like only cables saying "Ethernet" and/or "ARC" support CEC.
I have tried 3 cables that were not saying "Ethernet/Audio return channel". None of the three had CEC connection.
I have tried 3 cables that were saying "Ethernet/Audio return channel". All of the three had CEC connection.


Hope this information is going to be useful.
Enjoy.
Reply
#11
Impressive work, @pvlmt1796!

I'll have to eventually give this a try.
linorg — Abstraction is my way of life.. 
 
Reply
#12
Well, I repeated the circuit with my modifications - I did not have P-channel mosfet and used pnp transistor.
Actually, after reading the specs for  CEC signals I used 2 pnp transistors. Everything works fine.
The only issue of this approach - TV always switches to this HDMI source when RPi fully loads kodi. But it is small things and not a problem at all.

pre:

-------------------------------------------------------------------------------------------

                                      PNP         ------------------------->  pin 1 +3.3V
                                      2N4402    E|
                                                 |          D
                                            B |<-       |------------------>  pin 5 GPIO03 (Boot)
                              ----------------|         |
                         22k  |               |--       |<--|  N-ch MOSFET
                             ---               C |    G |   |  2N7000
                             | |      -----------+------|   |  
                    PNP      | |     | D         |          | S               Rpi pins
                    2N4402   | |     |          ---         |
                             ---   -----  10uF  | |  2M     |
                         E    |    -----        | |         |
To HDMI CEC          B |<-----       |          | |         |
HDMI pin13      <------|             |          ---         |
Mini HDMI pin 14       |------       |           |          |
                         C    |------+-----------+----------+-------------->  pin 6 GND

                                  Rpi CEC boot circuit
Reply
#13
(2016-02-21, 01:31)DarrenHill Wrote:
(2016-02-21, 01:09)Rickt1962 Wrote: Oh and your Chinese remark ! LOL They also make the pi.

Only very early ones. These days they're made in Newport, Wales.   

It depends where in the world you buy your Raspberry Pi.  Some are made in China still I believe (particularly for non-European markets). The ones made at the Sony factory in Wales are more for the European markets AIUI.  Also older models - which are still available and supported - could well be being made in China, with the Sony factory concentrating on the current 'new' models like the Pi 4B and Zero Ws.  (AIUI some Pis are also made in Japan and Brazil.)
Reply
#14
Thumbs Up 
(2020-02-04, 07:49)ssea Wrote: Well, I repeated the circuit with my modifications - I did not have P-channel mosfet and used pnp transistor.
Actually, after reading the specs for  CEC signals I used 2 pnp transistors. Everything works fine.
The only issue of this approach - TV always switches to this HDMI source when RPi fully loads kodi. But it is small things and not a problem at all.

pre:

-------------------------------------------------------------------------------------------

                                      PNP         ------------------------->  pin 1 +3.3V
                                      2N4402    E|
                                                 |          D
                                            B |<-       |------------------>  pin 5 GPIO03 (Boot)
                              ----------------|         |
                         22k  |               |--       |<--|  N-ch MOSFET
                             ---               C |    G |   |  2N7000
                             | |      -----------+------|   |  
                    PNP      | |     | D         |          | S               Rpi pins
                    2N4402   | |     |          ---         |
                             ---   -----  10uF  | |  2M     |
                         E    |    -----        | |         |
To HDMI CEC          B |<-----       |          | |         |
HDMI pin13      <------|             |          ---         |
Mini HDMI pin 14       |------       |           |          |
                         C    |------+-----------+----------+-------------->  pin 6 GND

                                  Rpi CEC boot circuit

I used your circuit and it rocks!
Reply

Logout Mark Read Team Forum Stats Members Help
Power Up Pi via HDMI/CEC0