scottlawsonbc / audio-reactive-led-strip

:musical_note: :rainbow: Real-time LED strip music visualization using Python and the ESP8266 or Raspberry Pi
MIT License
2.68k stars 644 forks source link

RGBW 60 LED Strip, 45/60 lit #241

Closed NickSutton closed 4 years ago

NickSutton commented 4 years ago

Hi,

Put everything together today and only 45 of the 60 of my RGBW strip are working. After some research it appears this is because the ‘strip’ object is configured as RGB...

That said, running led.py strandtest clearly shows a white LED, again only 45/60 though.

I ran some of the scripts from the neopixel library and know that all 60/60 of the LEDs are working properly.

Is there a change I can make to the code to support all 60 of the LEDs?

gaijinsr commented 4 years ago

https://github.com/Makuna/NeoPixelBus/wiki/NeoPixelBus-object Hint: NeoRgbFeature -> NeoRgbwFeature

NickSutton commented 4 years ago

https://github.com/Makuna/NeoPixelBus/wiki/NeoPixelBus-object Hint: NeoRgbFeature -> NeoRgbwFeature

Thanks, should have mentioned I’m using a Pi, and that looks to be an Arduino library.

The library examples I’ve used are generating all 4 colours across all 60 LEDs, but I’m sure there are changes to led.py and maybe visualisation.py to support RGBW strips in the animations?

joeybab3 commented 4 years ago

A simple fix would be to change the line as recommended above and just pass 0 to the white channel I would think?

NickSutton commented 4 years ago

There’s no NeoRGBFeature Line in led.py, but there is strip = neopixel.Adafruit_NeoPixel(config.N_PIXELS, config.LED_PIN, config.LED_FREQ_HZ, config.LED_DMA, config.LED_INVERT, config.BRIGHTNESS)

Other RGBW implementations pass an ‘order’ in place of the LED_FREQ_HZ Value.

From the https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-use document:

// Declare our NeoPixel strip object: Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); // Argument 1 = Number of pixels in NeoPixel strip // Argument 2 = Arduino pin number (most are valid) // Argument 3 = Pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) // NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)

But, adding NEO_RGBW Doesn’t seem to help!

joeybab3 commented 4 years ago

Somewhere there’s a version of the code using neopixelbus... I could have sworn that’s what I put in to the main branch but if it’s using adafruits library you’re not going to find it then. Give me a bit to hop on my computer and check what happened and I’ll get back to you but it would be in the arduino file rather than the python.

NickSutton commented 4 years ago

Just so you know, I’m using this fork:https://github.com/naztronaut/dancyPi-audio-reactive-led

Thanks for the help, really appreciated.

joeybab3 commented 4 years ago

Oh yeah well that would be why, I could have sworn I implemented neopixelbus but if you’re using a fork than I can’t say for sure what they did... I think the conversion to neopixelbus should only be a few lines different in the code and as long as your fork doesn’t change the packet structure then in theory you should be able to just run the code from this repo with the improvements from the other one.

NickSutton commented 4 years ago

The guy describes the changes he made on his git, as far as I can see mostly cosmetic stuff to enable an argument to be passed when running visualization.py To select the vis type. Neat idea really.

There’s nothing documented about changing over to NeoPixelBus etc.. Which file should I be looking in?

NickSutton commented 4 years ago

Flashed your fork on to the Pi and changed the line as above in the Arduino .ino files, couldn’t see where to pass a ‘0’ for the white value though, will that be in the led.py File?

joeybab3 commented 4 years ago

The line: RgbColor pixel((uint8_t)packetBuffer[i+1], (uint8_t)packetBuffer[i+2], (uint8_t)packetBuffer[i+3]);

I’m going to guess becomes rgbwcolor pixel and after uint_8 packetbuffer add just a 0

NickSutton commented 4 years ago

Hi,

So I updated both files in the Arduino folder: NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> ledstrip(NUM_LEDS, PixelPin); To NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod> ledstrip(NUM_LEDS, PixelPin); And also tried NeoPixelBus<NeoRgbwFeature, Neo800KbpsMethod> ledstrip(NUM_LEDS, PixelPin);

With RgbColor pixel((uint8_t)packetBuffer[i+1], (uint8_t)packetBuffer[i+2], (uint8_t)packetBuffer[i+3]);//color Becoming: RgbwColor pixel((uint8_t)packetBuffer[i+1], (uint8_t)packetBuffer[i+2], (uint8_t)packetBuffer[i+3], 0);//color

No errors, but still the same behaviour... Do i need to recompile the Arduino file to pick up the changes or anything?

joeybab3 commented 4 years ago

Just press the upload button and it should work, you have 60 leds in both the python config.py and at the top of the arduino sketch?

NickSutton commented 4 years ago

Upload? I’m editing on the Pi directly. Yep, 60 LEDs on both.

NickSutton commented 4 years ago

https://github.com/naztronaut/dancyPi-audio-reactive-led/issues/5#issuecomment-544147078