Raspberry Pi media center with DIY ambient light
Let There Be Light
Ambilight lights up the wall behind Philips TVs with LEDs mounted on the device to enhance the onscreen visual impression. With Lightpack and a Rasp Pi media center, every TV can be upgraded with ambient light.
The Ambilight technology, originally developed by Philips, lights up the wall behind the television set by monitoring the colors in the current image and generating the appropriate color to extend the image content beyond the monitor surface. The "extended" image is easier on the eyes, because the field of vision is enlarged for the viewer.
An Ambilight system basically comprises three components: at least three edges (left, right, and top) on the back of the TV for strips of RGB LEDs, a control unit that ensures the individual LEDs light up accordingly, and a signal to the control unit provided by software that continuously analyzes the video image.
If you don't want to buy a Philips Ambilight TV, but you already watch movies and TV series on the Kodi multimedia platform, you can upgrade to ambient lighting in a DIY project with either a Raspberry Pi with Raspbian, a Kodi distribution like Open/LibreELEC, or a Linux PC. Various preexisting solutions such as Lightpack [1], Lightberry [2], or AmbiLED [3] remove the need for further programming
For the test, I chose the Lightpack PC [4] package by Woodenshark, which made the best overall impression. It originated from a Kickstarter campaign and costs $89, for which you receive 10 pre-assembled LED strips, an unobtrusive control unit, an AC power supply with adaptors, cables, and mounting accessories. All components can be attached with double-sided adhesive tape without causing damage to the TV.
On the software side, Boblight [5] and Hyperion [6] are two popular solutions. Thanks to Hyperion's less complicated configuration, you can achieve the desired results faster. Therefore, the ambient light system setup in this example comprises Lightpack PC, Hyperion, and a Raspberry Pi.
Setup
When attaching the LED strips to the back of the screen, be careful not to block the connections and any attachment points that can be used on the TV. In the Lightpack packaging, you will find adhesive pads and cable ties that facilitate cable management (Figure 1).
Lightpack's manufacturer recommends that the strips should be applied in the "Andromeda" pattern, which promises the most uniform illumination possible (Figure 2). Gradually mount the LEDs in a clockwise direction, starting at the bottom left-hand side of the TV housing; then, connect the strips to the control unit in the same order.
To make the assembly of individual modules as easy as possible, lay the screen display-side down on a soft surface so that the relevant points remain easily accessible without the fear of scratching the screen. After connecting the power supply unit and USB cable, you need to teach the Raspbian system how to install the ambient lighting system.
Hyperion
To set up Hyperion, download an installation script offered on the project page, make it executable, and then call it with root privileges:
$ cd /tmp $ wget https://raw.github.com/hyperion-project/hyperion/master/bin/install_hyperion.sh $ chmod +x install_hyperion.sh $ sudo ./install_hyperion.sh
The program then prompts you to reboot the system.
Hyperion imports the installation routine together with a unit for systemd, but the service cannot start successfully yet. Because the system does not automatically detect how many LED strips it is supposed to control and where they are located, you have to carry out the rest of the configuration manually.
For the LED setup, download the program HyperCon [7] (suitable for all current operating systems) onto your computer. Hyperion and HyperCon do not necessarily have to run on the same system: The configuration file written by HyperCon can be copied to the media center computer at a later stage.
The Java application does not require an installation procedure, but it does require the Java Runtime Environment version 1.7 or later, which comes with the Raspbian "Stretch" distro with the Pixel desktop. Listing 1 shows how to view the Java version and then launch the application. You need to be in the same directory as the JAR file for this step.
Listing 1
Launching HyperCon
In the HyperCon application window, first change Type to Lightpack. The Serial # input field (Figure 3) then appears below it. This serial number does not correspond to the sequence of digits printed on the back of the control; instead, you need to look it up in the Raspberry Pi's kernel log (Listing 2). However, this only works if you have previously connected the Lightpack control unit to the Rasp Pi via USB.
Listing 2
Finding the Lightpack Serial Number
After entering the serial number, reduce the number of LED strips to 10. To do this, first enter 4 in the LEDs horizontal field under Construction; then, enter 2 for LEDs left, LEDs right, and Bottom gap; accept the remaining values and click Save.
Now create the configuration file by clicking Create Hyperion Configuration and save it as hyperion.config.json
in the home directory. Next, copy it with root privileges to /etc/hyperion/
and restart the Hyperion service:
$ sudo cp ~/hyperion.config.json /etc/hyperion $ sudo systemctl restart hyperion
All LEDs should now light up and flash in several colors. The flashing colors show you that Hyperion is communicating successfully with Lightpack. To ensure that the service will load automatically at system startup, enable it in systemd:
$ sudo systemctl enable hyperion
If the service cannot be started immediately, you might have an incorrect setting in the configuration file. In hyperion.config.json
, check that HyperCon also searches for the effects in /usr/share/hyperion/effects/
and not only under /storage/hyperion/effects
(Listing 3).
Listing 3
Hyperion Effects Paths
Video Grabbing
If the colors of the LEDs do not yet match the screen content, the software has to evaluate the video signal. Add-ons for a Rasp Pi media center with a Kodi installation like Boblight [8] or AmbiBox [9] analyze the video signal supplied by Kodi and transmit the control signals to the Hyperion service.
Instead of picking up the video signals in the application software, Hyperion can also evaluate the X server image directly. Ambilight thus supports all screen content. Hyperion comes with the hyperion-x11 module, which you launch with the X server by creating the hyperion-x11.desktop
file in the ~/.config/autostart/
folder and adding the contents of Listing 4.
Listing 4
Desktop File
After restarting the system, the LEDs respond to changes in the screen content. To try this out, simply move a window that is not too large and with the brightest possible background (e.g., a file manager) back and forth on your desktop.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.