Powering Hyperion and LEDs Only When TV is On

  • 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 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.


    • 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:
    DZS Elec 5V 1 Channel Relay Op… 0-30V 10A SCM IO Control

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


    Script:

    setPowerPinHigh.py

    Python
    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.

  • 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.

  • Hey The! Nice setup, thanks for sharing :) Almost exactly what I was hoping to achieve as well. I was wondering if you or someone else with experience could guide me a bit. Ordered this little guy:
    https://core-electronics.com.a…nel-relay-module-10a.html


    My idea was to also use a USB port from the TV, but I want the relay to control the LEDs directly (Pi is always on with separate power supply).


    The LEDs have their own 5v 10a power. Can I put the relay after the power supply, before the LEDs? How would I have to wire everything up (USB cable from TV to relay, power supply to relay, relay to LEDs)?


    Thanks kindly everyone in advance!


    Robin

  • Robin, Yeah, the relay will work between the power supply and the LEDs. I'm assuming you want the USB on the TV to "signal" the LEDs to turn on...and when you turn off the TV, you want the LEDs to go off.


    I'm not an electronics guru. I'm making an educated guess. I would dare try this on my own TV after tooling with a volt meter. If you burn your TV up or your house, well, sorry.


    See schematic below and also this.


    The relay takes a 5v input signal, and needs a 5v supply and a ground. I'm assuming your TV energizes the USB cable with +5v when its on. Basically, I think that can be used as the signal to tell the relay to activate. I think the blue and black both would need to be tied to the ground on the relay. The yellow can be fed from the power supply since it's always on (otherwise I think you could feed that from the usb +5v too). The green is used as a circuit breaker to power or de-power the LEDs.





    If this worked, I still wouldn't do it this way since I'm comfortable tooling with mains voltage and this method would keep the power supply energized sucking power even when everything is off. I suppose if the RaspberryPi is a media server (powered by the power supply) that would be okay though.

  • Hey The! Thanks so much for such a detailed response with schematics and instructions! Ok, that makes a lot of sense. I got tinkering today and hooked it all up. I can somewhat get the relay to respond to the USB being plugged in to the TV. The relay switches when I press the power button on the TV remote, then after 1 second switches off again, then switches on for 3 seconds, then stays off completely. I am not sure what the problem is at this point, my assumption is that the TV USB port doesn't supply constant 5v under these circumstances, or recognises the relay as an unknown device and then "switches off" the USB port.


    I had a 5v 2 metre LED strip powered directly from the TV before I changed my setup to ambilight and it worked beautifully. I de-soldered the strip from the USB connector and am using that cable (it conveniently only has a black and red wire). I have also salvaged an old USB phone charger cable with 4 wires, identified the power and ground, hooked that up and got the same frustrating result.


    I have ordered another relay https://www.amazon.com.au/gp/p…tle_o00_s00?ie=UTF8&psc=1 and will try again next week once it arrives.


    Your info and schematics definitely got me on track and your help is very much appreciated :)


    Robin

  • You could be right with the way the TV is reacting. Good thought. However, if you saying you powered the 2 meter LED cable off the TV's USB port, prior to this I'd think that the USB isn't shutting down, but more the like the relay isn't seeing or doing what it needs to do. A few thoughts:


    • I'd attach a volt meter to the USB cable and watch the voltage on the + while the TV is starting/running, and its reaction when turning the TV off.


    • Your new relay has a little jumper on it that toggles the way the relay reacts to the signal wire. Unsure if trying the other position if the default doesn't work (after reading/understanding its details)


    • Maybe it thinks there is a short (as a worst case). I wonder if there is some setting buried within the TV menus (probably not) that may solve it.


    • Try powering the relay from the red wire (as well as feeding it to the signal) instead powering the relay with the 5v yellow one, though I'm most apprehensive about that idea. Maybe the TV is seeing there is no significant voltage being consumed by the port, so it shuts it off. By feeding the relay with it, it may think it's okay.


    • If you have some detectable voltage from #1, or see a "pattern" that happens when the TV turns on and off, perhaps you can feed that signal to the Raspberry Pi as an input, program some python/code to watch for the pattern, and use another gpio output pin on the Raspberry Pi to control the relay input signal. However, DO NOT FEED the TV's USB 5v into a gpio pin on the Raspberry Pi, as the pins are not 5v tolerant. See https://raspberrypi.stackexcha…-the-spi-pins-5v-tolerant it has a solution for stepping down the 5v to the 3.3v level using a voltage divider (never used one). Of course, that's not worth it unless your can see/parse/understand the signal from the USB.
  • Hey The! Thanks once again for the input and the detailed instructions. We have liftoff!!! I frankensteined two wires to the black one coming off the USB cable to plug into signal and ground, and the red wire goes to the 5v pin (from memory, will have to confirm again when I'm next to it). Relay switches on, then off for a second, but then stays on permanently until I switch off the TV. Everything working as intended, very very happy with the result.


    Will post a wiring diagram later this week, just wanted to express my gratitude and share the positive result :)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!