I connected the Dual Mic and the Smol Speaker hats to a single Pi3 using the HAT Hacker HAT.
I can’t seem to get both the speaker and the microphone to be detected at the same time. The installation scripts overwrite the dtoverlay with adau7002-simple for the mic and hifiberry-dac for the speakers. Loading both (adau7002-simple,hifiberry-dac) results in just the mic being detected, and the other way around in just the speaker being detected (by arecord -l and/or aplay -l).
I’m far from being any kind of expert on i2s. It may be doable, you may have to make sure only one device is accessing i2s at a time. It’s above my skill level that’s for sure.
Looks like I can manually load and unload the dtoverlay without a reboot - but it still doesn’t mean that they ‘work’ together.
Can anyone on the support team confirm if that was just a bit of misleading marketing fluff on the product page, or if there is any way to use both via the hacker hat without unloading and loading the dtoverlay between each use of the mic and playback - which makes any sort of voice controlled playback impossible since you can’t listen for a wakeword to interrupt the playback without having the mic available.
I don’t want to spend too much time going down a dead end if I have to get start looking for some other hardware to get it working in the end.
It’s unfortunately a bit more complicated than we’ve made it sound- requiring a separate dtoverlay to setup the adau7002 for input and pcm5102a for output. Device-tree stuff is a bit of a dark art, and while I’m sure it can work I’ve not had much luck finding an overlay which uses “simple-audio-card” to glue two codecs together like this.
I have, however, had a go at writing my own which at least loads and shows some… reasonable?.. devices:
I’ve updated our marketing fluff to hopefully make it clearer that getting two I2S devices working nicely together in Raspberry Pi OS is currently a bit here be dragons - if you need to swap anything drop us an email at support@pimoroni.com with a link to this thread and we’ll get it sorted.
Just for anyone coming after me the steps that worked for me are:
(I think my start state was running both install scripts for the microphone hat and then the speaker hat)
Paste the code above into a file called adau7002-pcm5102a-io-overlay.dts
Run the compile command to make the .dtbo
Move the .dtbo file to /boot/overlays/
In /boot/config.text change the dtoverlay line to be “dtoverlay=adau7002-pcm5102a-io”
Check the speaker works with: speaker-test -c2 -twav -l2
Check the microphone hardware details with: arecord -L
– look for the device that has ‘Hardware device with all software conversions’, mine looked like:
plughw:CARD=adau7002,DEV=1
adau7002, bcm2835-i2s-adau7002-hifi adau7002-hifi-1
Hardware device with all software conversions
Test the mic using the CARD and DEV details shown by arecord:
arecord -D hw:adau7002,1 -c2 -r48000 -fS32_LE -twav -d5 -R10000 -Vstereo test.wav
then play with: aplay test.wav
If all went to plan you should be able to hear someone saying 'Work you &£*@&*@ piece of *$&*£ ’
I have finally made the process above work - so thanks to both of you for persevering with, and documenting, that solution!
My only (ha!) remaining problem is that the recording level is very low. I’m basing that statement on speaker-test being much (like 10x) louder than recording a clip and playing with aplay.
I’m using 2 Pirate Audio boards - Dual Mic, and the mono Audio Amp Shim.
I’m no expert but I wonder if the /etc/asound.conf configuration lines from pirate-audio github (specifically the gain setting) are doing anything as they are configuring a device named mic_hw which is not the device created in the dtoverlay above?
If that is the case, can the conf and the dtoverlay be made to relate to the same device?
Or is there another way to increase mic gain using this setup? Or the amp shim volume (though I guess adjusting the recording end is better than just making a low vol recording louder).
For completeness … my journey started with the mono audio amp shim and the Seeed 2-mic board. That was a massively frustrating period and I finally gave up. For a time I thought the combo under discussion wasn’t working either until I discovered it was actually poor shim contact with the pins causing the problem. I moved the dual mic hat to a ribbon extension cable and that seemed to provide the pressure needed to ensure good shim contacts.
And for context - this sub-project is to provide ears to Manny, a shop mannequin who is being er, repurposed …
I stumbled across this thread as I am looking for a way to take live audio / apply effects / playback audio concurrently for a voice modulator project (inside a Dalek).
Is the ReSpeaker 2-Mics pHAT worth me getting for this?
I’d rather use an external mic than a built in one though?
Hi Bill
After posting above I discovered that although this combo worked with arecord and aplay the mics were not recognised by the s/w I wanted to use (Picovoice). So I ditched the ReSpeaker 2-Mic board for a Pirate Audio version - but that didn’t work either.
What has worked for me is keeping the Audio Amp Shim for output to a small speaker, and using a USB microphone for input. I got a cheap 2 mic “conference” mic that is getting embedded on top of Manny’s head and works well for speech recognition - the little basic USB mic in the photo above was very noisy and not good at any distance, but there are probably better similar mics available.
I think you will do fine with a similar setup - which is much less complex than the 2-board combos that failed for me. Regarding mounting 2 boards - the Audio Amp is a thin “shim” which means it has a full set of plated holes that go over the Pi pins and is held in place by whatever board you fit on the pins above it. In practice I found the boards didn’t guarantee good contact, and anyway it is now the only board, so it is held in place currently by the connector on a GPIO ribbon cable.