iontank / ThrowingBagels

ThrowingBagels is a modernization of the LEDScape software package to drive high quantities of RGB/W LEDs.
Other
15 stars 3 forks source link
art beaglebone beaglebone-black embedded led led-controller lighting

ThrowingBagels

ThrowingBagels is a modernization of the LEDScape software package. ThrowingBagels a LED driver software package for the bagelbone BeagleBone Black, which drives LEDs from UDP packets you yeet at it over the network, or from your own custom software.

You can use ThrowingBagels to drive up to 32 channels of individual LED strips, up to 512 LEDs per channel. Any addressable LEDs that support the WS or SK control protocols should work (WS2812, SK6812, mainly). This should work on any BeagleBone Black, running Debian Buster.

What's it For?

Like we said, you can drive up to 32 channels of individual LED strips, up to 512 LEDs per channel. We've used versions of this software do build things like:

A glowing chandelier shaped like DNA
glowing wooden ribs of light in a hallway
glowing stars in a ceiling
If you want LEDs to blink pretty, this gives you a powerful way to control them. All images above via Iontank's Facebook. See also the Iontank website.

Installing

curl https://raw.githubusercontent.com/iontank/ThrowingBagels/master/install.sh | bash

This script will:

Running as Services

The primary use case is going to be running this as a UDP listener, but there are a few options for running services.

The first is bagel-launcher.service, which simply installs the firmware and configures GPIO at boot. It's potentially useful for testing if you plan to interactively run your own software.

The second is multidemo.service, which runs the multidemo application (see below).

The third is the main application, led-udp.service, which runs the LED UDP RX program, and is the primary tool you'll likely use to control LEDs.

After install, all of these services will be installed, but none of them will be enabled.

Enable the Appropriate Service

For your usecase, you'll need to sudo systemctl enable $SERVICE, where $SERVICE is one of the above. You can then sudo systemctl start $SERVICE.

Included Application

PRU Firmware

The main driver of everything is the PRU Firmware, ledscape.asm. This is what drives the GPIO channels to activate the LEDs.

Demo Applications

For the purposes of testing, iterating, and diagnosing hardware issues, there are several included demo applications.

LED UDP RX

The primary application, and what drives the core use-case of this software stack, is the bin/led-udp-rx tool (src/net/udp-rx.c). This tool listens on a port (default: 9999) for frame data. This allows a powerful "render machine" to run elsewhere on the network, and send frame data to an arbitrary number of ThrowingBagels instances. See LED UDP RX for more details.

Running

Included is a launcher script. This script configures the GPIO, deploys the firmware, and then, optionally, launches a requested binary. E.g., ./launcher bin/led-udp-rx, would launch the LED UDP RX tool on port 9999, using leds.config as the source for our led configuration.

On Configuration

Many of the tools, like led-udp-rx and multidemo, expect an LED configuration to be supplied. By default, they check leds.config, but they both take a command line flag to change that. The file MUST be a single line, in this format:

number of channels,length of strips,number of bytes

e.g.:

32,100,4: this would drive 32 channels of output, for strips 100 pixels long, and expects each LED to need 4 bytes (an RGBW LED). For LED UDP RX, this also sets the expected packet size- each packet should contain 50 pixels for all 32 channels (see the UDP RX Readme for more details).

scripts/provision will also prompt you for this information during the install.

Your own ThrowingBagles software

To build your own application running on the BeagleBone, you must include two files. First, you need to include ledstrips.h into your C code, and you must include a LUT: either gamma8.h (recommended), linear.h, or your own custom LUT.

From there, you need to flatten your frames into a stripwise structure, e.g. you should be able to access individual pixels using fb[(y*w)+x] (that access the pixel at the given x/y coordinate in a 1D version of your framebuffer). See modes.h for examples.

The key methods you'll use are:

See ledstrips.h for more details.

ThrowingBagels Hardware

Running the software is useless if you can't plug LEDs into it. A reference design for a board is included. It is based on designs we've used in our installations, but is strictly a reference design.