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

[DIY] Amblight project/guide - Hyperion - WS2801/ WS2812B / APA102

Discussion in 'Official DIY Tutorials' started by Rick164, 29 March 2016.

Thread Status:
Not open for further replies.
  1. Rick164

    Rick164 Administrator Staff Member Administrator

    Messages:
    190
    Hardware:
    RPi2, +Arduino, +AtmoOrb
    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)

    rpi-123123.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 WS2812 support you do need extra hardware and there is more info in the chapter Additional configuration.

    5257268d757b7f38388b4567-png.167860.png

    - 5V 5A power supply or higher

    dc-pwr-5v-7a-eu-1-420x280-jpg.167861.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:



    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 WS2812 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://drive.google.com/open?id=0Bx76pIrpnjUUbmlrR09XUFNBMjA

    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:



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

    Step 3

    Option 1 - Hostname setup (easier)

    On some addons like AtmoLight there's 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

    If you use Mediaportal to play your media content, it's recommended to use the AtmoLight Plugin and for setting this up there's a guide located here: Connect Mediaportal with Hyperion

    Additional configuration

    Only needed if you aren't using WS2801/ APA102 leds

    By default only WS2801 / APA102 (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..):



    - 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:



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

    Attached Files:

    Last edited: 7 January 2017
  2. Rick164

    Rick164 Administrator Staff Member Administrator

    Messages:
    190
    Hardware:
    RPi2, +Arduino, +AtmoOrb
    Pictures / Videos

    10x15mm - 1mtr - plastic cable tray
    1.jpg
    2.jpg
    3.jpg


    double sided velcro clips to prevent wobble
    5.jpg
    4.jpg
    6.jpg
    8.jpg
    9.jpg



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







     
    Last edited: 29 March 2016
Thread Status:
Not open for further replies.