Setting up the Seeed Studio ReSpeaker 2-Mics Pi HAT

The Seeed Studio ReSpeaker 2-Mics Pi HAT is a dual-microphone expansion board for Raspberry Pi designed for AI and voice applications. This means that you can build a more powerful and flexible voice product that integrates Amazon Alexa Voice Service, Google Assistant, and so on.

As with any other HAT, the ReSpeaker 2-Mics Pi HAT can be mounted on a Raspberry Pi, and the Pi then programmed accordingly.

To help with the programming for the ReSpeaker HAT, there is plenty of documentation available online. Having said that, we did find that it was necessary to be a little creative with some of the information that we found.

The board is developed based on WM8960, a low power stereo codec. There are 2 microphones on both sides of the board for collecting sounds and it also provides 3 APA102 RGB LEDs, 1 User Button and 2 on-board Grove interfaces for expanding your applications. What is more, 3.5mm Audio Jack or JST 2.0 Speaker Out are both available for audio output.


  • Raspberry Pi compatible(Support Raspberry Pi Zero and Zero W, Raspberry Pi B+, Raspberry Pi 2 B, Raspberry Pi 3 B and Raspberry Pi 3 B+)
  • 2 Microphones
  • 2 Grove Interfaces
  • 1 User Button
  • 3.5mm Audio Jack
  • JST2.0 Speaker Out

Application Ideas:

  • Voice Interaction Application
  • AI Assistant

Hardware Overview:

  • BUTTON: a User Button, connected to GPIO17
  • MIC_Land MIC_R: 2 Microphones on both sides of the board
  • RGB LED: 3 APA102 RGB LEDs, connected to SPI interface
  • WM8960: a low power stereo codec
  • Raspberry Pi 40-Pin Headers: support Raspberry Pi Zero, Raspberry Pi 1 B+, Raspberry Pi 2 B , Raspberry Pi 3 B and Raspberry Pi 3 B+
  • POWER: Micro USB port for powering the ReSpeaker 2-Mics Pi HAT, please power the board for providing enough current when using the speaker.
  • I2C: Grove I2C port, connected to I2C-1
  • GPIO12: Grove digital port, connected to GPIO12 & GPIO13
  • JST 2.0 SPEAKER OUT: for connecting speaker with JST 2.0 connector
  • 3.5mm AUDIO JACK: for connecting headphone or speaker with 3.5mm Audio Plug

Getting Started:

1. Connect ReSpeaker 2-Mics Pi HAT to Raspberry Pi:

The first step in getting to grips with the ReSpeaker 2-Mics Pi HAT is to mount the HAT onto a Raspberry Pi. Ultimately we would like to use the HAT with a Pi Zero. However, for our initial set up we made use of a Pi 3 Model B, since this is easier to attach to monitor, keyboard and mouse. Once we are happy that everything is working the way we would like, we will swap the Pi 3 for a Pi Zero, using the same SD card.

2. Setup the driver on Raspberry Pi:

Once the HAT has been mounted onto the Pi 3, the Raspberry Pi needs to be attached to a keyboard, mouse, and monitor. Following that, the Pi is booted using an SD card that is imaged with the latest version of Raspbian. The process for imaging the SD card can be found at the Raspberry Pi Foundation’s website. We also cover this process in our blog article on Programming SD cards for Raspberry Pi.

While the upstream wm8960 codec is not currently supported by current Pi kernel builds, upstream wm8960 has some bugs, we had fixed it. We must build it manually.

Preparing the Raspberry Pi

Having booted the Raspberry Pi, there are a number of bits of software that need to be installed in order for the ReSpeaker 2-Mics Pi HAT to work. Before this is done, however, there is a small amount of configuration to be done. To configure the Raspberry Pi, execute the terminal command:

sudo raspi-config

In the configuration tool, configure the following items as required:

  • User password
  • Network options – hostname
  • Localisation options – current time zone
  • Advanced options – expand the filesystem

Once this configuration is complete, the Pi should be rebooted. Following the reboot, the Pi should next be updated to ensure that all currently installed software is up to date.

sudo apt-get update
sudo apt-get upgrade

Installing the ReSpeaker Software

  • Step 1. The first suite of software that should be installed is the ReSpeaker 2-Mics Pi HAT software. The full installation process for this is described below:

git clone

cd seeed-voicecard

sudo ./

sudo reboot

  • Step 2. Check that the sound card name matches the source code seeed-voicecard by command aplay -l and arecord -l.

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

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 $
  • Step 3. Test, you will hear what you say to the microphones(don’t forget to plug in an earphone or a speaker):

arecord -f cd -Dhw:1 | aplay -Dhw:1

3. Configure sound settings and adjust the volume with alsamixer

alsamixer is a graphical mixer program for the Advanced Linux Sound Architecture (ALSA) that is used to configure sound settings and adjust the volume.

pi@raspberrypi:~ $ alsamixer

The Left and right arrow keys are used to select the channel or device and the Up and Down Arrows control the volume for the currently selected device. Quit the program with ALT+Q, or by hitting the Esc key. More information

Warning: Please use the F6 to select seeed-2mic-voicecard device first.

4. Use the on-board APA102 LEDs

Each on-board APA102 LED has an additional driver chip. The driver chip takes care of receiving the desired color via its input lines, and then holding this color until a new command is received.

sudo pip install spidev
cd ~/
git clone
cd mic_hat

5. How to use User Button:

There is an on-board User Button, which is connected to GPIO17. Now we will try to detect it with python and RPi.GPIO.
sudo pip install rpi.gpio

import RPi.GPIO as GPIO
import time



while True:
state = GPIO.input(BUTTON)
if state:

Save the code as, then run it. It should display “on” when you press the button:



6. Modify System Boot file:

For our purposes, we only want to make use of the ReSpeaker 2-Mics Pi HAT for our audio input and output. Because of this, we can disable the Raspberry Pi onboard ALSA (Advanced Linux Sound Architecture) audio interface. To do this, the file /boot/config.txtneeds to be edited using the command:
sudo nano /boot/config.txt
In this file, modify the line referring to dtparam=audio=on (near the bottom of the file) and set the parameter setting to off. Following this change, the tail end of the config.txt file should look as follows:

# Enable audio (loads snd_bcm2835)

Having modified this config file, reboot the Pi.

Following the reboot, the aplay-l and arecord -l commands should now only return the seeed-2mic-voicecard devices:
aplay -l

**** List of PLAYBACK Hardware Devices **** 
card 0: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 []
 Subdevices: 1/1
 Subdevice #0: subdevice #0

arecord -l

**** List of CAPTURE Hardware Devices ****
card 0: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 []
 Subdevices: 1/1
 Subdevice #0: subdevice #0

7. Conclusion

The  Seeed Studio ReSpeaker 2-Mics Pi HAT is now setup on the Raspberry Pi, ready for your  next Audio based project.

Short URL:    Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Do NOT follow this link or you will be banned from the site!