Respeaker 2-Mics Pi Hat

The Respeaker 2-Mics Pi Hat is a perfect interface for the snips application, or for any of the voice assistants such as Alexa or Google…it is designed to slip on to the GPIO header of the RPi – it utilizes two microphones and a speaker port and some processing to provide a good environment for speech applications…it also has a built-in I2C serial port, and one of SEEED’s (the manufacturer) proprietary Grove ports (shown as GPIO12 in the diagram below) which accommodates many of the plug in modules…

SEEED makes a demo kit that includes all of the makings of a snips base device – you can also just buy the pieces without the demo stand if you want to run their snips demo skill to test your setup once everything is configured – we’ll touch on that once we get the snips application installed down-the-line a bit…so, let’s add the Respeaker 2-mic Pi Hat…

  1. The installation instructions are here  – to summarize, in the RPi terminal, type:
    1. sudo apt-get update
    2. sudo apt-get upgrade
    3. git clone https://github.com/respeaker/seeed-voicecard.git
    4. cd seeed-voicecard
    5. sudo ./install.sh
    6. sudo reboot
  2. Once you have installed the drivers, run aplay -l and arecord -l in the terminal of the RPi – you should get something like this:
pi@raspberrypi:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

pi@raspberrypi:~$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
pi@raspberrypi:~/seeed-voicecard $
  • note that the seeed-2mic-voicecard is card 1 in both lists – if that is the case, then you can use this command in the RPi terminal to check operation:
arecord -D plughw:1,0 -d 3 test.wav && aplay test.wav
  • this will record your mic for 3 seconds and then replay through the speaker – make sure to click the speaker icon in your RPi Desktop and see that the volume control is up above 50% or so, also, right-click the icon and be sure that Analog is checked for your speaker output…
  • if your arecord -l and aplay -l listing indicate a different card number, e.g., 0 for your installed devices, or if you use something other than the Respeaker unit, change the audio-testing command above to correspond, e.g.,
arecord -D plughw:0,0 -d 3 test.wav && aplay test.wav

also, if you are still having issues, you can try editing your asound.conf file:

sudo nano /etc/asound.conf (assuming you found your card to be card 1)

pcm.!default {
        type asym
        playback.pcm {
          type plug
          slave.pcm "hw:1,0" 
        }
        capture.pcm {
          type plug
          slave.pcm "hw:1,0"
        }
}

ctl.!default {
        type hw           
        card 1
}

Note: on a couple of occasions while testing lots of snips applications, or re-installing the snips Sam setup audio application (see next Guide section), I found that my audio quit working…running aplay -l and arecord -l showed that the default Alsa sound card was gone, and that the Respeaker card was now card 0 – if that happens to you, you may need to edit the /etc/asound.conf file (see above), changing the “hw:1,0” instances to “hw:0,0” and the ctl card to 0…

Note: When you buy your Respeaker 2-Mics Pi Hat, for the test app which follows later in this guide, you will need a Grove Relay module or a Grove LED module to confirm operation; additionally, you may want to purchase the Grove Temp and Humidity sensor if you think you may want to add it to the robot…