Power Up Pi via HDMI/CEC
#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


Messages In This Thread
Power Up Pi via HDMI/CEC - by aussiedean - 2013-09-26, 04:36
RE: Power Up Pi via HDMI/CEC - by Milhouse - 2013-09-26, 04:52
RE: Power Up Pi via HDMI/CEC - by aussiedean - 2013-09-26, 05:36
RE: Power Up Pi via HDMI/CEC - by Milhouse - 2013-09-26, 06:14
RE: Power Up Pi via HDMI/CEC - by Vancoonsie - 2016-02-21, 00:47
RE: Power Up Pi via HDMI/CEC - by aussiedean - 2013-09-26, 10:19
RE: Power Up Pi via HDMI/CEC - by Rickt1962 - 2016-02-21, 01:09
RE: Power Up Pi via HDMI/CEC - by DarrenHill - 2016-02-21, 01:31
RE: Power Up Pi via HDMI/CEC - by Rickt1962 - 2016-02-26, 19:38
RE: Power Up Pi via HDMI/CEC - by noggin - 2020-02-04, 12:19
RE: Power Up Pi via HDMI/CEC - by pvlmt1796 - 2017-09-27, 05:59
RE: Power Up Pi via HDMI/CEC - by linorg - 2018-03-01, 15:15
RE: Power Up Pi via HDMI/CEC - by ssea - 2020-02-04, 07:49
RE: Power Up Pi via HDMI/CEC - by vipermaseg - 2020-06-01, 21:40
Logout Mark Read Team Forum Stats Members Help
Power Up Pi via HDMI/CEC0