Almost got Google AIY DAC working

I’ve been playing around with trying to get balenaSound working with my Google AIY Voice HAT DAC, and I think I’ve almost got it, but I’m just missing some configuration somewhere. The DAC should require a dtOverlay=googlevoicehat-soundcard and that’s pretty much it. I confirmed the driver is already present for the Raspberry Pi 3 I’m using. I played around a bit with various settings, and eventually got speaker-test working, but only if I forced the device: speaker-test -c2 -twav -l7 -D plughw:0,0
(cat /proc/asound/modules only ever shows snd_soc_rpi_simple_soundcard, while aplay -l shows: card 0: sndrpigooglevoi [snd_rpi_googlevoicehat_soundcar], device 0: Google voiceHAT SoundCard HiFi voicehat-codec-0 [Google voiceHAT SoundCard HiFi voicehat-codec-0])

However, I was never able to get any sound to play via Airplay or Bluetooth. Most recently, I added the environment variable AUDIO_OUTPUT set to DAC as specified here: https://github.com/balenablocks/audio#environment-variables
This got me a little closer, as I could now see pulseaudio seeming to find the DAC, but still no audio would play. What’s worse, the device is now “busy” when trying speaker-test, even after removing the AUDIO_OUTPUT environment variable.

Anyone have any ideas on how to debug getting this DAC working? It’s the perfect DAC for a multi-room setup: my Microcenter sells them for $5 quite often, so I have a ton of them, and a Pi Zero should be able to use it as a client, letting me put speakers everywhere for around $10.

Hi Brian, I’ve pinged some of our team to take a look a this, but I don’t think that’s a DAC we have any experience with. We’ll get back to you on this, but I don’t know much advice we’ll be able to offer. Alternatively, let’s see if anyone from the Community chimes in. :slight_smile:

Thanks, I appreciate that. I thought I was onto something when I saw that the audio entry.sh script (https://github.com/balenablocks/audio/blob/master/entry.sh) only recognized cards with a DAC in their name, but no such luck. I’m currently researching whether the pinout of the VoiceHAT matches another DAC to try that dtOverlay, so we’ll see about that. Not really a big deal, this is mostly a fun project for me to learn more about balena, and it’s working!

Hi Brian,
Do keep us posted here on any progress you make with that DAC. I too bought some from the same source and I imagine others have as well!

@briandau what version of the voice kit have you got? Is it the one with the full HAT size board or the one with the half size bonnet / pHAT board (same size as Pi Zero)?

I believe the 1st version used a MAX98357 (ref)

And the second version uses a Realtek ALC5645

Only the first version uses the voice hat overlay that you mentioned, as far as I know but I need to check that. But since it uses the MAX98357 you might want to try the instructions in this Adafruit guide

I have both versions somewhere and need to dig them out.

The other thing is, earlier this year a generic soundcard driver was added to the Raspberry Pi kernel which supports the Google board. Perhaps this update caused an issue.

I need to try and find my AIY kits (I have both versions) and I’ll give this a try.

Thanks for the info, @shawaj. I do have the OG version of the HAT, full-sized.

I’ll have to dig in a bit more on the Adafruit instructions (fun side note, I added that exact amp onto my AIY HAT to give myself stereo sound!), as some of the instructions will obviously be different for a balena system. But a quick check of just switching the dtoverlay to hifiberry-dac did not work for me. I’ll have a bit more time to play with this over the weekend, so we’ll see how it goes.

@briandau hopefully I can find my original AIY kit in the next week or so and have a go with it as well! Will let you know if I get anywhere with it. And do let us know as well.

Actually, one thing I just thought of - maybe the reason the hifiberry one also doesn’t work is because it uses the same driver as the Google one after the driver update. So maybe that broke something. I think I have a hifiberry as well somewhere so will see what I can dig out and perform some tests.

Have a great Christmas (if you celebrate) and New Year.

@briandau - good news! I found my voiceHAT…will have a play with it now :slight_smile:

I found some info in this issue that could be related:

There are a few people reporting issues with the AIY voiceHAT rev1 not working. Fingers crossed I can get it going!

I found some more resources that may be helpful:

This bit was of interest particularly:

You may also need to disable module-suspend-on-idle PulseAudio module for the Voice HAT:

sudo sed -i -e "s/^load-module module-suspend-on-idle/#load-module module-suspend-on-idle/" /etc/pulse/default.pa

Will try this later on and see if that’s the issue.

This is also interesting as it says that pulseaudio could be this issue:

The v2 version “voice bonnet” requires special drivers but the hat doesn’t.

Also more info here

And here

I am also interested in this, I have the voice bonnet on a pi zero w. It required a driver to work. Source for the driver is listed here. https://github.com/google/aiyprojects-raspbian/blob/aiyprojects/HACKING.md

Hi @kern2011, just to clarify, are you saying that you did in fact get this to work? If so, which specific revision of the hardware were you using? Thanks!

No. I can get it working in Pi OS, but I’m unfamiliar with balena.

Hi @kern2011

If you have a spare SD card, you could try one of our simple examples - https://www.balena.io/docs/learn/getting-started/raspberrypi3/python/

You can change the language in the drop down on the top to something else that you are using with Pi OS. That should give you a good foundation to begin development for balenaOS