GithubHelp home page GithubHelp logo

jackw01 / led-control Goto Github PK

View Code? Open in Web Editor NEW
158.0 9.0 35.0 13.33 MB

Advanced WS2812/SK6812 RGB/RGBW LED controller with on-the-fly Python animation programming, web code editor/control interface, 1D, 2D, and 3D display support, and E1.31 sACN support

Home Page: https://jackw01.github.io/led-control/

License: MIT License

Python 49.54% HTML 1.28% JavaScript 16.61% CSS 0.95% C 23.49% SCSS 6.96% Shell 0.04% Dockerfile 0.29% CMake 0.84%
raspberry-pi led ws2812b rgb sacn e131 led-controller led-strips led-matrix led-cube

led-control's Introduction

LED Control

screenshot.png

Features

  • Lightweight responsive web interface works on both desktop and mobile devices
  • In-browser code editor and color palette editor make creating and modifying animations easy
  • Large selection of built-in animations and color palettes means you don't have to write any code
  • Works with cheap and readily available WS281x and SK6812 LED strips and strings
  • Runs on a Raspberry Pi single-board computer directly connected to LEDs, and on any other computer with the help of a low-cost microcontroller board (Raspberry Pi Pico) connected via USB
  • Supports pixel mapping for arbitrary 2D and 3D LED arrangements
  • Seamlessly supports HSV-to-RGBW and RGB-to-RGBW conversion for RGBW LED strips
  • Supports networked E1.31 sACN DMX control for music visualization through LedFx

Technical Details

  • Animation patterns are defined as Python functions that work similarly to fragment shaders
  • Capable of achieving up to 150 FPS on 150 RGBW LEDs on a Raspberry Pi Zero
  • Web backend and animation code are written in Python using the Flask web framework for ease of development and served using bjoern
  • Web frontend UI is implenented using Vue 3
  • Color conversions, color correction, and final rendering operations are implemented in a C extension module for maximum performance

Framerate Note

The theoretical maximum framerate for 150 RGBW LEDs is 800000 Hz / (8*4) bits / 150 = 166.67 FPS. All built-in animations run at over 50FPS with 150 LEDs on a Raspberry Pi Zero, the least powerful Raspberry Pi model. The framerate is limited to 60FPS by default to reduce CPU usage.

Install

Hardware Setup (All Platforms)

Obtain a WS2812B or SK6812B LED strip (SK6812 RGB/White LEDs are highly recommended) and a suitable 5V power supply. USB power may be suitable, and an external power supply may not be needed, when using small numbers of LEDs (less than 100 RGBW or 50 RGB LEDs).

Hardware Setup (External LED Driver)

  1. Obtain a Raspberry Pi Pico (US$4) or any microcontroller board based on the RP2040 chip.
  2. Connect the LED strip to your microcontroller:
    • MCU GND to LED GND
    • MCU GPIO12 to LED Data in
    • Power supply ground to LED GND
    • Power supply 5V to LED 5V (Important: use the VBUS pin, not VSYS, to power LEDs from USB on Raspberry Pi Pico and Pico W boards)

Any GPIO pin can be used instead of GPIO12 if the definition in firmware/config.h is changed appropriately.

Hardware Setup (Raspberry Pi)

  1. Obtain a Raspberry Pi single-board computer (any model). Due to the unavailability of Raspberry Pis, using any other computer with an external LED driver is recommended (see above).
  2. Connect the LED strip to your Raspberry Pi:
    • Pi GND to LED GND
    • Pi GPIO18 to LED Data in
    • Power supply ground to LED GND
    • Power supply 5V to LED 5V

For more information on which Raspberry Pi GPIO pins LED strips can be connected to, see here.

RGBW LEDs Are Highly Recommended

Know what you're doing with electricity. Addressable LEDs can draw a lot of current, especially in long strips. You should use RGBW LEDs for the reason that they look better and require much less power when displaying whiter colors (a good quality 5V 4A power supply can comfortably handle 150 RGBW LEDs at full brightness).

For large installations, each group of up to ~200 LEDs should be connected to the power supply with its own adequately sized wires. Don't expect to get good or safe results by daisy chaining strips together. Furthermore, when using a high current (20+A) power supply, a short circuit somewhere along the LED strip will likely not draw enough current to trip your power supply's over-current protection due to the resistance of the flexible PCB. This is a serious fire hazard, so each individually powered group of LEDs should be protected with its own fuse or circuit breaker rated to ideally no more than 10A. See this guide for good information on powering hundreds or thousands of LEDs.

Addressable LED strips usually come with seriously undersized power wires and barrel jacks or JST SM connectors rated for only 3A, and it would be a good idea to replace these appropriately.

For more information on using a level shifter, which may be necessary with some WS2812 RGB LED strips, see this Adafruit guide.

If You Really Want To Use RGB LEDs

You should budget at least 50mA for each LED at full brightness, which means 7.5A for 150 LEDs (5 meters of 30 LED/m strip, 2.5m of 60LED/m strip...). In practice, your LED strips won't draw this much current, but your power supply should be capable of handling it.

The flexible PCBs and connectors used in these LED strips are not really designed to handle these currents, and begin to heat up when passing as little as 2-3A. Again, each group of up to ~150 LEDs should be powered through its own adequately sized wires.

Software Setup (With Pi Pico LED Driver)

Python 3.7 or newer is required.

  1. Ensure that git, python, pip, and the Raspberry Pi Pico SDK are installed.
  2. git clone https://github.com/jackw01/led-control.git
  3. cd led-control
  4. git checkout tags/v2.1.1
  5. python setup.py develop
  6. Modify firmware/config.h with the correct parameters for your hardware setup.
  7. Following instructions in the Raspberry Pi Pico SDK documentation, build the firmware (located in the firmware folder).
  8. Flash the firmware onto your microcontroller board: hold down the BOOTSEL button when connecting it to your computer with a USB cable and it should enumerate as a USB storage device. Drag and drop or copy and paste the .uf2 binary file in build/firmware into the microcontroller.
  9. Determine the serial port ID of your microcontroller. On Windows, this can be done through Device Manager.
  10. ledcontrol --led_count NUMBER_OF_LEDS_HERE --serial_port SERIAL_PORT_HERE (add --led_pixel_order GRBW if using RGBW LEDs)

Software Setup (Raspberry Pi)

Python 3.7 or newer is required.

  1. sudo apt-get install scons swig libev-dev python3-dev python3-setuptools git python3-pip
  2. git clone --recurse-submodules https://github.com/jackw01/led-control.git
  3. cd led-control
  4. git checkout tags/v2.1.1
  5. sudo python3 setup.py develop
  6. sudo ledcontrol --led_count NUMBER_OF_LEDS_HERE (add --led_pixel_order GRBW if using RGBW LEDs)

Common Issues

LEDControl and the Raspberry Pi audio subsystem cannot be use together since they both use the PWM hardware. On some Linux distributions, you must disable the audio kernel module by commenting out the line dtparam=audio=on in /boot/config.txt or by creating a file /etc/modprobe.d/snd-blacklist.conf with the contents blacklist snd_bcm2835.

Command Line Configuration Arguments

Web server and LED hardware parameters must be specified as command line arguments when running ledcontrol. Note that none of the LED hardware-related arguments will have an effect when using a Pi Pico to drive the LEDs.

usage: ledcontrol [-h] [--port PORT] [--host HOST] [--led_count LED_COUNT]
                  [--config_file CONFIG_FILE]
                  [--pixel_mapping_json PIXEL_MAPPING_JSON] [--fps FPS]
                  [--led_pin LED_PIN] [--led_data_rate LED_DATA_RATE]
                  [--led_dma_channel LED_DMA_CHANNEL]
                  [--led_pixel_order LED_PIXEL_ORDER]
                  [--led_brightness_limit LED_BRIGHTNESS_LIMIT]
                  [--save_interval SAVE_INTERVAL] [--sacn] [--hap] [--no_timer_reset]
                  [--dev] [--serial_port SERIAL_PORT]

optional arguments:
  -h, --help            show this help message and exit
  --port PORT           Port to use for web interface. Default: 80
  --host HOST           Hostname to use for web interface. Default: 0.0.0.0
  --led_count LED_COUNT
                        Number of LEDs
  --config_file CONFIG_FILE
                        Location of config file. Default: /etc/ledcontrol.json
  --pixel_mapping_json PIXEL_MAPPING_JSON
                        JSON file containing pixel mapping (see README)
  --fps FPS             Refresh rate limit for LEDs, in FPS. Default: 60
  --led_pin LED_PIN     Pin for LEDs (see
                        https://github.com/jgarff/rpi_ws281x). Default: 18
  --led_data_rate LED_DATA_RATE
                        Data rate for LEDs. Default: 800000 Hz
  --led_dma_channel LED_DMA_CHANNEL
                        DMA channel for LEDs. DO NOT USE CHANNEL 5 ON Pi 3 B.
                        Default: 10
  --led_pixel_order LED_PIXEL_ORDER
                        LED color channel order. Any combination of RGB with
                        or without a W at the end. Default: GRB, try GRBW for
                        SK6812
  --led_brightness_limit LED_BRIGHTNESS_LIMIT
                        LED maximum brightness limit for the web UI. Float
                        from 0.0-1.0. Default: 1.0
  --save_interval SAVE_INTERVAL
                        Interval for automatically saving settings in seconds.
                        Default: 60
  --sacn                Enable sACN / E1.31 support. Default: False
  --hap                 Enable HomeKit Accessory Protocol support. Default: False
  --no_timer_reset      Do not reset the animation timer when patterns are
                        changed. Default: False
  --dev                 Development flag. Default: False
  --serial_port SERIAL_PORT
                        Serial port for external LED driver.

Color Correction

By default, the color correction values on the web interface are set to (255, 190, 170) which is a good starting point for SK6812 RGBW LEDs, but not all LEDs are the same. You should adjust these values as well as the global color temperature while using the "Test Color Correction" feature, which displays the white point of the RGB subpixels in your LEDs, even if you are using RGBW LEDs.

Built-In Color Palettes

palettes.png

Built-In Animation Patterns

Animated GIF previews of all built-in animations can be seen at animations.md.

E1.31 sACN, Music Visualization, and LedFx Use

LEDControl can function as a E1.31 streaming ACN receiver, allowing the connected LEDs to be directly controlled over the network. LedFx is recommended for music visualization over sACN.

  1. Follow the instructions to install LedFx and set up your computer's audio output.
  2. Add your LEDControl device in LedFx: Select e131 as the device type, use the hostname or IP of your Raspberry Pi, and enter the number of LEDs you have attached.
  3. Run LEDControl with the --sacn command line flag. An option to enable sACN receiver mode will appear on the web interface.
  4. Enable sACN receiver mode in the LEDControl web interface.
  5. Configure a music visualizer effect in LedFx.

While sACN receiver mode is enabled, the LED refresh rate is determined by your sACN server. There may be noticeable latency when using sACN on congested networks or if other software on the Raspberry Pi is using its network hardware; this is a known limitation of sACN.

HomeKit Accessory Protocol Support (Experimental)

The brightness and on/off state of LEDControl can be controlled through Apple HomeKit. Run LEDControl with the --hap command line flag and a setup code will be printed for manually pairing in the Apple Home app.

Pixel Mapping

LEDControl supports pixel mapping, which allows 2- and 3-dimensional animation patterns to be mapped to any physical arrangement of LEDs. Currently, pixel mappings can only be specified with a JSON file containing an array of points representing the positions of each LED, using the --pixel_mapping_json command line argument. --led_count does not need to be specified when pixel mapping is used. The points must be in the same order that the correresponding LEDs are connected, and the units used to define the pixel mapping do not matter (negative and floating-point values are allowed).

Example

pixelmapping.png

[
  [-3, 3, 0],
  [0, 3, 0],
  [3, 3, 0],
  [3, 0, 0],
  [3, -3, 0],
  [0, -3, 0],
  [-3, -3, 0],
  [-3, 0, 0]
]

Animation Editing

Animation patterns are defined as Python functions that work similarly to GLSL fragment shaders or DirectX pixel shaders. The LEDControl web interface allows editing and creation of patterns using a subset of Python.

Patterns are compiled using RestrictedPython and run with a restricted set of builtin functions and global variables. This should prevent filesystem access and code execution, but the scripting system should not be considered completely secure and the web interface should not be exposed to untrusted users.

Pattern Function Guide

Each animation frame, the pattern function is called once per LED/pixel with time, position, and previous state as inputs to determine the next color of that pixel.

# cycle_hue_1d
def pattern(t, dt, x, y, z, prev_state):
    return (t + x, 1, 1), hsv

Arguments

t

Time in cycles (an arbitary unit that represents one animation cycle as a floating point number). Calculated by multiplying real time in seconds by animation speed in Hz (cycles/second). Time is reset to 0 every week (168 hours) of uptime to prevent any math/overflow issues that may occur. By default, time is also reset when the animation pattern is changed or recompiled, but this behavior can be changed with the --no_timer_reset command-line flag.

dt

Delta time in cycles.

x, y, z

Normalized (0 to 1) value representing the position of the current LED in arbitrary units (after mapping LED indices to positions and scaling). By default, LEDs are mapped to the x axis only. One position unit represents the scale factor multiplied by the length of the axis. At a scale of less than 1, one position unit represents a fraction of the axis length and the animation is tiled to fill all the LEDs.

prev_state

Previous color state of the current LED as an HSV or RGB tuple. Initialized to (0, 0, 0) when the program starts.

Return Values

Pattern functions must return a color in tuple form and either hsv or rgb depending on the format of the color. All values are expected to be in the 0 to 1 range, except for hue. Hue values less than 0 or greater than 1 will wrap. RGB values will be clamped to the 0 to 1 range.

Supported Python Globals

  • Builtins: None, False, True, abs, bool, callable, chr, complex, divmod, float, hash, hex, id, int, isinstance, issubclass, len, oct, ord, pow, range, repr, round, slice, str, tuple, zip
  • All functions and constants from the math module
  • All functions from the random module

Color Palette Access

Color palettes are interpolated in the HSV color space. 1000 interpolated values are stored in a lookup table to allow for fast access to any color in the palette.

palette(t)

Returns the color from the current palette corresponding to a value t between 0 and 1. Values of t less than 0 or greater than 1 will wrap.

palette_mirrored(t)

Returns a color from a mirrored version of the current palette that wraps seamlessly. Functionally equivalent to palette(wave_triangle(t)), but performs just as well as palette(t).

Wave Functions

All waveforms have a period of 1 time unit, a range from 0 to 1, and a peak (f(t)=1) at t=0. When running on Raspberry Pi, optimized C implementations of these functions are used which gives a suprisingly significant performance improvement over Python.

wave_sine(t)

Returns the instantaneous value of a 1Hz sine wave at time t.

wave_cubic(t)

Returns the instantaneous value of a 1Hz sine wave approximated with cubic easing at time t. Appears to spend more time near 0 and 1 than a true sine wave.

wave_triangle(t)

Returns the instantaneous value of a 1Hz triangle wave at time t.

wave_pulse(t, duty_cycle)

Returns the instantaneous value of a 1Hz pulse wave of the specified duty cycle (range 0 to 1) at time t.

plasma_sines_octave(x, y, t, octaves, lacunarity, persistence)

Custom optimized "plasma" implementation that returns a sum of several octaves of sinusoid-based waveforms creating a non-random noise effect. Essentially fractal noise, but using sinusoid functions as a basis instead of pseudorandom noise. This creates more detailed and better looking plasma effects than simpler implementations. For each successive octave, the frequency (how fast the wave changes with space and time) is multiplied by lacunarity, and the amplitude is multiplied by persistence. octaves must be an integer. See the usage notes below.

plasma_sines(x, y, t, coeff_x, coeff_y, coeff_x_y, coeff_mag_xy)

Basic optimized function for creating RGB plasma animations (see https://www.bidouille.org/prog/plasma). Returns sin((x + t) * coeff_x) + sin((y + t) * coeff_y) + sin((x + y + t) * coeff_x_y) + sin((sqrt(x * x + y * y) + t) * coeff_mag_xy). Not recommended unless you want it, plasma_sines_octave generally looks better.

perlin_noise_3d(x, y, z)

Standard 3D perlin noise. Use time as one of the arguments to make the noise vary with time. Returns a value from 0 to 1.

fbm_noise_3d(x, y, z, octaves, lacunarity, persistence)

Standard 3D fBm (fractal Brownian motion) noise.

Additional Utility Functions

clamp(x, min, max)

Returns min if x < min and max if x > max, otherwise returns x.

fract(x)

Returns the floating point component of x (x - floor(x)).

impulse_exp(t)

Asymmetrical exponential "impulse" wave function f(t) = t * e^(1-t). Peaks at t=1.

blackbody_to_rgb(kelvin)

Returns a normalized RGB tuple for a color temperature in Kelvin.

blackbody_correction_rgb(rgb, kelvin)

Tints an RGB color (normalized RGB tuple) to a color temperature in Kelvin. Returns a normalized RGB tuple.

Using Plasma Utility Functions

plasma_sines and plasma_sines_octave both return the instantaneous value of a 2D periodic function at time t and position (x, y). The typical way of converting this value to a color is to assign the RGB values to expressions of the form a * wave_sine(b * x + c) + d, where wave_sine is a function that returns a sinusoid waveform with range 0 to 1. This is done in the code for several built in patterns.

Below is GLSL code for testing and experimenting with these plasma functions in 2D. This code can be easily run on Shadertoy.

plasma_sines
float wave_sine(float t) {
  return cos(6.283 * t) / 2.0 + 0.5;
}

float plasma_sines(float x, float y, float t,
                   float coeff_x, float coeff_y,
                   float coeff_x_y, float coeff_dist_xy) {
  float v = 0.0;
  v += sin((x + t) * coeff_x);
  v += sin((y + t) * coeff_y);
  v += sin((x + y + t) * coeff_x_y);
  v += sin((sqrt(x * x + y * y) + t) * coeff_dist_xy);
  return v;
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  // Normalized pixel coordinates (from 0 to 1)
  vec2 uv = fragCoord / iResolution.xy;

  float v = plasma_sines(uv.x, uv.y, iTime, 1.0, 0.5, 0.5, 1.0);

  float r = 0.8 - wave_sine(v);
  float g = wave_sine(v + 0.333) - 0.2;
  float b = 0.8 - wave_sine(v + 0.666);

  fragColor = vec4(r, g, b, 1.0);
}
plasma_sines_octave
float wave_sine(float t) {
  return cos(6.283 * t) / 2.0 + 0.5;
}

float plasma_sines_octave(float x, float y, float t,
                          int octaves,
                          float temporal_freq_persistence,
                          float amplitude_persistence) {
  float vx = x;
  float vy = y;
  float spatial_freq = 1.0;
  float temporal_freq = 1.0;
  float amplitude = 1.0;
  for (int i = 0; i < octaves; i++) {
    float vx1 = vx;
    vx += cos(vy * spatial_freq + t * temporal_freq) * amplitude;
    vy += sin(vx1 * spatial_freq + t * temporal_freq) * amplitude;
    spatial_freq *= 2.0;
    temporal_freq *= temporal_freq_persistence;
    amplitude *= amplitude_persistence;
  }
  return vx / 2.0;
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  // Normalized pixel coordinates (from 0 to 1)
  vec2 uv = fragCoord / iResolution.xy;

  float v = plasma_sines_octave(uv.x, uv.y, iTime, 8, 1.5, 0.5);

  float r = 0.8 - wave_sine(v);
  float g = wave_sine(v + 0.333) - 0.2;
  float b = 0.8 - wave_sine(v + 0.666);

  fragColor = vec4(r, g, b, 1.0);
}

Development

To build the C extension module (on Raspberry Pi single-board computers only):

swig -python ./ledcontrol/driver/ledcontrol_rpi_ws281x_driver.i && sudo python3 setup.py develop

License

MIT

led-control's People

Contributors

heppu avatar jackw01 avatar ohthehugemanatee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

led-control's Issues

Unable to start ledcontrol

My installation from the master branch seems to have gone through (nothing to show otherwise) , however when I run the program I get the following error:

$ sudo ledcontrol --port 80 --led_count 200
Using default linear pixel mapping (200 LEDs)
Can't open device file
: No such device or address
Traceback (most recent call last):
  File "/usr/local/bin/ledcontrol", line 33, in <module>
    sys.exit(load_entry_point('led-control', 'console_scripts', 'ledcontrol')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lights/src/led-control/ledcontrol/__init__.py", line 43, in main
    app = create_app(args.led_count,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lights/src/led-control/ledcontrol/app.py", line 47, in create_app
    leds = LEDController(led_count,
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lights/src/led-control/ledcontrol/ledcontroller.py", line 90, in __init__
    raise RuntimeError('ws2811_init failed with code {0} ({1})'.format(resp, str_resp))
RuntimeError: ws2811_init failed with code -9 (Failed to create mailbox device)

Does anyone one have any idea what might be going wrong

v.2.0.0 Not setting UI elements after preset select

[First of all, awesome work on v2.0.0, really enhances a great piece of work - do you want to see a video of my setup in action?]

The issue I have is that when I select a preset, the UI elements (select boxes etc) are not populated with the settings that they actually are. I would expect the palettes and patterns for each section to be updated after a preset is selected. I hope this is clear...

Installation not working

I'm very new to LEDs to please bear with me. I have a raspberry pi 3B+ running python 3.7.4 and when I try to install this, I always get the same error code at the same step.
When I type git checkout tags/v2.0.0
I always get the error: fatal: not a git repository (or any of the parent directories): .git
Any help is greatly appreciated.

Does Not work now

Yesterday it worked really fine but today under the same conditions (I'm using GPIO 18 and all the default values except led count(120)), it does not work. My power supply is this. In addition, I can use web UI and everything looks alright!
EDIT: I'm using pi zero with the Raspbian Lite OS
EDIT: I also tried by using arduino and it works but stopped working with raspberry pi

Raspberry Pi 3A+ Revision 1.1 not yet supported by rpi_ws281x

I have created PR #531 over on that repo jgarff/rpi_ws281x#531 to add the Rev 1.1 board to the supported hardware so assuming that gets approved, it would be great if this project could update its dependency version of rpi_ws281x to include that change. FWIW, I found it to be devilishly difficult to get ledcontrol to build using my forked version that added the rev 1.1 support, but maybe I wasn't doing it right.

Thank you for working on the color correction

Hi @jackw01,

I just wanted to let you know that your recent changes (commit bc3e76f) concerning color correction are appreciated!

For me, a white gradient has changed from this:
image
to this on the most recent version:
image

I'm using --led_color_correction #FFFFFF and color temperature 6600K by the way, I think that's better for white gradients, right?

However, depending on the pattern, the color correction might still be wanted... Maybe the pattern could control that itself by returning new color formats in addition to rgb and hsv (e.g. rgbraw and hsvraw?) where the *raw types skip color correction?

Best Regards,
Nils

Flask App cannot find index.html

Hello,

I would like to try your tool for my LEDs connected to my Pi.

i did python3 setup.py install installation completed well

when i call for ledcontrol the app seams to lunch well but when i reach my pi IP i get this error

Loaded saved settings from /home/pi/led-control/ledcontrol.json
 * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
[2019-02-26 22:06:11,176] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/Flask-1.0.2-py3.5.egg/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.5/dist-packages/Flask-1.0.2-py3.5.egg/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.5/dist-packages/Flask-1.0.2-py3.5.egg/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.5/dist-packages/Flask-1.0.2-py3.5.egg/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.5/dist-packages/Flask-1.0.2-py3.5.egg/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.5/dist-packages/Flask-1.0.2-py3.5.egg/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.5/dist-packages/led_control-1.0.0-py3.5.egg/ledcontrol/app.py", line 80, in index
    colors=animation_controller.colors)
  File "/usr/local/lib/python3.5/dist-packages/Flask-1.0.2-py3.5.egg/flask/templating.py", line 134, in render_template
    return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
  File "/usr/local/lib/python3.5/dist-packages/Jinja2-2.10-py3.5.egg/jinja2/environment.py", line 869, in get_or_select_template
    return self.get_template(template_name_or_list, parent, globals)
  File "/usr/local/lib/python3.5/dist-packages/Jinja2-2.10-py3.5.egg/jinja2/environment.py", line 830, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/usr/local/lib/python3.5/dist-packages/Jinja2-2.10-py3.5.egg/jinja2/environment.py", line 804, in _load_template
    template = self.loader.load(self, name, globals)
  File "/usr/local/lib/python3.5/dist-packages/Jinja2-2.10-py3.5.egg/jinja2/loaders.py", line 113, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "/usr/local/lib/python3.5/dist-packages/Flask-1.0.2-py3.5.egg/flask/templating.py", line 58, in get_source
    return self._get_source_fast(environment, template)
  File "/usr/local/lib/python3.5/dist-packages/Flask-1.0.2-py3.5.egg/flask/templating.py", line 83, in _get_source_fast
    return loader.get_source(environment, template)
  File "/usr/local/lib/python3.5/dist-packages/Jinja2-2.10-py3.5.egg/jinja2/loaders.py", line 171, in get_source
    f = open_if_exists(filename)
  File "/usr/local/lib/python3.5/dist-packages/Jinja2-2.10-py3.5.egg/jinja2/utils.py", line 154, in open_if_exists
    return open(filename, mode)
NotADirectoryError: [Errno 20] Not a directory: '/usr/local/lib/python3.5/dist-packages/led_control-1.0.0-py3.5.egg/ledcontrol/templates/index.html'
192.168.1.81 - - [26/Feb/2019 22:06:11] "GET / HTTP/1.1" 500 -

Do you have any idea how can i fix it ?

Thanks for your time, Romain

V.2.1.1 don't work with my raspberry version - setup.py don't work

Hi, I have a raspberry pi 3b+.
I tried to install the version v2.1.1. The hole install works until I ran the setup.py programm. I get this failures: "ERROR Failed buildung wheel for pyfastnoisesimd"

This failure comes, when I use v2.1.1. If i try it with v2.0.0 or lower it worked.

Do you have any ideas?
Thank you!

AttributeError: module '_rpi_ws281x' has no attribute 'blackbody_to_rgb'

Installed on Raspberry Pi following steps in readme.
sudo ledcontrol --led_count 384 --port 5000

Traceback (most recent call last):
File "/usr/local/bin/ledcontrol", line 11, in
load_entry_point('led-control', 'console_scripts', 'ledcontrol')()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2793, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2411, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2417, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/home/pi/Python/led-control/ledcontrol/init.py", line 7, in
from ledcontrol.app import create_app
File "/home/pi/Python/led-control/ledcontrol/app.py", line 10, in
from ledcontrol.animationcontroller import AnimationController
File "/home/pi/Python/led-control/ledcontrol/animationcontroller.py", line 12, in
import ledcontrol.animationpatterns as animpatterns
File "/home/pi/Python/led-control/ledcontrol/animationpatterns.py", line 7, in
import ledcontrol.rpi_ws281x as rpi_ws281x
File "/home/pi/Python/led-control/ledcontrol/rpi_ws281x/init.py", line 19, in
blackbody_to_rgb = rpi_ws281x.blackbody_to_rgb
AttributeError: module '_rpi_ws281x' has no attribute 'blackbody_to_rgb'

C Error

Hi jackw01,
Thank you for sharing this application with us, but in setup (when using sudo python3 setup.py develop command, I'm getting this error:

`pi@raspberrypi:~/led-control $ sudo python3 setup.py develop
warning: no files found matching 'tests/tests.py'
./python/ujson.c:39:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
Traceback (most recent call last):
File "/usr/lib/python3.7/distutils/unixccompiler.py", line 118, in _compile
extra_postargs)
File "/usr/lib/python3.7/distutils/ccompiler.py", line 909, in spawn
spawn(cmd, dry_run=self.dry_run)
File "/usr/lib/python3.7/distutils/spawn.py", line 36, in spawn
_spawn_posix(cmd, search_path, dry_run=dry_run)
File "/usr/lib/python3.7/distutils/spawn.py", line 159, in _spawn_posix
% (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 172, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 158, in call_command
self.run_command(cmdname)
File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 24, in run
self.build()
File "/usr/lib/python3.7/distutils/command/install_lib.py", line 109, in build
self.run_command('build_ext')
File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 78, in run
_build_ext.run(self)
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 199, in build_extension
_build_ext.build_extension(self, ext)
File "/usr/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/usr/lib/python3.7/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/usr/lib/python3.7/distutils/unixccompiler.py", line 120, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-pfib0xz6/ujson-4.0.2/setup.py", line 68, in
'Programming Language :: Python :: Implementation :: PyPy'
File "/usr/lib/python3/dist-packages/setuptools/init.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.7/distutils/core.py", line 163, in setup
raise SystemExit("error: " + str(msg))
SystemExit: error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1169, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 253, in run_setup
raise
File "/usr/lib/python3.7/contextlib.py", line 130, in exit
self.gen.throw(type, value, traceback)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python3.7/contextlib.py", line 130, in exit
self.gen.throw(type, value, traceback)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 166, in save_modules
saved_exc.resume()
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "/usr/lib/python3/dist-packages/setuptools/_vendor/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-pfib0xz6/ujson-4.0.2/setup.py", line 68, in
'Programming Language :: Python :: Implementation :: PyPy'
File "/usr/lib/python3/dist-packages/setuptools/init.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.7/distutils/core.py", line 163, in setup
raise SystemExit("error: " + str(msg))
SystemExit: error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "setup.py", line 68, in
'Programming Language :: Python :: Implementation :: PyPy'
File "/usr/lib/python3/dist-packages/setuptools/init.py", line 144, in setup
_install_setup_requires(attrs)
File "/usr/lib/python3/dist-packages/setuptools/init.py", line 139, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 724, in fetch_build_eggs
replace_conflicting=True,
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 782, in resolve
replace_conflicting=replace_conflicting
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1065, in best_match
return self.obtain(req, installer)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1077, in obtain
return installer(requirement)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 791, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 704, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 730, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 915, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1183, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1171, in run_setup
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
`

what am I doing wrong, Thank You!

issu sudo command not working

hello i have no idea why my rasbpberry pi is not finding the ledcontrolmap is there annyone that can help me. And yeah sorry bit i am new to raspberry and coding and could defeneltly use som help <3
image

pyOpenSSL dependency breaks install

sudo python3 setup.py develop fails with error:

  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/pip/__main__.py", line 23, in <module>
    from pip._internal.cli.main import main as _main  # isort:skip # noqa
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
    from pip._vendor.packaging.utils import canonicalize_name
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 94, in <module>
    vendored("requests.packages.urllib3.contrib.pyopenssl")
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
    __import__(modulename, globals(), locals(), level=0)
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/share/python-wheels/urllib3-1.26.5-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 50, in <module>
  File "/home/aririos/led-control/.eggs/pyOpenSSL-22.1.0-py3.9.egg/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import SSL, crypto
  File "/home/aririos/led-control/.eggs/pyOpenSSL-22.1.0-py3.9.egg/OpenSSL/SSL.py", line 19, in <module>
    from OpenSSL.crypto import (
  File "/home/aririos/led-control/.eggs/pyOpenSSL-22.1.0-py3.9.egg/OpenSSL/crypto.py", line 3224, in <module>
    utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'

As mentioned in pyca/pyopenssl#1154, this is a pyOpenSSL 22.1.0 dependency issue, and downgrading to 22.0.0 temporarily fixes the issue.

Remote management

Hi jack,
first of all great work, great project.
I consider myself as newbie with raspberry, especially with java.
I bought materials and assembled version of two led corner lamps, something like this .
I programmed some patterns in python for them but then saw this project and it was game changer.....

I have two questions:

  • when i leave the program running for a while, web interface do not loads right up but it takes some time. Is that a power saving feature of raspberry pi zero 2 W or something else ?
  • i would like to synchronise these two lamps to run these patterns at the same time, can you please point me to right direction on how to accomplish this ?

Thanks a lot

Support 6 LEDs-per-pixel (24v strips)

24v SK6812 strips commonly use 6 LEDs per pixel... but I can't figure out the pixel order for those 6 LEDs, and this tool only supports RGB/W variations. Is this a limitation of the underlying library?

Fresh install isn't working

Hi, thanks for making this awesome package!

I just did a fresh install on a brand new Raspbian installation and I'm getting the error below. Any ideas?

pi@raspberrypi:~/led-control $ sudo ledcontrol --led_count 15 /usr/local/lib/python3.7/dist-packages/_rpi_ws281x.cpython-37m-arm-linux-gnueabihf.so Traceback (most recent call last): File "/usr/local/bin/ledcontrol", line 11, in <module> load_entry_point('led-control', 'console_scripts', 'ledcontrol')() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2793, in load_entry_point return ep.load() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2411, in load return self.resolve() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2417, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/home/pi/led-control/ledcontrol/__init__.py", line 7, in <module> from ledcontrol.app import create_app File "/home/pi/led-control/ledcontrol/app.py", line 10, in <module> from ledcontrol.animationcontroller import AnimationController File "/home/pi/led-control/ledcontrol/animationcontroller.py", line 12, in <module> import ledcontrol.animationpatterns as patterns File "/home/pi/led-control/ledcontrol/animationpatterns.py", line 8, in <module> import ledcontrol.rpi_ws281x as rpi_ws281x File "/home/pi/led-control/ledcontrol/rpi_ws281x/__init__.py", line 19, in <module> blackbody_to_rgb = rpi_ws281x.blackbody_to_rgb AttributeError: module '_rpi_ws281x' has no attribute 'blackbody_to_rgb'

Error on a newly installed raspebrry pi 4

pi@uranian:~ $ /usr/local/bin/ledcontrol -h
Traceback (most recent call last):
File "/usr/local/bin/ledcontrol", line 11, in
load_entry_point('led-control', 'console_scripts', 'ledcontrol')()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2793, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2411, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2417, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/home/pi/led-control/ledcontrol/init.py", line 7, in
from ledcontrol.app import create_app
File "/home/pi/led-control/ledcontrol/app.py", line 24, in
'', '', False,
File "/home/pi/led-control/.eggs/recordclass-0.15.1-py3.7-linux-aarch64.egg/recordclass/recordclass.py", line 67, in recordclass
fast_new=fast_new, gc=False)
File "/home/pi/led-control/.eggs/recordclass-0.15.1-py3.7-linux-aarch64.egg/recordclass/dataclass.py", line 152, in make_dataclass
cls = datatype(typename, bases, ns, gc=gc, fast_new=fast_new)
File "/home/pi/led-control/.eggs/recordclass-0.15.1-py3.7-linux-aarch64.egg/recordclass/datatype.py", line 154, in new
new = _make_new_function(typename, fields, defaults, annotations, use_dict)
File "/home/pi/led-control/.eggs/recordclass-0.15.1-py3.7-linux-aarch64.egg/recordclass/datatype.py", line 257, in _make_new_function
code = compile(new_func_def, "", "exec")
File "", line 3
'Create new instance: FormItem(control='range', key='None', type=None, min=0, max=1, step=0.01, options=[], val=0, label='', unit='', hide=False)'

Issue starting up

Hello,

I fiddled around a lot, but did not get it working.

I want to setup this on my Raspberry Pi 3B (Zero W 1.1 in bestcase) to control some strips, sadly I don't get it to start up right...

I applied the fix from #53 and tried from master directly but no luck there.
Maybe someone can help me get started :)

sudo ledcontrol --led_count 17
Traceback (most recent call last):
  File "/usr/local/bin/ledcontrol", line 33, in <module>
    sys.exit(load_entry_point('led-control', 'console_scripts', 'ledcontrol')())
  File "/usr/local/bin/ledcontrol", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/pi/led-control/ledcontrol/__init__.py", line 5, in <module>
    from ledcontrol.app import create_app
  File "/home/pi/led-control/ledcontrol/app.py", line 10, in <module>
    from flask import Flask, render_template, request, jsonify
  File "/home/pi/led-control/.eggs/Flask-2.2.2-py3.9.egg/flask/__init__.py", line 5, in <module>
    from .app import Flask as Flask
  File "/home/pi/led-control/.eggs/Flask-2.2.2-py3.9.egg/flask/app.py", line 30, in <module>
    from werkzeug.urls import url_quote
ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/home/pi/led-control/.eggs/werkzeug-3.0.1-py3.9.egg/werkzeug/urls.py)

prev_state is not reinitialized to 0 upon pattern change... when is the first animation frame?

For example, create a pattern like this, and hit "Compile pattern".

def pattern(t, dt, x, y, z, prev_state):
    val = prev_state[2]
    if prev_state[2] < 1:
        val = prev_state[2] + 0.001
    return (1,1,val), hsv

If lights are V=0, this will slowly bring them up to maximum brightness.

Then hit "Compile pattern" again, and nothing will change. Try switching to a pattern with variable V, like blackbody cycle 1d, and then jump right to this newly defined pattern. The initial pattern of V values will stay in place.

This is not what I expected from the README. prev_state should be "Initialized to (0, 0, 0) on the first animation frame."

Perhaps the real clarification needed is, when is the first animation frame? Is it at program start, or at pattern start? The former makes sense for smooth transitions, but makes t values hard to work with and breaks isolation for prev_state. The latter keeps pattern functions isolated, but makes for uglier transitions.

Proposal: you could have a checkbox/api parameter for "continuous animation" which controls this.

help troubleshooting random colors

Thank you for all your work on this project!

I'm having trouble getting my SK6812W strip working properly with my Pi3B. The strip is connected as described in the README, to GPIO18 with external power to the strip. When I run sudo ledcontrol --led_count 300 --led_pixel_order GRBW the strip lights up and the flask interface looks lovely... but the led outputs on the strip are seemingly random. "static color" shows up like this:

768-1024

Any pattern set in the UI will send changes to the LED strip, but not in any recognizable pattern on the actual light strip. It is as if I am sending commands, but in the wrong protocol.

How can I debug this further?

Current estimation in the README - what's this based on?

I was calculating my power needs based on the current estimate in the README (4A to drive 150 LEDs)... but I noticed that when I buy LED strips, the listed power consumption is about double that. For example, this 144 LED SK6812 strip which says it draws 34.5W (= about 7A).

What's the 4A number based on? I want to be careful here, as this has a big impact on wire gauge, fuses, etc.

Ability to add custom secondary patterns

Is there a reason there's no field for adding secondary patterns? I need to do this for my project, and would be happy to do it in a way that creates a patch for you.... but I'm worried that there may be a good reason you didn't add that already.

ledcontrol service needs manual restart after klipper restarts

Hi,

I'm in a process of setting up my corexy printer running on Klipper. Love your 'plugin' that lets me control the Neopixel LEDs via RPi GPIO. I do have one small problem though: every time I do changes to printer.cfg, it restarts Klipper, at which point the ledcontrol service is not responding and needs to be manually restarted via terminal.

Probably just missing something but is there a way to automatically recover the ledcontrol service upon Klipper restart? This would also help with turning off/on the printer. I don't turn off the RPi itself so again - printer starts up, Klipper starts up but the ledcontrol service is not responding.

Thanks.

Fixed it with reinstall of raspbian

Traceback (most recent call last):
File "/usr/bin/ledcontrol", line 33, in
sys.exit(load_entry_point('led-control', 'console_scripts', 'ledcontrol')())
File "/usr/bin/ledcontrol", line 22, in importlib_load_entry_point
for entry_point in distribution(dist_name).entry_points
File "/usr/lib/python3.9/importlib/metadata.py", line 524, in distribution
return Distribution.from_name(distribution_name)
File "/usr/lib/python3.9/importlib/metadata.py", line 187, in from_name
raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: led-control

fresh instalation and the stup runs without errors.
Any ideas?

Random Flicker

So I setup a strip of SK6812 LEDs (2m, 120 LEDs in total) with a Raspberry Pi 4 Model B. The software works perfectly with the LEDs except for at random intervals, the LEDs will flicker.

For example, when left on "Solid Colour" on red (255,0,0), the LEDs will randomly flicker to white at full brightness. Sometimes it will be frequent (3/4 times in 10 seconds) while sometimes it can go half a minute or longer without flickering.

I'm uncertain as to what could be causing this. I've tried changing the FPS to no avail (default of 60 to 30 then to 24). I've tried setting up the circuit with a level converter and without one. The program and lights work on both occasions but the flickering still happens. I've tried switching DMA channels, the problem still persists.

Any help would be appreciated!

Alternative sigle board computers?

Will this only work on a Raspberry pi? Those devices are extremely overpriced atm due to the shortage so I was wondering if it would work in an alternative like the orange pi

Presets?

Is there a way to have presets or am I just missing something?

i.e. By a preset I mean "this pattern #1, this brightness, this palette" etc etc

sACN input not processed unless an animated pattern is selected

I just spent 30 minutes trying to figure out why my lights weren't animating from the sACN data I'm sending from LedFx. If I changed any parameters of the lights within the led-control panel, it would update the pixels with the latest "snapshot" from LedFx, but they wouldn't animate on their own.

I accidentally fixed it while playing around with the local patterns in led-control...it seems like if a "static" pattern is chosen (like "Static Color", "Static White", etc), the data from sACN is not processed. An animated pattern needs to be selected (it doesn't seem to matter which one...I used "Hue Scan 1D") in order for the sACN data to properly animate the lights.

It doesn't seem like the local pattern should matter at all if sACN is in use...it was not even remotely clear why they randomly stopped working and then randomly started working again until I stumbled upon this discovery.

sACN RGBW Overflow error

Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pi/led-control/.eggs/sacn-1.8.1-py3.9.egg/sacn/receiving/receiver_socket_udp.py", line 57, in receive_loop
    self._listener.on_data(raw_data, time.time())
  File "/home/pi/led-control/.eggs/sacn-1.8.1-py3.9.egg/sacn/receiving/receiver_handler.py", line 59, in on_data
    self.fire_callbacks_universe(tmp_packet)
  File "/home/pi/led-control/.eggs/sacn-1.8.1-py3.9.egg/sacn/receiving/receiver_handler.py", line 143, in fire_callbacks_universe
    self._listener.on_dmx_data_change(packet)
  File "/home/pi/led-control/.eggs/sacn-1.8.1-py3.9.egg/sacn/receiver.py", line 45, in on_dmx_data_change
    callback(packet)
  File "/home/pi/led-control/ledcontrol/animationcontroller.py", line 106, in _sacn_callback
    self.led_controller.set_all_pixels_rgb_float(
  File "/home/pi/led-control/ledcontrol/ledcontroller.py", line 93, in set_all_pixels_rgb_float
    driver.ws2811_rgb_render_array_float(self._leds, self._channel, pixels, len(pixels),
OverflowError: in method 'ws2811_rgb_render_array_float', argument 4 of type 'int'

image

When I try and turn sACN on on the web interface (with 300 rgbw leds) I get this overflow error which I believe makes the sACN server unable to receive any input, so the lights don't change when LedFx sends them a command

Docker Image?

Hi Jack,

first of all: this is a brilliant application!

I really enjoy everything about it, like the simple installation, the well-designed CLI interface, and the equally well designed web interface.

However, I still have a low priority suggestion that I'd like to discuss with you.

How about provisioning of a Docker image containing an installation of led-control and an example docker-compose.yaml file ? I have built my own Dockerfile for this purpose, and that is not exactly hard to do. If one of us would provide that it could even further reduce the entry barrier because users would only need a docker-enabled distribution like HypriotOS on their RPi and not care about any additional dependencies.

Dockerfile:

FROM python:3-buster

WORKDIR /usr/src/app

RUN apt-get update && apt-get install -y scons swig git
RUN git clone --recurse-submodules https://github.com/jackw01/led-control.git && \
 cd led-control && \
 python3 setup.py develop
ENTRYPOINT ["ledcontrol"]

docker-compose.yml:

version: '3'
services:
  ledcontrol:
    build: .
    ports:
      - "80:80"
    privileged: true
    restart: always
    command: --led_count 150 --led_pixel_order GRBW # 150 LEDs of type SK6812
    volumes:
      - ./ledcontrol.json:/etc/ledcontrol.json

What do you think about this? And how should we tackle it from your perspective? Add another repository under your github user so that others can find it? Add the files to this repo? Do you have a Docker Hub account?

I can also do this under my own name, but then it would be harder to find for interested users. Maybe you could then link the Docker Hub page?

I'd prefer it if we could include the files in this repo, because then we could also automatically trigger a Docker image rebuild as soon as this repository is updated.

Best Regards,
Nils

@jackw01

AttributeError: module '_rpi_ws281x' has no attribute 'blackbody_to_rgb'

Same issue as #4 . This is the output when running sudo python3 setup.py develop
Fresh install of RasPi OS. 2020-08-20-raspios-buster-armhf-lite.img

running develop
running egg_info
writing led_control.egg-info/PKG-INFO
writing dependency_links to led_control.egg-info/dependency_links.txt
writing entry points to led_control.egg-info/entry_points.txt
writing requirements to led_control.egg-info/requires.txt
writing top-level names to led_control.egg-info/top_level.txt
reading manifest file 'led_control.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'led_control.egg-info/SOURCES.txt'
running build_ext
building '_rpi_ws281x' extension
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iledcontrol/rpi_ws281x/lib -I/usr/include/python3.7m -c ledcontrol/rpi_ws281x/lib/rpi_ws281x_wrap.c -o build/temp.linux-armv6l-3.7/ledcontrol/rpi_ws281x/lib/rpi_ws281x_wrap.o
In file included from ledcontrol/rpi_ws281x/lib/rpi_ws281x_wrap.c:3101:
ledcontrol/rpi_ws281x/lib/led_render.h: In function ‘unpack_rgb’:
ledcontrol/rpi_ws281x/lib/led_render.h:31:10: warning: missing braces around initializer [-Wmissing-braces]
   return (color_rgb){ r, g, b };
          ^
                       --------
                       {{{r}, {g}, {b }}}
ledcontrol/rpi_ws281x/lib/led_render.h: In function ‘blackbody_to_rgb’:
ledcontrol/rpi_ws281x/lib/led_render.h:79:10: warning: missing braces around initializer [-Wmissing-braces]
   return (color_rgb_float){r_out, g_out, b_out};
          ^
                            {{{  } {    } {    }}}
ledcontrol/rpi_ws281x/lib/led_render.h: In function ‘blackbody_correction_rgb’:
ledcontrol/rpi_ws281x/lib/led_render.h:84:10: warning: missing braces around initializer [-Wmissing-braces]
   return (color_rgb_float){bb.r * rgb.r, bb.g * rgb.g, bb.b * rgb.b};
          ^
                            {{{         } {           } {           }}}
At top level:
ledcontrol/rpi_ws281x/lib/rpi_ws281x_wrap.c:3055:12: warning: ‘convert_iarray_32’ defined but not used [-Wunused-function]
 static int convert_iarray_32(PyObject *input, uint32_t *ptr, int size) {
            ^~~~~~~~~~~~~~~~~
ledcontrol/rpi_ws281x/lib/rpi_ws281x_wrap.c: In function ‘_wrap_ws2811_hsv_render_array_float’:
ledcontrol/rpi_ws281x/lib/rpi_ws281x_wrap.c:7054:15: warning: ‘arg3’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (arg3) free(arg3);
               ^~~~~~~~~~
ledcontrol/rpi_ws281x/lib/rpi_ws281x_wrap.c: In function ‘_wrap_ws2811_rgb_render_array_float’:
ledcontrol/rpi_ws281x/lib/rpi_ws281x_wrap.c:7161:15: warning: ‘arg3’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (arg3) free(arg3);
               ^~~~~~~~~~
arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-armv6l-3.7/ledcontrol/rpi_ws281x/lib/rpi_ws281x_wrap.o -Lledcontrol/rpi_ws281x/lib/c/rpi_ws281x/ -lws2811 -o build/lib.linux-armv6l-3.7/_rpi_ws281x.cpython-37m-arm-linux-gnueabihf.so
copying build/lib.linux-armv6l-3.7/_rpi_ws281x.cpython-37m-arm-linux-gnueabihf.so ->
Creating /usr/local/lib/python3.7/dist-packages/led-control.egg-link (link to .)
led-control 1.0.0 is already the active version in easy-install.pth
Installing ledcontrol script to /usr/local/bin

Installed /home/pi/led-control
Processing dependencies for led-control==1.0.0
Searching for ujson==4.0.1
Best match: ujson 4.0.1
Processing ujson-4.0.1-py3.7-linux-armv6l.egg
ujson 4.0.1 is already the active version in easy-install.pth

Using /home/pi/led-control/.eggs/ujson-4.0.1-py3.7-linux-armv6l.egg
Searching for RestrictedPython==5.1
Best match: RestrictedPython 5.1
Processing RestrictedPython-5.1-py3.7.egg
RestrictedPython 5.1 is already the active version in easy-install.pth

Using /home/pi/led-control/.eggs/RestrictedPython-5.1-py3.7.egg
Searching for Flask==1.1.2
Best match: Flask 1.1.2
Processing Flask-1.1.2-py3.7.egg
Flask 1.1.2 is already the active version in easy-install.pth
Installing flask script to /usr/local/bin

Using /home/pi/led-control/.eggs/Flask-1.1.2-py3.7.egg
Searching for recordclass==0.14.3
Best match: recordclass 0.14.3
Processing recordclass-0.14.3-py3.7-linux-armv6l.egg
recordclass 0.14.3 is already the active version in easy-install.pth

Using /home/pi/led-control/.eggs/recordclass-0.14.3-py3.7-linux-armv6l.egg
Searching for itsdangerous==1.1.0
Best match: itsdangerous 1.1.0
Processing itsdangerous-1.1.0-py3.7.egg
itsdangerous 1.1.0 is already the active version in easy-install.pth

Using /home/pi/led-control/.eggs/itsdangerous-1.1.0-py3.7.egg
Searching for click==7.1.2
Best match: click 7.1.2
Processing click-7.1.2-py3.7.egg
click 7.1.2 is already the active version in easy-install.pth

Using /home/pi/led-control/.eggs/click-7.1.2-py3.7.egg
Searching for Werkzeug==1.0.1
Best match: Werkzeug 1.0.1
Processing Werkzeug-1.0.1-py3.7.egg
Werkzeug 1.0.1 is already the active version in easy-install.pth

Using /home/pi/led-control/.eggs/Werkzeug-1.0.1-py3.7.egg
Searching for Jinja2==2.11.2
Best match: Jinja2 2.11.2
Processing Jinja2-2.11.2-py3.7.egg
Jinja2 2.11.2 is already the active version in easy-install.pth

Using /home/pi/led-control/.eggs/Jinja2-2.11.2-py3.7.egg
Searching for MarkupSafe==1.1.1
Best match: MarkupSafe 1.1.1
Processing MarkupSafe-1.1.1-py3.7-linux-armv6l.egg
MarkupSafe 1.1.1 is already the active version in easy-install.pth

Using /home/pi/led-control/.eggs/MarkupSafe-1.1.1-py3.7-linux-armv6l.egg
Finished processing dependencies for led-control==1.0.0

How many LED's with 1 data pin

Hi there, it's a great application. thx!

Do you know, how many LED's I can control with 1 data pin from my raspberry?

Thx for every answer!

Question: endpoint to reset cycle/counter

Thank you for this great tool.
I've added a webpage to use as a simple controller, with buttons that use GET requests to so I can easily switch between specific settings. For example: Button A might set the brightness to 0.2, speed to 0.1 and select the 'fire' color palette, while button B will set the brightness to 1.0, speed to 1.0 and enable a custom movement pattern.
This works great, and by sending the same GET request to multiple IP addresses I can control a couple of Raspberry Pi's at the same time.

The only problem I have is the cycle on the Pi's not being in sync. When I press button B to start a wiping movement on all Pi's they will switch to the pattern at (pretty much) the same time, but the position might be different as their current cycle positions are not the same.

I've been checking the code, but it doesn't seem to be an endpoint to reset the cycle, or am I missing something? If there isn't, do you have any suggestions on how to implement this?

(I hope my question is clear, feel free to let me know if it isn't).

No module named '_ledcontrol_rpi_ws281x_driver

After installing ledcontrol and then attempting to run i get the following:

user@abyssbar:~/led-control $ sudo ledcontrol --led_count 69 Traceback (most recent call last): File "/usr/local/bin/ledcontrol", line 33, in <module> sys.exit(load_entry_point('led-control', 'console_scripts', 'ledcontrol')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/bin/ledcontrol", line 25, in importlib_load_entry_point return next(matches).load() ^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 202, in load module = import_module(match.group('module')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1206, in _gcd_import File "<frozen importlib._bootstrap>", line 1178, in _find_and_load File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 690, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 940, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/home/user/led-control/ledcontrol/__init__.py", line 5, in <module> from ledcontrol.app import create_app File "/home/user/led-control/ledcontrol/app.py", line 11, in <module> from ledcontrol.animationcontroller import AnimationController File "/home/user/led-control/ledcontrol/animationcontroller.py", line 14, in <module> import ledcontrol.animationfunctions as animfunctions File "/home/user/led-control/ledcontrol/animationfunctions.py", line 7, in <module> import ledcontrol.driver as driver File "/home/user/led-control/ledcontrol/driver/__init__.py", line 17, in <module> from _ledcontrol_rpi_ws281x_driver import * ModuleNotFoundError: No module named '_ledcontrol_rpi_ws281x_driver'

Which seems that the module is not built, I did build the module after the initial installation using swig -python ./ledcontrol/driver/ledcontrol_rpi_ws281x_driver.i && sudo python3 setup.py develop and it was successful. Any ideas what might be going on here?

Http get

Is there an HTTP GET request for the web interface? There is a 3rd party plugin that sends GET requests to change settings.

Get an error if I try the --hap argument

Hi, I got the error, if I try the --hap argument. How can I connect ledcontrol with my Apple HomeKit? Do I have to install something more?

Thank you for your answer :)

The error:
$ sudo ledcontrol --led_count 1475 --led_pixel_order RGB --hap
usage: ledcontrol [-h] [--port PORT] [--host HOST]
[--led_count LED_COUNT]
[--config_file CONFIG_FILE]
[--pixel_mapping_json PIXEL_MAPPING_JSON]
[--fps FPS] [--led_pin LED_PIN]
[--led_data_rate LED_DATA_RATE]
[--led_dma_channel LED_DMA_CHANNEL]
[--led_pixel_order LED_PIXEL_ORDER]
[--led_brightness_limit LED_BRIGHTNESS_LIMIT]
[--save_interval SAVE_INTERVAL] [--sacn]
[--no_timer_reset] [--dev]
ledcontrol: error: unrecognized arguments: --hap

New Raspi Zero 2 Doesn't Work

Just tested led-control on the new Raspi Zero 2 and there doesn't seem to be a driver to support the GPIO pins. I can provide more verbose error messages if you would like.

can't run setup , something to do with bjoern?

Sorry a bit of a noob here when it comes to python but when I run
$ sudo python3 setup.py develop
I get the following error followed by a stacktrace:

  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-3.9
      copying bjoern.py -> build/lib.linux-aarch64-3.9
      running build_ext
      building '_bjoern' extension
      creating build/temp.linux-aarch64-3.9
      creating build/temp.linux-aarch64-3.9/bjoern
      creating build/temp.linux-aarch64-3.9/http-parser
      aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-PN012d/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-PN012d/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DSIGNAL_CHECK_INTERVAL=0.1 -DWANT_SIGNAL_HANDLING=yes -DWANT_SIGINT_HANDLING=yes -Ihttp-parser -Istatsd-c-client -I/usr/include/libev -I/opt/local/include -I/opt/homebrew/include -I/usr/local/include -I/usr/include/python3.9 -c bjoern/_bjoernmodule.c -o build/temp.linux-aarch64-3.9/bjoern/_bjoernmodule.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
      In file included from bjoern/wsgi.h:2,
                       from bjoern/_bjoernmodule.c:3:
      bjoern/request.h:4:10: fatal error: ev.h: No such file or directory
          4 | #include <ev.h>
            |          ^~~~~~
      compilation terminated.
      error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
      [end of output]

Running headless on an RPI 3B.

Controlling multiple LED strips from a single frontend

Why im here?

I really like the effects and presets that you've implemented. Great work!

I want to control and synchronize three different LED strips (2801, 2812, 6812) using a single frontend.

I'm considering usability and decoupling this approach from specific LED strips, allowing for the use of any type of LED strip or controller.

Master Slave, Client-Server, Broadcast

I'm interested in the architecture of controlling LED strips with a frontend, specifically transitioning from a 1:1 model to a server-client model where multiple controllers(1:n) can be controlled by the frontend. Initially, all controllers will run the same effect, but later we may give each instance its own effect or treat the system as a single LED strip.

I propose encapsulating the calculation in a single module, which would only require the arrangement and number of LEDs for the calculation, regardless of the type or controller used.

Lets Discuss

Finally, my question is whether to develop from scratch or fork the project and implement the required changes. I'm asking about the degree of tight coupling between the architecture and controllers/LED strips and whether it's worth building on this architecture.

Before I jump into anything, I'd love to discuss with you and hear your thoughts and opinions. What do you think?

Everything is seemingly working, but I'm getting nothing.

I'm working on an LED Pickguard, and just testing with 1 SK6812 (RGBW) before I order the PCB to mount them all on, and everything seems to be working, getting all the way to the web control, yet the LED still won't do anything.

Not sure if this is even useful, but I'm measuring the power supply voltage fine, but not getting anything when measuring the signal to ground. (I'm running it through a step up converter which I have set to 5v.)

I'm basically brand new to this stuff, so don't really know what info is useful.

Thanks, Jack.

Random Lights

Well... I did have it working but I did something to my raspberry pi that required me to reinstall the OS. Anyway... I reinstalled the packages, following the READ ME and on the raspberry pi, it looks like it is working as expected. The lights, however, are not working. The first 6 LEDs are all different colors and the rest are off.
IMG_8436
.

Systemd service

Hi jackw01, thanks for the great work!

The program works for me smoothly.
However, when I made it into a service, the web server works but the led didn't light up.
Would you mind to have a look?
Thanks in advance!

[Unit]
Description=LED Control
After=network.target

[Service]
ExecStart=/usr/local/bin/ledcontrol --led_count '2'
StandardOutput=inherit
StandardError=inherit

[Install]
WantedBy=multi-user.target

sacn enforced to off on startup

A note for anyone with this issue in future:
I was able to fix sacn always defaulting to off by changing led-control/ledcontrol/app.py
settings['settings']['sacn'] = 1

Then continuing with the install instructions.

Optimization: Stop LED Update Timer if not required

Hi Jack,

this is another suggestion/idea that I'd like to discuss with you:

Is it possible to "stop" led-control from the web interface somehow? Currently I set "Master Brightness" to zero if I don't need the LEDs, but I see that the timer for updating the LEDs is probably still running, because ledcontrol continues to use 30-50% CPU of an RPI 3. What do you think about an optimization there for "static configurations" where the LEDs don't animate, but have a static color over time?

  • There could be an explicit on/off toggle on the web interface, that stops the timer. I assume the LEDs will stay in whatever state they are when you stop the timer, right?
  • Alternatively, could we stop the timer as soon as "master brightness" is turned to zero? However, this would not support the "static configurations" usecase mentioned above, but only be a way to turn off.
  • Pattern functions could return an optional boolean giving information about whether the pattern function is "static", i.e. will always return the same values independent of t/dt? Then the timer could also be stopped as soon as the function was executed once for each LED.

What do you think about these ideas? I could also give it a try to implement them, however I'm not exactly used to Python coding. Maybe you'd have less work doing it yourself than reviewing my stuff 😏

Best Regards,
Nils

@jackw01

PackageNotFoundError: led-control

I follow the build steps of this project but got this error that i couldn't find the led-control.
I did these steps:

sudo apt install scons swig libev-dev python3-dev python3-setuptools
git clone --recurse-submodules https://github.com/jackw01/led-control.git
cd led-control
git checkout tags/v2.0.0
sudo python3 setup.py develop
sudo ledcontrol --led_count
sudo ledcontrol --led_count 16 --led_pixel_order GRBW

I didn't had any errors during the build, only a few warnings about deprecated features and that cache wasn't being used.

Also, if i manage to get this to work, i would love to check out to make a container image for this project :) (maybe two for like a dev with ci/cd and a stable one like 2.0.0)

Dotstar support and how to use leds on pins from usb-attached MCUs

Hey there, nice work on this, would like to use it with my current setup.

Firstly, I am interested in using https://github.com/julianschill/moonshine which is using your software to control the LEDs. Currently I am using Dotstar strips attached to a Pico controlled by a 4B with other control software that works great, but not as feature-packed as what you've made here.

I am wondering if it's possible to point led control to the Pico pins, or any usb-attached MCU pins. I will be adding neopixels to this setup as well, but attached to the 3d printers control board instead of directly to the 4B, so having the ability to point led control to other usb-attached MCUs pins would be pretty handy. Idea here is to have the printer run macros that control the leds functions. I have a spare 3b that could work as a led control server, if there's a way to get Moonshine to look for it instead of the local pins.

Also will/can there be dotstar support? Unless I am mistaken, they need two pins instead of one to be seen by control software. Thanks for any info!

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.