Miraclebob
Posts: 3
Joined: Sun Mar 03, 2019 5:02 pm
Contact: Website

Async gpio LED distorts audio jack

Sun Mar 03, 2019 5:10 pm

Hi!
Ive used these forums a lot, but am just now making my account because I haven't found much help for my issue, I hope someone has quick insight.

I'm using Model 2B pi.
Driving Neopixels with the gpio 18 pin and a level shifter as described in the adafruit guide.

Now I am introducing a script to play an audio file while LEDs are on. I've tried using both omxplayer and pygame commands to play audio. In both cases, the audio output becomes static, and the LEDS don't turn on. Audio is playing from aux jack.

Before I go into much detail with the code, are there nuances about the audio output I should know? When audio or led run synchronously it's fine. But when run together, it seems like they conflict.

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

Re: Async gpio LED distorts audio jack

Sun Mar 03, 2019 9:36 pm

The AUX jack uses the PWM channels for output. You can't use Aux audio and PWM at the same time.

Miraclebob
Posts: 3
Joined: Sun Mar 03, 2019 5:02 pm
Contact: Website

Re: Async gpio LED distorts audio jack

Sun Mar 03, 2019 10:19 pm

Thank you for confirming that. Just after posting I did some more digging and realized that as well. Sorry for not doing my due diligence.

These posts helped:
https://www.raspberrypi.org/forums/view ... p?t=201516
https://www.raspberrypi.org/forums/view ... p?t=135550
https://www.raspberrypi.org/forums/view ... p?t=219566

Even the lib i am using for LEDs says this: :geek: :roll:
https://github.com/jgarff/rpi_ws281x


I bought an HDMI converter: https://www.amazon.com/gp/product/B01LL ... UTF8&psc=1
and will try using either that or bluetooth audio playback w/ a usb bluetooth adapter I have.

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

Re: Async gpio LED distorts audio jack

Mon Mar 04, 2019 7:39 am

I think there is a driver that uses SPI instead of PWM. I haven't looked at it yet. That would free up the Aux audio port.

Return to “User groups and events”