1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Powering Hyperion and LEDs Only When TV is On

Discussion in 'Hyperion Hardware' started by The, 29 July 2019.

  1. The

    The New Member

    Messages:
    5
    Hardware:
    RPi2
    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:
    1. Ambilight when TV is on.
    2. 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.
    3. Didn't want a separate remote to enable/disable the system.
    4. Didn't want to toggle power manually in any fashion.
    5. Hassle free. High WAF (wife acceptance factor)
    Approach:
    1. Power the Raspberry Pi 2 (with Hyperion NG installed) from the TV's USB port.
    2. Typical setup of converters, etc. No HDMI splitter as my AVR has a "monitor" port.
    3. 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.
    4. Power the 5 meters of LEDs from a switched power supply.
    5. Use a Relay board 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.
    6. Relay is controlled by pin on RPI. Relay is powered by the 5V from the RPI.
    7. 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.
    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:
    DZS Elec 5V 1 Channel Relay Optocoupler Isolation Module Red Board 3-5V High and 0-1.5V Low Level Triggered Load AC 0-250V / DC 0-30V 10A SCM IO Control

    Relay Enclosure:
    https://www.thingiverse.com/thing:3777041

    Script:

    setPowerPinHigh.py
    Code:
    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
    Code:
    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.
     
    Last edited: 3 August 2019
    • Like Like x 2
  2. Arakon

    Arakon Member

    Messages:
    151
    Hardware:
    RPi1/Zero, RPi3, +Arduino
    My solution for this was simply using a master-slave power strip. It turns off all other power sources when my AV receiver turns off (so TV, raspberry, LED PSU, lights for the cupboards and subwoofer all go off together).
     
  3. The

    The New Member

    Messages:
    5
    Hardware:
    RPi2
    Nice! Didn't know such a thing existed. That definitely would have been easier, and probably worked for me for the most part. Hopefully your post will help the next user.

    My subwoofer is across the room so that part wouldn't work for me. Also, occasionally I use my AV/R to drive only audio, so that may have caused a conundrum on which device should be the master. Unsure what device Arakon has, but here is a link to a Belkin Conserve Smart AV strip review. I wonder if the strip would fall victim to device auto-firmware update routines, fooling the strip into thinking the master was "on", if only for a few minutes. I'd hope there would be some tolerant minimal power draw to avoid this.

    Regardless, the "relay solution" was a nice foray into a bit of scripting, wiring, and tinkering.