Ws281x led status plugin not working

I want to use this plugin, but I'm unable to figure out why I'm not able to get anything working on my rpi4B. I'm using Neopixels WS2812B and I'm able to get strandtest.py working when using pin 18 (GPIO 24). When I try to use 18 on the plugin, it doesn't work. If I try to use 19 as the instructions say, I get an error in side strandtest.py saying "Gpio19 is illegal for LED channel 0".

Logging file is attached, but I'm getting "Selected GPIO not possible" and "failed with code -5 (mmap() failed)".

Maybe an enhancement request - I'm confused as to whether I should be putting in the GPIO number or the pin number in the settings. I've tried both and neither work. I know the RPI is seeing the strip as the test works beautifully. That gives me hope I can overcome this problem. Please assist!

[2021-07-23 23:19:30,231] INFO: Initialising LED strip
[2021-07-23 23:19:30,234] INFO: Strip successfully initialised
[2021-07-23 23:19:30,235] INFO: Debug logging not enabled, if you are reporting issues please enable it under 'Features' in the settings page.
[2021-07-23 23:19:30,242] INFO: On message received, turning on LEDs to idle
[2021-07-23 23:19:30,397] INFO: On message received, turning on LEDs to idle
[2021-07-23 23:19:58,220] INFO: Kill message recieved, all effects stopped. Bye!
[2021-07-23 23:19:58,293] INFO: Initialising LED strip
[2021-07-23 23:19:58,295] ERROR: RuntimeError('ws2811_init failed with code -11 (Selected GPIO not possible)',)
[2021-07-23 23:19:58,296] ERROR: Strip failed to initialize, no effects will be run.
[2021-07-23 23:19:58,296] INFO: No strip initialised, exiting the effect process.
[2021-07-23 23:22:46,629] INFO: Initialising LED strip
[2021-07-23 23:22:46,632] ERROR: RuntimeError('ws2811_init failed with code -11 (Selected GPIO not possible)',)
[2021-07-23 23:22:46,633] ERROR: Strip failed to initialize, no effects will be run.
[2021-07-23 23:22:46,633] INFO: No strip initialised, exiting the effect process.
[2021-07-23 23:23:26,932] INFO: Initialising LED strip
[2021-07-23 23:23:26,935] ERROR: RuntimeError('ws2811_init failed with code -5 (mmap() failed)',)
[2021-07-23 23:23:26,936] ERROR: Strip failed to initialize, no effects will be run.
[2021-07-23 23:23:26,936] INFO: No strip initialised, exiting the effect process.
[2021-07-23 23:32:57,781] INFO: Initialising LED strip
[2021-07-23 23:32:57,788] ERROR: RuntimeError('ws2811_init failed with code -5 (mmap() failed)',)
[2021-07-23 23:32:57,788] ERROR: Strip failed to initialize, no effects will be run.
[2021-07-23 23:32:57,789] INFO: No strip initialised, exiting the effect process.

Please follow the documentation, and wire your LEDs to GPIO 10

Thank you for your reply. I have it connected to GPIO10, which is pin 19 on a RPi 4. I've gone through all of this and it still doesn't work. I know it isn't a hardware problem because I've tested with the python test and everything checks out when using a different pin, but when it comes to this plugin, it doesn't seem to work.

Also, I've tried to jack up the debug level for this plugin on the logging page, but I still get these messages in the debug log for this plugin.

"Debug logging not enabled, if you are reporting issues please enable it under 'Features' in the settings page."

There's an additional checkbox under 'features' in the plugin's settings page, since the output is in a separate file on a separate process it is not covered by OctoPrint's logging settings.

For both the plugin & your strandtest.py example you need to use the BCM numbering, so the pin number is 10, not 19. You won't get any 'invalid pin' messages when pin 10 is entered, but you will with pin 19.

The plugin uses SPI to control the LEDs, not PWM (GPIO 18) which is available only when run as root, which is not how OctoPrint is run. You should try your strandtest.py example with GPIO 10, please note that this requires the additional setup steps outlined such as enabling SPI and setting it to the right frequency.

Apparently this wasn't a plug-and-play option for me.

I've tried to test using python - Run rpi_ws281x without sudo - Raspberry Pi Stack Exchange and GitHub - joosteto/ws2812-spi: python routines to program the WS2812 RGB LED chips on the raspberry, using the hardware SPI MOSI. and I'm still coming up empty on this pin.

Is it me, or are the instructions inadequate? I'm not sure what I'm doing wrong here. I don't know how someone could follow the instructions and have it work OOTB. I know I'm probably just overlooking something minute, but would you have any idea why it isn't working for me? I have pretty standard hardware (pi4 and WS2182B lights), so it's not like I'm trying to do something off the beaten path.

I wrote the instructions & the plugin, I hope it's not inadequate.

All I can tell from the posted log file to have any idea what is going on, is that you tried to use other GPIO pins (incl. 18) and they didn't work, it appeared to be working (from the software perspective) right at the start and then the settings are changed and it breaks.

So if you switch everything to GPIO 10, wire the LEDs here, make sure the plugin is showing pin 10, and make sure the OS configuration tests in the settings pass, upload a new log file so we can verify that from the software's perspective everything is OK.

I do appreciate your response. I agree that the instructions are exhaustive, but I might be the dummy that will dummy-proof your plugin. :slight_smile:

I've got 5 successful OS Config tests. All tests have been run from the Utilities tab (Test Red, Test Green, etc). Unplugged and re-plugged in my LED's, rebooted RPI and Octoprint. GPIO Pin set to 10, wired correctly to pin 19. Still nothing. New log attached.

plugin_ws281x_led_status_debug (10).log (5.4 KB)

In that log, it's showing the the LEDs are set to 'off', which would be the toggle in the navbar of the UI. Is that showing as on or off?

I noticed that before - for some reason it has been defaulting to off, but I turned it on, and I still don't get any lights.
plugin_ws281x_led_status_debug (11).log (19.5 KB)

For some reason, during this print, the LEDs that are on (I stopped that python LEDtest script and every third light is blue), they will turn off for about 2 seconds then turn back on to the blue pattern. Kinda weird.

I'm not entirely sure what's going on with the setup here, if it thinks that everything is OK from the perspective of the software, then usually people receive at least some output on the strip.

I'm not able to access my laptop or anything this week, but will keep thinking of what you can do to try and get your strip to work using SPI.

OK - I appreciate it. I switched to a different set of lights and I get the same problem. Could I use a different pin to test if my pin 19 is not working or something?

So the only pin you can use your plugin for is GPIO 10? Nothing else works with the plugin unless I run as root?

That's correct, GPIO 10 is an SPI pin. On later model Pi's there is at least one other set of SPI pins, which would be GPIO 38. However, I have not yet tested this and it may require an extra flag in the config.txt file to enable SPI 2 1.

The PWM pins (such as GPIO 18) require root access for the rpi-ws281x driver to work. Hence why you would run your strandtest.py script you would use sudo.

Bildschirmfoto vom 2021-07-26 22-12-41
https://raw.githubusercontent.com/raspberrypi/firmware/master/boot/overlays/README

1 Like