[DIY] Amblight project/guide - Hyperion - WS2801/ WS2812B / APA102 (1 Viewer)

Rick164

MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,005
    Home Country
    Netherlands Netherlands
    Introduction

    Over time there have been many Windows alternatives to Atmowin and under Linux there is Bobilight however there is now another good all in one alternative that is networked like boblight but also works with Windows/Linux and is called Hyperion.
    Windows and Linux support is supplied by their respected plugins (AtmoLight in our case) however the Raspberry Pi can't run the Kodi plugin for it (yet)

    Hyperion also allows for video capture methods so that you can use it for every HDMI input source be it a console or set top box.

    AtmoLight now supports Hyperion as well so no video capture hardware is required for that setup as it sends your video image directly to Hyperion over network.

    It does require some Linux / Raspberry Pi knowledge like connecting via SSH (Putty) but other than that it's easy to understand.

    Features
    - Ambilight for every HDMI source!
    - Cross platform
    - Android app to control LEDS
    - Fast and accurate color measurements
    - Tons of configuration options
    - Supports Arduino (Adalight) to allow for broad use of led chips

    Requirements

    For basic setup

    - Raspberry Pi B+ (other models will probably work just as fine)

    1914-01.jpg


    - Leds - WS2801 is the most common however recommend the WS2812B ones as they offer more leds per meter and is a bit better.
    For WS2811/12 support you do need extra hardware and there is more info in the chapter “Additional configuration”.

    5257268d757b7f38388b4567.png


    - 5V 5A power supply or higher

    DC-PWR-5V-7A-EU-1-420x280.JPG


    5V 7A was used to make the videos and drives 218 leds just fine.

    - Optionally:

    Rails to attach to TV, used one sided curved plastic rails to allow for adjusting the direction.
    One sided sticky Velcro to attach leds and rails, get the good ones and apply alcohol on contact points to allows for best adhesion


    For video capture setup

    Recommend following this guide which describes all the components and how to use them:

    https://forum.team-mediaportal.com/...source-techtalk-–-christian-moser-pdf.157962/

    However recommend to use a different USB Video Grabber as this is known to work better:

    EasyCap Video USB Grabber Fushicai UT007

    That one for now is only supported on all recent versions of OpenElec, been using it for some time now and works without issues.

    Some shops might not list it correctly so be careful, got mine here:

    http://www.insaneware.de/epages/61714203.sf/de_DE/?ObjectPath=/Shops/61714203/Products/usbgrab


    * IMPORTANT *

    When video capture is turned on you are limited to 50/60hz due to technical restrictions, a solution for this is to add a remote controlled power brick (KaKu for the dutch users) and put the HDMI->Composite converter in that.
    Make sure you get an powered HDMI->Composite converter and not the passive one that is powered by the HDMI signal !

    So if you want to use video capture just toggle it on via remote and leave it off when needing 24p playback.

    Connection scheme

    The linked tutorials will have connection schemes as well however this will give you a general overview on how everything is connected for each solution.

    Non-video capture solution WS2801 with Raspberry Pi only

    LED data pins -> Raspberry Pi connectors
    LED power pins -> 5v adapter-> only GND connected to Raspberry Pi as well (see tutorial)
    Raspberry Pi -> network / power connection

    Non-video capture solution WS2801 / WS2812 with Raspberry Pi and Arduino

    LED data pins -> Arduino
    LED power pins -> 5v adapter -> only GND connected to Arduino as well (see tutorial)
    Arduino -> USB cable -> Raspberry Pi
    Raspberry Pi -> network / power connection


    Video capture solution WS2801 / WS2812 with Raspberry Pi and Arduino

    LED data pins -> Arduino
    LED power pins -> 5v adapter -> only GND connected to Arduino as well (see tutorial)
    Arduino -> USB cable -> Raspberry Pi
    Raspberry Pi -> USB connection to video capture stick
    Raspberry Pi -> network / power connection


    With all solutions there's no physical connection to your PC required as the Hyperion is either getting commands via your local network (TCP commands) and/or via video capture thru HDMI.

    Initial setup

    OpenElec 4.2 is the preferred Raspberry Pi distro for this guide.
    OpenElec 5.0 release works as well but doesn't have any additional benefit for the Hyperion setup.


    Step 1

    If you instead want to use other leds like WS2811/12 check the “Additional configuration” chapter and skip to Step 2 after completing the steps from that chapter.

    First you need to make sure your LEDS are connected,could write an entirely new guide but there’s already a good one here:

    https://forum.team-mediaportal.com/...d-xbmc-techtalk-–-christian-moser-pdf.157961/

    Skip the Software installation step 1-3 there as that is for Rasbmc and follow this short guide instead:

    http://raspberry-at-home.com/hyperion-on-openelec-it-works

    or from the official guide:

    https://github.com/tvdzwan/hyperion/wiki/Installation-on-RPi-with-OpenELEC

    Create a Hyperion configuration if you haven't already by following these instructions:

    https://github.com/tvdzwan/hyperion/wiki/configuration

    Step 2

    If you don’t need the video capture solution skip to Step 3, otherwise best to follow this guide:

    https://forum.team-mediaportal.com/...source-techtalk-–-christian-moser-pdf.157962/

    Remember to get the EasyCap Video USB Grabber Fushicai UT007 and not the one mentioned there.

    Step 3

    Option 1 - Hostname setup (easier)

    In AtmoLight 1.15 we added the ability to use the hostname or mDNS hostname of your Raspberry Pi device, the mDNS hostname means that locally your machine can always be reached without having to setup any static IP address or any router config.
    On Windows it requires you to have Apple Bonjour installed:

    http://support.apple.com/kb/DL999

    Make sure to disable any Apple software update junk during install as you don't need that if you're only using Bonjour, prevents you from getting update notifications which can be annoying on HTPC machines.

    Your mDNS hostname is always formatted with your device hostname like this:

    <hostname>.local

    For instance your mDNS hostname by default on OpenElec is called "Openelec.local" as its hostname is OpenElec, once the IP for the hostname changes AtmoLight will automatically resolve the new one.
    See the below setup screenshot for an example AtmoLight config.

    Option 2 - Static IP setup

    Make sure you give your raspberry Pi a static IP address, the easiest way is to do it in the OpenElec XBMC interface (you can remove XBMC later on):

    http://wiki.openelec.tv/index.php/OpenELEC_Configuration_Addon#tab=Network

    Step 4

    Now that you’ve finished installing Hyperion and tested it to make sure it works you can install the latest version of AtmoLight plugin for Mediaportal:

    Install AtmoLight via Mediaportal Extension Manager (1.14.0.0 and up supports Hyperion)

    Afterwards start the Mediaportal Configuration application and setup Atmolight, select AtmoLight and press Config

    YqdXjV5.png


    Check Hyperion and open the Hyperion Tab

    jJiRCp7.png


    Change the IP address or hostname to match the one of your Raspberry Pi

    VBHtPir.png


    Press save and when you start some media in Mediaportal your lights should turn on.

    Additional configuration

    Only needed if you aren't using WS2801 leds

    By default only WS2801 (and few other older ones) are supported when you want to directly connect your leds to the Raspberry Pi.
    However there’s a solution for that by using an Arduino as a go between, only connection needed between Raspberry Pi and Arduino is a USB cable.

    You will need an Arduino Uno R3 or better (anything capable of > 115200 baud rate) and connect your leds to it, personally prefer the WS2812B leds but you can use all leds supported by the FastLed library:

    • Adafruit's Neopixel - aka the WS2812B (also WS2811/WS2812, also supported in lo-speed mode) - a 3 wire addressable led chipset
    • TM1809/4 - 3 wire chipset, cheaply available on aliexpress.com
    • TM1803 - 3 wire chipset, sold by radio shack
    • UCS1903 - another 3 wire led chipset, cheap
    • GW6205 - another 3 wire led chipset
    • LPD8806 - SPI based chpiset, very high speed
    • WS2801 - SPI based chipset, cheap and widely available
    • SM16716 - SPI based chipset
    • APA102 - SPI based chipset
    • P9813 - aka Cool Neon's Total Control Lighting
    • DMX - send rgb data out over DMX using arduino DMX libraries
    • SmartMatrix panels - needs the SmartMatrix library - https://github.com/pixelmatix/SmartMatrix

    Complete overview: https://github.com/FastLED/FastLED#supported-led-chipsets

    There are a lot of guides out there but you can use this one to get started:

    http://www.tweaking4all.com/hardware/arduino/arduino-ws2812-led/

    Skip all the Arduino sketches there as we will need our own to make it work with Hyperion.

    After you have connected your LEDS using that guide, you will need to follow these steps:

    - Install Arduino IDE:

    http://arduino.cc/en/main/software

    - Download FastLed library:

    https://github.com/FastLED/FastLED/archive/master.zip

    Extract FastSPI to your Arduino Library folder:

    My Documents/Arduino/Libraries

    - Import this sketch into Arduino IDE and change the settings to match your setup (led type / channels / color order etc..):

    http://pastebin.com/zhQCRFhd

    - In some cases it might be needed to increase the serial buffer size in the Arduino program files , if you experience any issues later on like flickering or non-responsive leds follow these steps:

    http://www.hobbytronics.co.uk/arduino-serial-buffer-size


    - Upload to your Arduino device and check to make sure they show color during first startup.
    - Now for the tricky part, we need to do a few steps to make sure the baud rate is high enough to accommodate the data being send from the Raspberry Pi to your Arduino
    - First we need to increase the default baud rate on your Raspberry:

    - Connect your Raspberry Pi to a display and enable SSH:

    http://www.htpcbeginner.com/ssh-into-raspberry-pi-for-remote-administration/

    - Don't be scared of XBMC/Kodi, we don't need it once finished ;)
    - SSH to your Raspberry Pi machine using the default login information:

    Code:
    Login: root
    Password: openelec

    - Mount the boot partition read/write:

    Code:
    mount -o remount,rw /flash

    - Open boot config:

    Code:
    nano -w /flash/config.txt

    Add the following line at the end and be careful not to adjust anything else:

    Code:
    #Increase UART speed
    init_uart_clock=14745600

    Press F2 to save and reboot your Raspberry.

    - Now install Hyperion using this guide:

    http://raspberry-at-home.com/hyperion-on-openelec-it-works

    or from the official guide:

    https://github.com/tvdzwan/hyperion/wiki/Installation-on-RPi-with-OpenELEC

    - Create an basis Hyperion config by following step 4 in the Software installation chapter here:

    https://forum.team-mediaportal.com/...d-xbmc-techtalk-–-christian-moser-pdf.157961/

    or from the official guide:

    https://github.com/tvdzwan/hyperion/wiki/configuration

    - Now that we have setup your Raspberry correctly we need to do the same in your Hyperion configuration file, you can open this file with your favorite editor:

    \\openelec\Configfiles\hyperion.config.json
    Or:
    \\<Raspberry IP address>\Configfiles\hyperion.config.json

    OpenElecFolder.png


    Change the following lines in hyperion.config.json so that it looks like this:

    Code:
    "name"  : "MyPi",
    "type"  : "adalight",
    "output"  : "/dev/ttyACM0",
    "rate"  : 460800,
    "colorOrder" : "grb"


    - Your colorOrder might differ so best to change that if needed (grb was default for WS2812B).
    - / dev/ttyACM0 was the default for mine but if it isn’t working double check by connecting via SSH and running the command:

    Code:
    lsusb

    this will list all usb connected devices, your Arduino should be listed there.
    If so run the following command:

    Code:
    ls /dev

    this will list all devices on your Raspberry, it will list /dev/tty devices and one of those should be your Arduino.

    - Optionally you can disable XBMC completely, for KODI (Openelec 5.0 and up) this is slightly differently so added both examples below.

    Connect via SSH to your Raspberry Pi and execute the following command:

    Code:
    nano -w /storage/.config/autostart.sh

    XBMC - OpenElec 4.0

    Add the follow line to the end:

    Code:
    systemctl stop xbmc

    KODI - OpenElec 5.0 and up

    Add the follow line to the end:

    Code:
    systemctl stop kodi

    press F2 and select press Y to save afterwards, now if you reboot OpenElec it should automatically stop the XBMC / Kodi service.

    - Now connect your Arduino to your Raspberry and restart Hyperion if needed
    - You can now use your LEDS with Hyperion!

    For troubleshooting there are some pointers at the bottom of this post, buffer size issue seems common but fixable.

    Credits

    Hyperion: https://github.com/tvdzwan/hyperion
    LED / DIY guide: http://www.tweaking4all.com
    Hyperion / live capture guide: http://techtalk.christian-moser.ch
    Arduino buffer size fix : http://www.hobbytronics.co.uk
    OpenElec instructions: http://raspberry-at-home.com


    Extras

    Shopping list (Dutch users) for the non-video capture solution in combination with WS2812B

    LEDS - 60 per meter - Including resistor and power connector
    http://www.kiwi-electroni...0RGB%20Ledstrip%20WS2812B

    Arduino
    http://www.kiwi-electroni...arch=Arduino%20Uno%20Rev3

    Raspberry Pi
    http://www.kiwi-electroni...us-512mb?search=raspberry

    Power supply
    http://www.kiwi-electroni...240-AC-EU-kabel?search=5v

    Cables to connect corners
    http://www.kiwi-electroni...abel?search=JST-SM-3PF-BK
    http://www.kiwi-electroni...abel?search=JST-SM-3PM-BK

    Extra Cables
    - Arduino cables for connection from led strips to Arduino
    - USB cable Arduino to Raspberry Pi
    - Cable tray 10x15mm - 1 meter (Gamma) for installing leds onto

    Tips & Troubleshooting

    - When soldering WS2811/12 leds be careful as to not damage the closest leds, using a low powered soldering iron is recommended.

    - When using WS2811/12 leds make sure to add an resistor between the led data line and rPI data connector, optionally you can add an 1000uF capacitor between the 5V led line and the 5V power supply.

    - When debugging Hyperion you can also use the Android app to control the lights, this allows for easy calibration and color testing.

    - When testing configuration changes in AtmoLight you can temporarily enable the "Live reconnect" option in its AtmoLight configuration.
    You can then restart Hyperion and see the changes apply directly to adjust where needed.

    - It's recommended to have both your Mediaportal machine and the Raspberry Pi on a cabled network, WiFi might work as well but considering it can be unpredictable when it comes to throughput and lag you might not get the best results.

    - If your HDMI to component converter still remains powered even when the remote controlled power brick is turned off you most likely suffer from some interference nearby (or ghosts..), in this case use an dedicated plug box for all your video capture devices (including rPI) as that solved it in my case.

    - Depending on the led count you might experience power loss issues somewhere along the strip (i.e. some leds near the end not going full white), an easy fix for this is to wire the power at both the beginning and end of the led strip so that it can "reach" every led.
    Also could be related to underpowered power supply but when using >200 WS2812B @ 5V 7A led this fixed it


    - In some cases it might be needed to increase the serial buffer size in the Arduino program files , if you experience any issues like flickering or non-responsive leds with WS2811 / WS2812 follow these steps:

    http://www.hobbytronics.co.uk/arduino-serial-buffer-size


    * Tested with Arduino 1.0.6 *

    - Problems with flickering?
    Try lower the smoothing frequency and lower the framegrabber frequency in your Hyperion configuration.


    // In case any of the linked guides are down there are PDF files attached to this post.
    // Also included a few sample Hyperion configs for inspiration, the WS2812B configuration was used in the videos.
     

    Attachments

    • How to build your own Ambilight TV with Raspberry Pi and XBMC | techtalk – Christian Moser.pdf
      60.3 MB
    • How to build an Ambilight for every HDMI input source | techtalk – Christian Moser.pdf
      7.4 MB
    • Tweaking4All.com - Arduino - Controlling a WS2812 LED strand with NeoPixel or FastLED.pdf
      4 MB
    • adalight_ws2812b.txt
      3.4 KB
    • EXAMPLE_hyperion.config_WS2801.txt
      20 KB
    • EXAMPLE_hyperion.config_WS2812B.txt
      36.8 KB
    • EXAMPLE_hyperion.config_WS2812B_SMOOTH.txt
      38.1 KB
    • EXAMPLE_hyperion.config_WS2812B_SMOOTH_NO_VIDEOCAPTURE.txt
      37.7 KB
    • hyperion-on-openelec.pdf
      1.1 MB
    Last edited:

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,005
    Home Country
    Netherlands Netherlands
    Pictures / Videos

    vUZKdhZ.jpg

    10x15mm - 1mtr - plastic cable tray

    9v3TNbU.jpg


    xiinO4m.jpg


    vgYt9BP.jpg


    gXujIzw.jpg

    double sided velcro clips to prevent wobble

    jhBs6v1.jpg


    QOLsJPH.jpg



    IieEvRZ.jpg


    SZ5trJL.jpg




    Hyperion + Arduino - WS2812B + Parrot in the background :p




     
    Last edited:

    TheBatfink

    MP Donator
  • Premium Supporter
  • June 11, 2007
    1,288
    221
    Nottingham
    Home Country
    United Kingdom United Kingdom
    Nice guide. Do you have a link for the plastic rails? I'm struggling to think what they are. I'm only 1.5" from the wall so suspect will need some angling. Thanks!
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,005
    Home Country
    Netherlands Netherlands
    Had a spare piece (with type/size) of it so added it to the pictures in the 2nd post as well :) , bought it from a local hardware store (Gamma) so don't have an online link for it sadly but the product information is:

    10x15mm - 1mtr - plastic cable tray

    You could also use alumunium rails however that does put a bit more stress on the velcro so doubt that will hold, best to get hollow plastic rails (the lighter the better).

    Also using small velcro "clips" cut into size and attached every ~30cm to make sure the flexible strip doesn't wobble.
     
    Last edited:

    ixdvc

    Portal Pro
    May 26, 2009
    227
    39
    Home Country
    Germany Germany
    Nice guide. Looks interesting.
    On my old TV I had a SEDU v2 with WS2801 (AtmoWin). For the new one I was planning to get a SEDU v3 and WS2801 or WS2812B with 30 LEDs per meter as 244 (60 per meter) would be too much for AtmoWin. I have seen you switched from SEDU to this setup here using the rPI and WS2812. What are the advantages besides that it supports more LEDs? Or is the CPU usage only dependant on AtmoLight and not AtmoWin and thus would be the same with the Pi and Hyperion?
    And you mentioned that one has to turn the HDMI converter off when playing 24p videos. Is this also the case if AtmoWin sends the data to Hyperion? So if using the HTPC with MePo the converter has to be off and if using one of the other devices connected to the AVR it has to be turned on?
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,005
    Home Country
    Netherlands Netherlands
    Was using SEDU as well before, for solo solutions (MediaPortal) this is still the easiest to setup and costs a bit less as well however you can't use the newer leds.
    Hyperion is in active development as well which is nice as they learned a lot from Boblight and are bringing a real efficient/fast amiblight system over network.

    I have seen you switched from SEDU to this setup here using the rPI and WS2812. What are the advantages besides that it supports more LEDs? Or is the CPU usage only dependant on AtmoLight and not AtmoWin and thus would be the same with the Pi and Hyperion?

    CPU wise it's no problem, with WS2801 leds connected (90 total) to the rPI the rPI used about 30% and Windows wasn't affected as all is handled by Hyperion externally :)
    For the WS2812B leds the Arduino was added which is much more efficient at this so the rPI uses about 15% with that setup, don't see any problem with going above 300 leds with that setup as well.

    With AtmoWin the calculation is done locally but with Hyperion AtmoLight sends an image over network and it gets handled by it, this way on the low/mid HTPC setups it will work a bit better as well as the cpu has to do very little extra work.

    The extra leds don't add that much to be honest, you just get less "blobbing" as there are more leds for moving objects (easier to distinguish).
    However the color range is a bit better on the WS2812B ones as far as I know so that would be a another benefit.
    Think once you get above a certain amount of leds it doesn't really matter anymore, had 90 before (30/15 sides) and that was already pretty nice.

    For video capture it became a little complicated as you can't use 24p mode while the HDMI -> composite converter is powered on (technical restrictions), so what I did was add a remote controlled brick and toggle that via remote when needed.
    If it's on and you run Mediaportal the HDMI signals will still be restricted to 50/60hz as your AVR is still limited by the powered on HDMI -> Composite converter.
    Basically you only want to turn on the video capture if you are using anything else than Mediaportal, will add this part to the guide as well as that seemed to have gotten lost during copy/paste.

    /edit: added extra information under "video capture setup" (* important * headline).
     
    Last edited:

    ixdvc

    Portal Pro
    May 26, 2009
    227
    39
    Home Country
    Germany Germany
    Thanks for your answer.
    I think I will go for rPI and Arduino then even though my i3-4330 should be powerful enough. The cost with 55€ for the SEDU v3 should be roughly the same as for rPI (35€) + Arduino (15€). And with the latter I have the possibility to use other devices as well (with extra cost).
    Is the communication to Hyperion over the network fast enough or do you see a delay? Are there other differences between AtmoWin and Hyperion, e.g. that one is smoother or something like that?
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,005
    Home Country
    Netherlands Netherlands
    Noticing no difference over network compared to AtmoWin, Hyperion uses a very efficient way of communicating (Google ProtoBuf) and good C++ code.
    Had the same concerns as you would expect at least some delay so made the Polka video for testing and when using slow-mo you can see it's instant on the color changes and that is with linear smoothing enabled :)
    Also compared rPI -> WS2801 and rPI -> Arduino -> WS2812B and there is no difference, no added lag when adding this extra layer.
     

    ixdvc

    Portal Pro
    May 26, 2009
    227
    39
    Home Country
    Germany Germany
    it's instant on the color changes and that is with linear smoothing enabled :)
    Also compared rPI -> WS2801 and rPI -> Arduino -> WS2812B and there is no difference, no added lag when adding this extra layer.
    Ok, then everything will be fine, I think.
     

    Users who are viewing this thread

    Top Bottom