• 1
  • 5
  • 6
  • 7(current)
  • 8
  • 9
[Tutorial] Hyperion Ambilight on Linux and OpenELEC x64
#91
Hard to say. Maybe the program is not right for arduino.
Try my git https://github.com/iLLiac4/Adalight_Hyperion

Also check if "output" : "/dev/ttyUSB0 is really the one.
Reply
#92
Works fine here with openelec.

My sketch
Code:
#include "FastLED.h"

// How many leds in your strip?
#define NUM_LEDS 95

// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN.  For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 11
#define CLOCK_PIN 13

#define COLOR_ORDER BGR

// Adalight sends a "Magic Word" (defined in /etc/boblight.conf) before sending the pixel data
uint8_t prefix[] = {'A', 'd', 'a'}, hi, lo, chk, i;

// Baudrate, higher rate allows faster refresh rate and more LEDs (defined in /etc/boblight.conf)
#define serialRate 230400

// Define the array of leds
CRGB leds[NUM_LEDS];

void setup() {
      // Uncomment/edit one of the following lines for your leds arrangement.
      // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
      // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
    
      // FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);

       FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
    
        // initial RGB flash
        LEDS.showColor(CRGB(0, 0, 0));
        delay(20);
        LEDS.showColor(CRGB(0, 0, 0));
        delay(20);
        LEDS.showColor(CRGB(0, 0, 0));
        delay(20);
        LEDS.showColor(CRGB(0, 0, 0));
      
        Serial.begin(serialRate);
        Serial.print("Ada\n"); // Send "Magic Word" string to host

}

void loop() {
  // wait for first byte of Magic Word
  for(i = 0; i < sizeof prefix; ++i) {
    waitLoop: while (!Serial.available()) ;;
    // Check next byte in Magic Word
    if(prefix[i] == Serial.read()) continue;
    // otherwise, start over
    i = 0;
    goto waitLoop;
  }

  // Hi, Lo, Checksum

  while (!Serial.available()) ;;
  hi=Serial.read();
  while (!Serial.available()) ;;
  lo=Serial.read();
  while (!Serial.available()) ;;
  chk=Serial.read();

  // if checksum does not match go back to wait
  if (chk != (hi ^ lo ^ 0x55))
  {
    i=0;
    goto waitLoop;
  }

  memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
  // read the transmission data and set LED values
  for (uint8_t i = 0; i < NUM_LEDS; i++) {
    byte r, g, b;    
    while(!Serial.available());
    r = Serial.read();
    while(!Serial.available());
    g = Serial.read();
    while(!Serial.available());
    b = Serial.read();
    leds[i].r = r;
    leds[i].g = g;
    leds[i].b = b;
  }
  // shows new values
FastLED.show();
}

its importen to use the pins DATA_PIN 11, CLOCK_PIN 13

And make sure the baudrate is the same in both files
Reply
#93
(2015-09-14, 06:29)illiac4 Wrote: Hard to say. Maybe the program is not right for arduino.
Try my git https://github.com/iLLiac4/Adalight_Hyperion

Also check if "output" : "/dev/ttyUSB0 is really the one.


Thank you so much, wow that this tooked me so long, and that picture how to connect it on youre page, i couldnt find in trough google damn i have been searching for that pic for hours Tongue
Reply
#94
Id like to share you guys 4 awesome scripts.
Put these files into /opt/hyperion/scripts

First is a button to change static colour called colourswitch.py
Code:
import json
import subprocess

colors = ['purple',
          'orange',
          'blue',
          'green',
          'red',
          'cyan',
          ]

defaultData = {"color":"purple",
               "effect":"night rider"
               }

def read_current():
    try:
        with open('/opt/hyperion/scripts/currentcolour.json', 'r') as f:
            data = json.load(f)
        f.close()
        if data == '':
            return defaultData
        else:
            return data
    except (IOError, ValueError):
        return defaultData
    
def write_current(data):
    try:
        with open('/opt/hyperion/scripts/currentcolour.json', 'w') as f:
            json.dump(data, f)
        f.close()
    except IOError:
        pass
    
def parse_current_effect():
    pass

def set_current_effect():
    pass

def set_color(color):
    subprocess.Popen('/opt/hyperion/bin/hyperion-remote --priority 100 --color ' + color, shell=True)

def main():
    current_data = read_current()
    for i,color in enumerate(colors):
        if color == current_data['color']:
            if i == len(colors) - 1:
                current_data['color'] = colors[0]
                break
            else:
                current_data['color'] = colors[i + 1]
                break
        
    write_current(current_data)
    set_color(current_data['color'])
    
main()

Second is to change the effect with a single button on the remote called effectswitch.py

Code:
import json
import subprocess

colors = ['Snake',
          'Strobe',
          'Rainbow swirl fast',
          'mood-blobs',
          'red',
          'purple',
          ]

defaultData = {"color":"purple",
               "effect":"Blue\\ mood\\ blobs"
               }

effects = ['Blue\\ mood\\ blobs',
          'Cold\\ mood\\ blobs',
          'Full\\ color\\ mood\\ blobs',
          'Green\\ mood\\ blobs',
          'Red\\ mood\\ blobs',
          'Warm\\ mood\\ blobs',
          'Rainbow\\ swirl',
          ]
          
def read_current():
    try:
        with open('/opt/hyperion/scripts/currenteffect.json', 'r') as f:
            data = json.load(f)
        f.close()
        if data == '':
            return defaultData
        else:
            return data
    except (IOError, ValueError):
        return defaultData
    
def write_current(data):
    try:
        with open('/opt/hyperion/scripts/currenteffect.json', 'w') as f:
            json.dump(data, f)
        f.close()
    except IOError:
        pass
    
def parse_current_effect():
    pass

def set_current_effect():
    pass

def set_effect(effect):
    subprocess.Popen('/opt/hyperion/bin/hyperion-remote --priority 100 --effect ' + effect, shell=True)

def main():
    current_data = read_current()
    for i,effect in enumerate(effects):
        if effect == current_data['effect']:
            if i == len(effects) - 1:
                current_data['effect'] = effects[0]
                break
            else:
                current_data['effect'] = effects[i + 1]
                break
        
    write_current(current_data)
    set_effect(current_data['effect'])
    
main()

ledon.py
Code:
import subprocess
subprocess.call('/opt/hyperion/bin/hyperiond /etc/hyperion.config.json </dev/null >/dev/null 2>&1 &', shell=True)

import time
time.sleep(8)
subprocess.call('/opt/hyperion/bin/hyperion-remote --priority 100 --duration 86400 --effect "Blue mood blobs"', shell=True,)

ledoff.py
Code:
import subprocess
subprocess.call('killall hyperiond', shell=True)

Last but least, point remote.xml buttons to this file.
Code:
<red>RunScript("/opt/hyperion/scripts/ledon.py")</red>
<green>RunScript("/opt/hyperion/scripts/ledoff.py")</green>
<yellow>RunScript("/opt/hyperion/scripts/effectswitch.py")</yellow>
<blue>RunScript("/opt/hyperion/scripts/colourswitch.py")</blue>[/quote]
Reply
#95
(2015-09-14, 06:29)illiac4 Wrote: Hard to say. Maybe the program is not right for arduino.
Try my git https://github.com/iLLiac4/Adalight_Hyperion

Also check if "output" : "/dev/ttyUSB0 is really the one.

Btw is there any good reason hyperion is installed in usr? i have it in opt, works well, always did. Why is this guide installing it in usr
Reply
#96
A habit. No good reason.
Reply
#97
(2015-09-14, 18:01)illiac4 Wrote: A habit. No good reason.

Myne is out of sync...

Is there anything we adjust to change this? the current hyperion.config.json was completely in sync on my raspberry pi, maybe it has to do with hyperion xbmc addon or the baudrate. If seen screenshots with 500.000 as baudrate, should do work or will it go faster then? My cfps looks slower then before, also when im using a effect.
Reply
#98
How many leds? Also try this ino for arduino Adalight_WS2801_Arduin_Nano.ino this one does not use fastled.
I am not facing any delays and i am also using addon. Around 110 leds. The only thing that was not smooth was leds and changing this in config file helped:

"smoothing" :
{
"type" : "linear",
"time_ms" : 100,
"updateFrequency" : 25.0000
}
},
Reply
#99
(2015-09-14, 20:18)illiac4 Wrote: How many leds? Also try this ino for arduino Adalight_WS2801_Arduin_Nano.ino this one does not use fastled.
I am not facing any delays and i am also using addon. Around 100 leds. The only thing that was not smooth was leds and changing this in config file helped:

"smoothing" :
{
"type" : "linear",
"time_ms" : 100,
"updateFrequency" : 25.0000
}
},

First i changed update_delay from 6 to 0. Had to use this in rpi to get it in sync.

Code:
            "type"            : "linear",
            "time_ms"         : 5,
            "updateFrequency" : 25.0000,
            "updateDelay"     : 0


after playing with the settings i found out that in framgrabber my frequency was 42 its now on 10 and pretty much in sync maybe milliseconds missed. If got 127 leds

EDIT:
Code:
    "framegrabber" :
    {
        "width" : 64,
        "height" : 64,
        "frequency_Hz" : 10
    },
Reply
hmmm..


was running this now for a long time on kodibuntu but i can´t get it work on openelec

Code:
/storage/hyperion/bin/hyperiond.sh /storage/hyperion/config/hyperion.config.json
/storage/hyperion/bin/hyperiond.sh: line 2: /storage/hyperion/bin/hyperiond: Permission denied

Anyone?

got it now Wink


after "chmod +x hyperiond" it suddenly works Big Grin
Reply
I finally bought everything I need to build me my Ambient Lighting system with Hyperion. My setup is going to be based on a Raspberry Pi 2 with a frame grabber so I can use the Ambient light setup with any input source on my receiver. I'm pretty excited to get this up and running, however I have a question. Is there a way that I can trigger Hyperion on/off or set it to different modes like dynamic backlighting or static backlighting with eventghost through some HTTP/TCP like interface?

FYI, the remote I use is connected via USB to my HTPC which is a separate windows based machine. I use Eventghost to interpret the remote commands.
Image
Reply
Hi!

I´ve installed hyperion on my x64 openelec machine. I can controll the lights with the Android App but
i got no output in the Kodi menu. When i try to play a file i get this error message "unable to send image to hyperion"

Can anybody help me?
Reply
If you want light in the menu you need to use the x11 file

In the read me it says what you need to write in the autostart.sh

Can't find it on the phone right now
Reply
Thats not my problem, my problem is that i got the error message "unable to send image to hyperion" when i play a file.

I can remote control the lights but nothing more.
Reply
I guess you miss the add-on https://github.com/tvdzwan/hyperion/wiki...t-for-RPi)
Reply
  • 1
  • 5
  • 6
  • 7(current)
  • 8
  • 9

Logout Mark Read Team Forum Stats Members Help
[Tutorial] Hyperion Ambilight on Linux and OpenELEC x641