Ambient light on Raspberry Pi running Openelec with APA102 Led strip

Raspberry Pi running Ambient light

Build

On this article I will assume that openelec is already installed on Pi. Openelec image can be found from Raspberry Pi downloads or directly from get-openelec.

apa102-rpi_bb
On my build I am taking power to APA102 led strip directly from RPi. That is now the way it should be done but it seems to work.

My configuration based on configuration used with WS2801 LED strip.
hardware_ws2801_connection
On Raspberry Pi 2 MOSI and SCLK pins are at the same position.

Hyperion

Hyperion is used to control led strip

Install Hyperion, see instructions on https://github.com/tvdzwan/hyperion/wiki/Installation-on-RPi-with-OpenELEC

On SSH command line get installation file

curl -L --output install_hyperion.sh --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/bin/install_hyperion.sh

And run it

sh ./install_hyperion.sh

Hyperion configuration

Create configuration file by using HyperCon. See instructions on Git page https://github.com/tvdzwan/hyperion/wiki/configuration

To be able to use apa102 led strip following configuration changes need to be made on HyperCon

TAB_Hardware

Type:

Adalight

Output:

/dev/spidev0.0

Baudrate:

900000

RGB Byte order:

BGR

 

Rest of the configuration on this page depend how many leds are used and how those are constructed. See more instructions from HyperCon Git

TAB_External

On Effect engine set

Directory:

/storage/hyperion/effects

 

On created hyperion.config.json file change Type from Adalight to apa102

APA102

And copy created configuration file hyperion.config.json in Openelec directory /storage/.config

Since we are using apa102 Leds we need to enable SPI on raspberry Pi. By default SPI is not available.

On SSH command line

mount -o remount,rw /flash
nano /flash/config.txt

At the end of file add

dtparam=spi=on

Press Ctrl-x , Y , Enter to save changes

Set directory readonly

mount -o remount,ro /flash

And reboot Pi

reboot

When Openelec start led strip should show rainbow colors and Ambient light should be running.

Sources: