jeremyRutman
Posts: 4
Joined: Mon Jan 04, 2016 5:30 am

2812 addressable leds and audio

Fri Nov 01, 2019 9:04 pm

I have a project requiring addressable leds and audio . Thinking audio on the arduino would be trouble I decided on a pi 3 B+ , but have run into a limitation in that apparently audio and ws2812 leds cannot be run at the same time!!
However, it must be said that it is unfortunately not possible to simultaneously play sounds via the Raspberry Pi onboard sound card and control the strip. This is because the Raspberry Pi is not a real-time system like the Arduino or ESP8266 is. For the sound reproduction PWM is used, which is also needed to control the WS2812 on the Raspberry Pi. Using both at the same time is not possible, which is why someone who relies on the sound reproduction should just take the WS2801. https://tutorials-raspberrypi.com/conne ... ed-strips/


Also here pwm , dma is mentioned https://learn.adafruit.com/neopixels-on-raspberry-pi for the library i was thinking to use (adafruit neopixel python module)


Is there only one pwm pin available? Even arduino seems to have several.
Some possible solutions.
  • 1. As mentioned it seems the ws2801 led strip can be run without using the pwm/dma, but a good amt of 2812 leds have already been placed.

    2. I really don't want to run an arduino and raspi both ...

    3. run the ws2812 at low speed ? I dont know if this is possible , but i only need abt. 10 hz of addressing speed for the leds, can the timing reqs. on waveform for 2812 be satisfied by non-pwm gpio pins in this case?

    4. Would a raspi 4 solve it?

    5. Maybe some shield for timed bit-banging?

cruster
Posts: 120
Joined: Mon Sep 01, 2014 7:56 pm

Re: 2812 addressable leds and audio

Sat Nov 02, 2019 9:33 pm

IMHO you'd be better off driving the WS2812B's with an embedded processor ie an "Arduino" (or just the ATMEGA328P) and FastLED library. For Audio just use a separate device. Perhaps two Nanos? one for the WS2812B and the other for the audio. They're very cheap devices, even a pair is far far, less than a raspberry Pi - which anyway has a whole operating system "in the way"

Go embedded. :-)

User avatar
rpdom
Posts: 17029
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: 2812 addressable leds and audio

Sat Nov 02, 2019 9:57 pm

I believe there is a driver for the WS281x LEDs that uses SPI instead of PWM, so that may be usable at the same time as the Audio output.
Unreadable squiggle

Eirikur
Posts: 59
Joined: Sun Sep 09, 2018 9:43 pm

Re: 2812 addressable leds and audio

Mon Nov 04, 2019 10:18 pm

The audio output jack on the pi is for sound effects. If you want musical audio, a USB dongle (even a cheap one) is the way to go. Depending upon whether you power your LEDs independently, you might have noise bleeding into your audio.

Return to “General discussion”