GithubHelp home page GithubHelp logo

led-strip-server's Introduction

led-strip-server

This little daemon relays incoming color information via network to up to two connected WS2812b LED strips.

Building

First make sure you have compiled the rpi_ws281x library. Let the compiler find it by running:

export CPATH=$CPATH:/path/to/rpi_ws281x LIBRARY_PATH=$LIBRARY_PATH:/path/to/rpi_ws281x

Then you'll be able to compile this tool:

make

Set BUILD=debug to include debugging symbols.

Usage

You can run the binary without any arguments. It will then default to channel 1 on GPIO pin 18 with 24 LEDs and channel 2 disabled. If you want to change your setup you can pass these values like so:

./led-strip-server PIN:LEDS PIN:LEDS

PIN being the GPIO pin used for the channel (can only be PWM ones) and LEDS being the number of LEDs connected to that channel. The second set is for the second channel.

LED interface

The daemon listens for UDP packets on port 29384 which are structured as follows:

|     1 byte    |   2 bytes  | 1 byte | 1 byte | 1 byte | 1 byte | 1 byte | ...
--------------------------------------------------------------------------------
| channel index | LED offset | LED1 R | LED1 G | LED1 B | LED2 R | LED2 G | ...

You can include color information for a maximum of 483 LEDs in one packet. To reach more LEDs split it up into multiple packets and set the LED offset accordingly.

Control interface

The daemon listens for TCP connections on port 29384. It is a binary interface to control the setup and is structured like so:

|     1 byte    |    2 bytes     |    1 byte     |    2 bytes     | 1 byte |  1 byte  |
---------------------------------------------------------------------------------------
| channel 1 pin | channel 1 LEDs | channel 2 pin | channel 2 LEDs |  FPS   | activity |
  • FPS: LED rendering refresh rate (times per second)
  • activity: toggle activity indicators on the LED strip on/off
    • the first LED on the strip will show rendering activity
    • the second LED will show incoming UDP packets

The interface will respond to valid requests with OK, otherwise NOK.

led-strip-server's People

Contributors

a1bi avatar

Watchers

 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.