EricHigdon / OctoPrint-RGB_status

Adds RGB LED support to OctoPrint with the ability to choose effects based on the current status of your printer
33 stars 12 forks source link

Two WS2812 Strips... #38

Open Snille opened 4 years ago

Snille commented 4 years ago

Hi, I'm trying to set up two WS2812 strips (for two instances of Octoprint) on a Raspberry Pi 3+. The first one uses SPI0 (BCM 10 and works), the other one I would like to add to SPI1 (BCM 20).

I'm running Octopi (so user pi is in the GPIO-Group). Both SPI interfaces are enabled. I can see them in /dev

pi@octopi:~ $ ll /dev | grep spi crw-rw---- 1 root spi 153, 0 Nov 2 13:12 spidev0.0 crw-rw---- 1 root spi 153, 1 Nov 2 13:12 spidev0.1 crw-rw---- 1 root spi 153, 4 Nov 2 13:12 spidev1.0 crw-rw---- 1 root spi 153, 3 Nov 2 13:12 spidev1.1 crw-rw---- 1 root spi 153, 2 Nov 2 13:12 spidev1.2

But only the first strip works... What have I missed?

Another option wold be to be able to specify "parts of a strip". If I have one strip with 144 leds. Then the first 72 leds could be for printer 1 and the last 72 could be for printer 2. :) Then only one SPI interface would be needed. :)

EricHigdon commented 4 years ago

Am I understanding properly that you are running two instances of OctoPrint on the same RaspberryPi? If so, you will have to use SPI for one instance and PWM for the other (or PWM for both). SPI is a kernel level driver that can only be used by one process at a time.

As for specifying LED groups, I have issue #10 slated for version 2.0 which may address that.

Snille commented 4 years ago

Hi, yes, you are correct. I'm running two instances of Octoprint on the same PI, you can do that without any problem. Each instance gets it's own settings. I have set the pins to 10 in the first instance and 20 in the other... :) However, I'll try the PWM-path. Can WS2812 strips be controlled with PWM even? Anyway, thank you!

I'll let you know if it works when I have tested. :) Ok, tried to move over both strips to use PWM. Strip 1 on BCM 12 (PWM0) and Strip 2 on BCM 13 (PWM1). But no luck... Did not get any leds to lit...

Bonus: If you control 1 strip with both instances of Octoprint (via SPI BMC 10), you get this (IDLE set to KnightRider on both but different colors). Not what I want... But kind of funny anyway. :)

Looking forward to 2.0! :)