I’ve put together an AlexaPi using a Pi4, a HiFiBerry Amp2 connected to some passive speakers and a USB microphone. The Amp2 requires an 18V DC 3.5A power supply and this also powers the Pi4
All works fine but I’d like to add some lights so that when Alexa speaks or plays music, the lights flash. The icing on the cake would be to get lights to pulse in time to music but I’d settle just for flashing on and off just so there is a visual indicator that Alexa has heard the wake command.
Could either the PiGlow or Unicorn HATs be used for this? I read on here that Unicorn uses PWM (not actually sure what that is) and that this means you have to use sound over HDMI which I can’t do. Is that correct? Has anyone got either of these working with an Alexa, is there an alternative product I should look at?
I realise I could build my own LED circuit following this guide Indicate Device State with LEDs but thought the PiGlow and Unicorn looked so much better than anything I could ever make.
PWM is Pulse Width Modulation. The Unicorn Hat HD used SPI, Serial Peripheral Interface.
Whether you can use it or not depends on if there are any GPIO conflicts with the Hifiberry Amp.
I’m guessing that is using i2s?
The Unicorn hat pinout is here.
The Blinkt has fewer but bigger LED’s. I have a couple of LED shims in use here as bar graph displays of temperature.
My pHat Beat has two VU meters in it that flash with the intensity of the sound. Its all done for me though via the phat Beat installer.
If you look through the examples for the Blinkt and or LED Shim you may find the code you want. They are usually found on thier respective GitHub page.