Skip to content

Scripts created to enhance the Hyperion experience on a Raspberry Pi setup. 🌈

License

Notifications You must be signed in to change notification settings

JFtechOfficial/ultimate-ambilight-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

banner Raspberry Pi PRs Welcome license GitHub issues GitHub code size in bytes GitHub top language Requires.io

Scripts that I created to enhance the Hyperion experience. You can also read this in Italiano:it:

πŸš€ Getting started

Table of Contents (click to expand)

Requirements

  • A Raspberry Pi 2, or higher
  • A microSD card with an OS already up and running (OSMC is suggested)

Make sure you have Hyperion installed and configured (installation and configuration via HyperCon is suggested).

πŸ’Ύ Installation

  • Open a terminal window on your Raspberry Pi or connect via SSH (use the Terminal app on MacOS/Linux, or download PuTTY on Windows) and run this command to clone this repository on your device:
cd ~/ && sudo apt-get install git && git clone https://github.com/JFtechOfficial/ultimate-ambilight-setup.git
cd  ~/ultimate-ambilight-setup/
sudo chmod 775 install.sh
sudo ./install.sh
  • You can decide what to install/reinstall using the -a, -b, -c and -f arguments (no custom installation arguments means "install everything").
Options:
    General options:
        -h --help           Show this screen.
        -v --version        Show version.
    Custom installation options:
        -a --assistant      Install Google Assistant script.
        -b --buttons        Install buttons script.
        -c --clock          Install clock effect.
        -f --fan            Install fan script.

βš™οΈ Configuration

You can change any configuration value after the installation process. If you do, please remember to reboot your device afterwards

sudo reboot

Clock Effect

  • Open the clock.json file:
sudo nano ~/ultimate-ambilight-setup/Hyperion_effects/clock.json
  • Get your OpenWeatherMap API key
  • Modify the owmAPIkey value pasting your API key (you can use the same API key in the Kodi Weather app btw)
  • Get your coordinates
  • Modify both latitude and longitude values pasting your own latitude and longitude
  • Modify the offset value to match your LED setup
  • Modify the direction value to match your LED setup ( 0 -> clockwise, 1 -> counterclockwise)
  • You can modify the default colors and widths of the "virutal" clock hands and/or add markers
  • Save Ctrl + X and close Enter the file
  • If you want to modify the clock.json file AFTER the installation you can find it in the Hyperion effects directory:
sudo nano /usr/share/hyperion/effects/clock.json

(example with the default path)

Buttons

  • Open the buttons.json file:
nano ~/ultimate-ambilight-setup/buttons/buttons.json
  • Modify the pins values to match your GPIO setup. AVOID using pin 5 (BOARD) a.k.a. GPIO 3 (BCM) for anything else than the power button: it's been hardcoded for you in this way and it cannot be changed for hardware related reasons. You DO NOT need to configure it in the buttons.json file.
  • Modify the short-press and long-press values for each pin. You can assign an effect name (e.g. "Rainbow swirl") to launch the effect, an RGB value (e.g. [255,0,0]) to launch the resulting color, the string "clear" to go back to the default capture mode, or null to do nothing.

I suggest you not modify:

{
"short-press" : "clear",
"long-press" : [0,0,0]
}
  • You can add as many buttons as you want by pasting (and configuring) the following code after gpio-setup: { :
"Pin number" :
{
    "short-press" : "effect name"/[255,255,255]/null,
    "long-press" : "effect name"/[255,255,255]/null
},
  • Modify the gpio-mode value to match the pin numbering you're using ("BCM"/"BOARD")
  • Save Ctrl + X and close Enter the file

Fan

  • Open the fan.json file:
nano ~/ultimate-ambilight-setup/Raspberry-Pi-PWM-fan/fan.json
  • Modify the pin value to match your GPIO setup
  • Modify the gpio-mode value to match the pin numbering you're using ("BCM"/"BOARD")
  • You can modify the other values to make sure your fan is working as intended
  • Save Ctrl + X and close Enter the file

Google Assistant

  • Open the client.json file:
nano ~/ultimate-ambilight-setup/hyperion-mqtt-subscriber/client.json
  • Modify the ip_address value of the hyperion_server to match the IP address of the device running Hyperion ("127.0.0.1" if it's the same device running this script)
  • If you used a different port you can modify the default port value of the hyperion_server
  • Create an Adafruit-IO account
  • Create an "effect launching" topic, a "color launching" topic and an "effect clearing" topic (Feeds)
  • Modify the username and key values of the mqtt_broker to match your Adafruit-IO username and AIO key
  • Modify the effect-topic value of the mqtt_broker to match the name of your Adafruit-IO "effect launching" topic
  • Modify the color-topic value of the mqtt_broker to match the name of your Adafruit-IO "color launching" topic
  • Modify the misc-topic value of the mqtt_broker to match the name of your Adafruit-IO "miscellaneous" topic
  • Modify the ip_address value of the kodi_server to match the IP address of the device running Kodi ("127.0.0.1" if it's the same device running this script)
  • Modify the video_uri value of the kodi_server to the local path or internet link of the video you want to play (supported: YouTube, Dropbox, Flickr, GoogleDrive, Reddit, Twitch:video, Vimeo, VK and many more)
  • Get your Yandex API key. Skip this step if you use English as main language
  • Modify the API_key value with the Yandex API key. Simply set this value as blank ("") if you use English as main language
  • Modify the from_language value to match your language
  • You can add custom actions by pasting the following code after "custom_actions": [ :
{
"message": "your_message",
"target": "effect name"/[255,255,255]/"clear"/null
},
  • Save Ctrl + X and close Enter the file

▢️ Usage

Use your favorite Hyperion client to select and run the clock effect: the second hand has a warmer color when outside is hot and it has a colder color when outside is cold.

Use buttons connected to the GPIO to launch effects or color, to go back to the capture mode, turn on or safely turn off the Raspberry Pi. You can trigger different functions by pressing and long-pressing the buttons.

Use a fan connected to the GPIO: it will automatically start to spin and cool down the system varing its speed depending on the Rasperry Pi's CPU temperature.

Use IFTTT to interface Google Assistant with the Adafruit-IO mqtt broker. You can send:

Now you can use the Google Assistant on your smartphone/tablet/Google Home to tell Hyperion what to do.

πŸ“š Resources

Here is a step-by-step video guide about how to build the ultimate Ambilight setup (ITA):

YouTube-tutorial

You can also check the wiki

The hyperion.config.json file is an example of a working configuration file for Hyperion (generated via HyperCon)

Please visit the hyperion-project website to learn more about Hyperion

🎁 Contributing

Please see CONTRIBUTING.md.

❀️ Credits

Major dependencies:

πŸ’΅ Support Me!

ko-fi

πŸ’­ FAQ

Can I use the same GPIO pin for the configuration of two different scripts?

No. You should never use the same pin for different tasks at the same time (e.g. controlling the fan and reading the state of a button from the same pin at the same time will not work and could break your Raspberry Pi).

Can I install the Google Assistant client script on a Raspberry Pi different from the one running Hyperion?

Yes. You can run it on any unix machine connected to the same local network: it will send commands to the Raspberry Pi that runs Hyperion. The fan script, buttons script and the clock effect cannot be used in the same way: you must install them on the machine that you intend to use them on.

What about the Raspberry Pi Foundation TV Β΅HAT?

I don't think I'll ever use one, IPTV is good enough imho.

πŸ—“οΈ Release History

  • 06/09/2018 - 0.1.0 - beta release

πŸŽ“ License

MIT

About

Scripts created to enhance the Hyperion experience on a Raspberry Pi setup. 🌈

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published