davglass / lightshowpi

Dav's LightShowPi Setup

Home Page:http://lightshowpi.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dav's LightShowPi Setup

Board v2

Parts List

Wiring

wiring

  • Cut the end off the power cable that goes into the computer
  • Strip it and attach a white and black to an outlet.
    • This outlet will be on all the time
    • Use this one to plug the Pi into
    • Put this into one of the boxes and use a single outlet
  • Attach a white wire and run from the main outlet to another in the next box
  • Then jump from top to bottom on all outlets across all three boxes
  • Take a pair of needle nose pliers and snap the clip between the screws on the other side of the other 4 outlets
    • This will make the four outlets turn into 8 circuits
  • Create a looped circuit on the terminal block like the photos
  • Run a single red from each of the load sides of the outlets to the relay
    • Here is where I injected the fuse block to protect the relays
  • Run a black from the relay to the terminal block

Pins

Map the pins from the Pi to the Relays, guide here.

Usage

Now, install Raspian on your pi, install LightShowPi

Automatic Install/Updates

Last year I added a setup.sh script to automate the installation of the software and keep it up to date.

After you install the OS from above, simply clone this repo into /home/pi/davglass/ and run ./setup.sh. It will install a bunch of stuff and you will have a working lightshow as well as my custom additions.

Config

  • Set volume higher on boot
    • sudo crontab -e
    • @reboot /usr/bin/amixer set PCM 95%

~/lights.cfg

This is my default config, it fires up shairport-sync and enables it as an AirPlay speaker. Then you can join it from any iOS device and stream music (Spotify in our case) directly into the lights display.

I also install the shairport-sync-metadata-reader module to grab the music meta data while streaming..

[lightshow]
# We are using shairport-sync to setup an AirPlay Speaker
# that we will broadcast our music across, these are
# the settings needed..
mode = stream-in
stream_command_string = shairport-sync -v -o stdout
use_fifo = False
input_channels = 2
input_sample_rate = 44100

My Additions

Copy ./bin and ./api into /home/pi/

mkdir /home/pi/tmp

Add /home/pi/bin/boot.sh to your /etc/rc.local

This will fire up the web based API server at: http://raspberrypi.local:8888/

Endpoints:

  • /show/start
  • /show/stop
  • /show/enable
  • /show/disable
  • /lights/on
  • /lights/off
  • /controller/cylon
  • /controller/dance
  • /controller/flash
  • /controller/random_pattern

You can (sort of) protect it with a JSON file: /home/pi/.api.json

{
    "username": "foo",
    "password": "bar"
}

I added an IFTTT trigger to Alexa that points to my API so that I can turn them on and off with my Echo's.

Twitter

Create an App, then get your tokens..

Create a file: /home/pi/.twitter.json:

{
    "api": {
        "key": "",
        "secret": ""
    },
    "access": {
        "token": "",
        "secret": ""
    }
}

Additional Wiring Diagram from here

Content Licensed BSD, use it as you will!

About

Dav's LightShowPi Setup

http://lightshowpi.org/

License:Other


Languages

Language:Python 47.7%Language:Shell 24.8%Language:JavaScript 13.6%Language:HTML 9.3%Language:CSS 4.6%