Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Best WS2812 Library to use with Audio Library

  1. #1
    Senior Member
    Join Date
    Dec 2015
    Posts
    125

    Best WS2812 Library to use with Audio Library

    Hi all,

    I have a project that uses the audio library to do a bunch of mixing, routing, and analysis. I'd like to use some pretty neat WS2812 LEDs as indicators, since I just discovered them in the 2020 package.

    I am doing a few experiments and I am seeing that the Audio library interrupts are interfering with FastLED writing the strip. I have disabled the Audio interrupt while writing to the strips, but I can't check if that's messing up the audio at this moment. I will be able to listen later tonight hopefully.

    I am using the Audio Shield, as well as I2C for a display driver.

    I will have two strips, one with 34 LEDs, the other with 26.

    Is there a better library than FastLED to use for this purpose? I assume OctoWS2812 would be more efficient since it uses DMA, but based on my reading of the page I need to reserve all 8 pins for it if I use it, and I can't dedicate that many pins to empty strips.

    Thank you!

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,743
    Quote Originally Posted by jkoffman View Post
    I will have two strips, one with 34 LEDs, the other with 26.

    Is there a better library than FastLED to use for this purpose? I assume OctoWS2812 would be more efficient since it uses DMA, but based on my reading of the page I need to reserve all 8 pins for it if I use it, and I can't dedicate that many pins to empty strips.

    Thank you!
    You want WS2812Serial:


    It uses DMA like the Octows2812b library/board, but it doesn't do 8 parallel streams. It might be simpler to use 2 separate streams, rather than 1 steam. It depends on your setup.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,080
    If you're using Teensy 4.0 or 4.1, OctoWS2811 might be an option. On these newer boards, you can configure OctoWS2811 to use any combination of pins. In Arduino, click File > Examples > OctoWS2811 > Teensy4_PinList for details.

    But if you can use the specific serial pins WS2812Serial supports, then WS2812Serial is the best. OctoWS2811 is kind of overkill for under 600 LEDs.

  4. #4
    Senior Member
    Join Date
    Dec 2015
    Posts
    125
    Thanks for the replies! I am looking at WS2812Serial now, and I hope to do some experimenting soon. I thought I remembered hearing something about a sort of OctoWS2811 "light". For the moment I'm working on a Teensy 3.2. I've debated moving to 4.0, but I'm hanging on to 5V on this project as long as I can.

    Paul, is there a reason WS2812Serial isn't listed on https://www.pjrc.com/teensy/td_libs.html?

    I don't have the right gear to test this at the moment, but does WS2812Serial work like FastLED to let you define one LED array then split it up over multiple outputs?

    For instance, using FastLED I can do this (in theory, this is untested):
    Code:
      FastLED.addLeds<NEOPIXEL, LEDBlock1_DATA_PIN>(WSleds, 0, LEDBlock1_Size);
      FastLED.addLeds<NEOPIXEL, LEDBlock2_DATA_PIN>(WSleds, LEDBlock1_Size, LEDBlock2_Size);
    Which should let me map my single array across two outputs. Would I do this on WS2812Serial like this:
    Code:
      LEDS.addLeds<NEOPIXEL, LEDBlock1_DATA_PIN>(WSleds, 0, LEDBlock1_Size);
      LEDS.addLeds<NEOPIXEL, LEDBlock2_DATA_PIN>(WSleds, LEDBlock1_Size, LEDBlock2_Size);
    Thank you!

  5. #5
    Senior Member
    Join Date
    Dec 2015
    Posts
    125
    Answering my own question, it does work!

    I did have a bunch of weird issues but it turned out I had a loose wire. Ahem....oops.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •