GithubHelp home page GithubHelp logo

matthias247 / adalightserver Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 172 KB

A server that provides a web interface and a scripting engine for controlling RGB LED Stripes

License: Apache License 2.0

Groovy 3.33% Java 96.67%

adalightserver's Introduction

adalightserver

This project contains a daemon for controlling RGB LED stripes like the adafruit adalight through a webinterface.

The following diagram shows the required hardware and data flow:

 +------------------+           +----------------+      +---------+     +------------+
 |   Controller     | HTTP +    |                | USB  |         |     |            |
 | (e.g. phone      | Websocket | adalightserver | UART | Arduino | SPI | LED Stripe |
 |  with a browser) | --------> |                | ---> |         | --> |            |
 +------------------+           +----------------+      +---------+     +------------+

This server (developed in Java) sends the RGB data for the individual pixels through a serial connection to an Arduino board, which feeds the colors through SPI to the WS2801 LEDs. The server also supports a mode which uses a TCP/IP connection to support the lighting data instead of a direct serial connection. This allows to run the server on a different hardware than where the Arduino is connected to.

For the Arduino board the usage of the firmware in the following repository is required: https://github.com/adafruit/Adalight/tree/master/Arduino/LEDstream

The actual lighting programs are implemented as Groovy scripts which are deployed in the /scripts/ subdirectory. See the directory for example of scripts.
The daemon will continuously scan the directory for new scripts and reload them in case of changes. All available scripts will be announced towards connected clients.

Scripts can declare parameters. The type of parameters will be announced towards connected clients, which can set the parameters to any value through the API.

The daemon will listen on port 8081 for incoming connections and will server HTTP and websocket connections from there. On HTTP static files in the /static/ subdirectory will be served. This feature can be used to host a client application (in form of an index.html and further assets) on the server. For an example client application please see the https://github.com/Matthias247/adalightclient. This client can be built with Dart and then be deployed in the /static/ subdirectory.

For actual controlling of the scripts and status information update a websocket API is used which listens on the /ws path. The client application will utilize this.

The daemon requires at least 3 commandline parameters:

  1. The number of LEDs that the connected LED stripe provides
  2. The connection type between adalightserver and the LED Controller board. Either a direct serial port connection can be used or a connection which tunnels the serial port data over TCP/IP.
    If a direct serial port connection is used parameter 2 must be set to serial
    If the serial port data should be sent over IP instead parameter 2 must be set to ip
  3. In case of connection type serial this is the name of the serialport to use, e.g. COM3 or /dev/ttyusb.
    In case of an connection over IP this is the hostname to connect to over TCP.
  4. In case of an IP connection this is the port number of the serial2ip converter.

adalightserver's People

Contributors

matthias247 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.