I’ve got the speaker pHAT merrily blasting out sound but how do I access the LEDs? I can’t find the SN3218 listed as an i2c device…
The SN3218 is used on the PiGlow, so documentation is not lacking.
Start here: https://shop.pimoroni.com/products/piglow
You won’t see it in i2c detect as it is a write only device. You can communicate with it through the sn3218 library here. https://github.com/pimoroni/sn3218
The LEDs should fire up automagically if you used the Speaker pHAT one-line-installer. They were never intended to be driven manually. Although as there seems to be more than one person interested in doing so, I might whip up a thin Python library to wrap sn3218 and make it easier. For manufacturing reasons the LED channels used are… odd… to say the least.
If you’re using Pixel desktop and playing sound, try running:
To get pulse out of the way, and let the alsa plugin do its thing.
We’re looking into what’s changed recently with pulseaudio, which seems to now fire up upon startup and make a royal mess of things :(
to permanently stop pulseaudio to take over, it seems that deleting
/etc/xdg/autostart/pulseaudio.desktop will do the trick.
If all fails, uinstall pulseaudio, though I think this is avoidable if you want to have it handy to launch and stop on demand.
I used the one-line-installer but initially couldn’t get any sound out of the speaker. After a bit of googling I found that running ‘sudo rm /etc/asound.conf’ fixed playback, but the leds do nothing. I ran the test.py script in the python folder and the leds definitely work. I’m using raspbian jessie lite on a Pi 2 and using aplay for .wav files and mpeg321 for .mp3s. Pulseaudio is not installed.
I tested the one-line-installer no later than last night on lite, it should work - at least against a new image.
You should certainly not delete the /etc/asound.conf file, it is critical to the ‘vumeter’ operation.
I suggest you run the o-l-i again and then try a simple ‘speaker-test’:
speaker-test -c2 -t wav
(the channels are mixed in by the hardware so you should hear both left and right calls)
… if that does not work, then we can try to troubleshoot from there, but again, don’t delete any files rolled by the installers otherwise, yes, you shouldn’t expect the leds to work.
Thanks a lot RogueM. I did as you suggested and leds are now working with mplayer and mpg123. Thanks again for the quick response and another excellent product.