Coder Social home page Coder Social logo

edm64 / speakersel-lite Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iceboundflame/pandorica-spksel

1.0 0.0 0.0 9.1 MB

Web interface for the multi-room audio controller (speaker select only)

License: Other

Python 1.01% Shell 0.01% JavaScript 52.70% CSS 46.03% HTML 0.25%

speakersel-lite's Introduction

pandorica-spksel

Web interface for the multi-room audio controller. Based on the project created by David Liu.

Project details: http://iceboundflame.com/projects/multi-room-audio-control-with-rpi

This fork is for a simpler project using the smaller, cheaper, and more recent model Raspberry Pi Zero W. It uses the same dual-coil latched relays for speaker switching, but drops the additional HiFi controls (because in my use case, the Yamaha MusicCast app takes care of those feature). It also integrates the protection switch for toggling impedance matching.

This is a Python 2.7/Flask application using jQuery Mobile.

control.py uses the RPi.GPIO Python module to pulse the GPIOs. Each execution will change the relay state to match. For instance:

sudo ./control.py            # Turn off all relays
sudo ./control.py 0 2 3      # Turn on relays 0, 2, and 3
sudo ./control.py 0 1 2 3    # Turn on all relays

spksel.py is the actual Flask web server. It serves the web interface, calling "sudo ./control.py" in order to turn rooms on and off.

This is designed to be run in a virtualenv, so unpack virtualenv and run ./setup to install the necessary packages.

Configuration notes

Raspberry Pi pins used

2   5V
6   GND
7   GPIO4
11  GPIO17
12  GPIO18
13  GPIO27
15  GPIO22
16  GPIO23
18  GPIO24
22  GPIO25
24  GPIO08
26  GPIO07
25  GND

To test the relay board, use control.py to make sure that all relays can click on and off. Adjust the PIN_MAP in control.py as necessary.

spksel

Install nginx via apt and configure it to serve a uWSGI site on /. Create spksel user, set up sudoers to allow "sudo control.py" without password.

Extract virtualenv, run ./setup in this repository to create "myenv" virtual environment and download Flask/Jinja2/other packages. Following deployment instructions at http://flaviusim.com/blog/Deploying-Flask-with-nginx-uWSGI-and-Supervisor/ :

. myenv/bin/activate
# After activating virtualenv:
pip install uwsgi   # takes a while to build on RPi, ~15 min

# Test:
uwsgi -s /tmp/spksel.sock -w spksel:app -H /home/spksel/spksel/myenv --chmod-socket=666  --processes 4 --threads 2 --stats 127.0.0.1:9191

Set up supervisord to run uwsgi on bootup.

speakersel-lite's People

Contributors

iceboundflame avatar edm64 avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.