While I didn't do a lot of searching on here for similar cases, here's what I did to ensure that Hyperion and the LED array is powered only when the TV is on:
Issues Solved:
- Ambilight when TV is on.
- No additional power draw, of any sort, when TV is off. Save $13 USD per year by ensuring my switched power supply is unable to draw power when system is off.
- Didn't want a separate remote to enable/disable the system.
- Didn't want to toggle power manually in any fashion.
- Hassle free. High WAF (wife acceptance factor)
Approach:
- Power the Raspberry Pi 2 (with Hyperion NG installed) from the TV's USB port.
- Typical setup of converters, etc. No HDMI splitter as my AVR has a "monitor" port.
- RPI is only on when the TV is on. It's unceremoniously powered down when the TV is turned off. Folks suggest that may be bad, but we'll see and fix when/if that happens.
- Power the 5 meters of LEDs from a switched power supply.
- Use a
to "switch" the 120V load line into the power supply. Relay is normally "open" (off). The RPI pin that tells the board to stay "on" is held voltage high, so when the RPI shuts off, the circuit breaks. - Relay is controlled by pin on RPI. Relay is powered by the 5V from the RPI.
- On RPI boot, run a python script (below) to set the relay-board input pin to high, which toggles the relay, which enables power to flow to the power supply, when in turn drives the LEDs.
Vizio USB Power Note
[Edit Nov 30 2019] - Just upgraded my TV to a 4K Vizio. I had to search through the menu choices and toggle an option that always sent power to the USB port even when the TV is off. Basically, for my setup, I want no power to the USB port when the TV is off.
Oddities
A few minutes after turning the TV off (and supposedly the power if off), the RPI boots back up, LEDs turn back on, then about minute later they shut off again. My bet it's the TV turning on for a firmware check (and/or likely sending usage data to Vizio). Never figured it would power the USB ports, but evidently it does.
Code/Stuff
Relay:
Relay Enclosure: https://www.thingiverse.com/thing:3777041
Script:
setPowerPinHigh.py
import RPi.GPIO as GPIO # import RPi.GPIO module
from time import sleep # lets us have a delay
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM) # choose BCM or BOARD
GPIO.setup(4, GPIO.OUT) # set GPIO4 as an output
GPIO.output(4, 1) # set GPIO4 to 1/GPIO.HIGH/True
Inserted into: /etc/xdg/lxsession/LXDE-pi/autostart
python /home/pi/setPowerPinHigh.py
#Not necessary. Fires up VNC and a compiled version of hyperion
x11vnc -display :0 -usepw -noxdamage -ncache 10 -ncache_cr -forever
/home/pi/hyperion/build/bin/hyperiond
Warning
Proceed at your own risk controlling 120V power. If your house burns down because of this advice, call the fire department.