RanzQ / serial-fastled

Arduino sketches for Adalight and Glediator protocols.
MIT License
13 stars 9 forks source link

Tutorial to use your project ? #1

Open Nico83500 opened 9 years ago

Nico83500 commented 9 years ago

Hi, Thanks for your project, I have found it on www.tweaking4all.com website ;) I have a Arduino Uno, a WS2812B LED strip and a Windows 8 HTPC. Is it possible to use Hyperion with this hardware and your project ? Or is it only on Linux ? Could you describe a little bit how to use it with Windows and Linux ? Is it necessary to install Boblight ? Thanks !

RanzQ commented 9 years ago

Hyperion was first targeted to Raspberry Pi, but it can be installed on linux. I use it on KodiBuntu on my HTPC.

Hyperion can only capture screen on Raspberry Pi. If using other Linux box like me, I need Kodi (XBMC) plugin to send the screen data for hyperion. So it only shows screen colors when I watch videos on Kodi. See: https://github.com/tvdzwan/hyperion/wiki/XBMC-addon-(not-for-RPi)

I followed these instructions for debian / ubuntu: http://forum.kodi.tv/showthread.php?tid=180472

But I used folder /opt/hyperion instead of /media/scripts/hyperion and skipped the autoexec.py part and created an init script instead. Here's the init script I use (discussed here: https://github.com/tvdzwan/hyperion/issues/77#issuecomment-66411754)

#!/bin/bash

### BEGIN INIT INFO
# Provides:          hyperion
# Required-Start:    networking
# Required-Stop:     networking
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start hyperiond at boot time
# Description:       Enable service provided by hyperiond.
### END INIT INFO

DAEMON=hyperiond
DAEMONOPTS="/opt/hyperion/hyperion.config.json"
DAEMON_PATH="/usr/bin"

NAME=$DAEMON
DESC="Hyperion ambilight server"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
case "$1" in
start)
        if [ $(pgrep -l $NAME |wc -l) = 1 ]
        then
                printf  "%-50s\n" "Already running..."
                exit 1
        else
                printf "%-50s" "Starting $NAME..."
                cd $DAEMON_PATH
                PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!`
                sleep 1 && hyperion-remote --effect "Cold mood blobs" --priority 5000
                #echo "Saving PID" $PID " to " $PIDFILE
                if [ -z $PID ]; then
                    printf "%s\n" "Fail"
                else
                    echo $PID > $PIDFILE
                    printf "%s\n" "Ok"
                fi
        fi
;;
status)
        printf "%-50s" "Checking $NAME..."
        if [ -f $PIDFILE ]; then
            PID=`cat $PIDFILE`
            if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
                printf "%s\n" "Process dead but pidfile exists"
            else
                echo "Running"
            fi
        else
            printf "%s\n" "Service not running"
        fi
;;
stop)
        if [ -f $PIDFILE ]
        then
                printf "%-50s" "Stopping $NAME"
                    PID=`cat $PIDFILE`
                    cd $DAEMON_PATH
                if [ -f $PIDFILE ]; then
                    kill -HUP $PID
                    printf "%s\n" "Ok"
                    rm -f $PIDFILE
                else
                    printf "%s\n" "pidfile not found"
                fi
        else
                printf "%-50s\n" "No PID file $NAME not running?"
        fi
;;

restart)
        $0 stop
        $0 start
;;

*)
        echo "Usage: $0 {status|start|stop|restart}"
        exit 1
esac

exit 0

Write this file as /etc/init.d/hyperion and chmod +x it (make it executable), then run sudo update-rc.d hyperion defaults and your hyperion server starts automatically on reboot.

You can also start / stop it manually with sudo service hyperion status|start|stop|restart

Hyperion "replaces" boblight, so you can't have them both installed.

If you wan't to stay on Windows, you can also try Prismatik and Ambibox, I think they should work with the adalight protocol too.

Those might be easier to setup, but afaik hyperion is the most efficient. :)

Nico83500 commented 9 years ago

Thanks ! Have you informations on how to use on Windows or have you tried only on Linux ?

RanzQ commented 9 years ago

The thing is that you have to compile it yourself. Compiling a linux program on Windows is technically possible but for this project I don't think it will work.

If your HTPC is powerful enough, you could run a virtualbox machine with debian on it and install hyperion on that. But if you are not familiar with linux, I bet it will be too difficult. :)

Try Prismatik or Ambibox first.

MrG1981 commented 9 years ago

thx for this Projekt works perfect with Prismatik on windows 10 now i need to install Hyperion on my HTPC and try it there

RanzQ commented 9 years ago

@MrG1981 By the way, I recommended virtualbox but I've noticed that hyperion freezes on that when I keep the VM on background. So you should install a Debian-based linux on your HTPC. I'm using Elementary OS on my HTPC and it works fine.