Raspberry Pi 4 ReSpeaker Intelligent Speech Recognition 2 Microphone


Introduction

The ReSpeaker 2-Mics Pi HAT is a Raspberry Pi dual microphone expansion board designed for AI and voice applications. This means you can build a more powerful and flexible voice product with integrated Amazona voice services and more.

The board is based on a low-power stereo codec developed on the WM8960. There are two microphones on either side of the board to capture sound, and it also provides three APA102 RGB LEDs, a user button, and two on-board Grove interfaces for expanding applications. In addition, either a 3.5mm audio jack or a JST 2.0 speaker output is available for audio output.

Features

  • Raspberry Pi compatible (supports Raspberry Pi Zero and Zero W, Raspberry Pi B +, Raspberry Pi 2 B and Raspberry Pi 3 B, Raspberry Pi 4 B, Raspberry Pi 3 B +)

  • 2 Microphones

  • 2 Grove interfaces

  • 1 customizable button

  • 3.5mm audio interface

  • JST2.0 audio output connector

Specifications

Pinout

  • Buttons: User-defined buttons connected to GPIO17

  • MIC_L & MIC_R: one microphone on the left and one on the right

  • RGB LEDs: 3 APA102 RGB LEDs connected to the Raspberry Pi's SPI interface

  • WM8960: Low-power stereo codec

  • Raspberry Pi 40-pin header: supports Raspberry Pi Zero, Raspberry Pi 1 B +, Raspberry Pi 2 B and Raspberry Pi 3 B

  • POWER: Micro USB port for powering the ReSpeaker 2-Mics Pi HAT, please power the board to provide enough current when using the speakers.

  • I2C: Grove I2C port, connects to I2C-1 GPIO12: Grove digital port, connects to GPIO12 and GPIO13

  • JST 2.0 SPEAKER OUT: For connecting to speakers, JST 2.0 connector

  • 3.5mm AUDIO JACK: for connecting headphones or speakers with a 3.5mm audio plug

How to Use

  1. System configuration and driver installation

Step 1 Insert ReSpeaker 2-Mics Pi HAT into Raspberry Pi

Insert the ReSpeaker 2-Mics Pi HAT into the Raspberry Pi, making sure the pins are aligned when inserting the Raspberry Pi.

!!!Note

step 2. burn system, log in, change source

Since the current Pi kernel does not currently support the wm8960 codec, we need to build it manually.

  1. Make sure you are running the latest Raspbian operating system (debian 9) on your Pi, you can use etcher for system burn-in!

  2. You can use VNC or PUTTY to connect to the Raspberry Pi, but please configure the wifi beforehand!

  3. Before installing the driver, please switch the source to Tsinghua according to the following procedure.

If you are commenting out the contents of the original file with #, replace it with the following:

!!!Note

Step 3. Download and install the driver Run the following command

!!!Note

Step 4. Check that the sound card name matches the source code seeed-voicecard.

  1. Audio playback tests

Step 1. Recording Test You can record with arecord and play it back with aplay: (don't forget to plug in headphones or speakers).

It can also be tested by audacity software. After opening Audacity, select AC108 and 2 channels as inputs and bcm2835 alsa: - (hw: 0, 0) as outputs to test:

Step 2. Adjust the volume (can be skipped)

alsamixer is a graphical mixer program for configuring sound settings and adjusting volume, Advanced Linux Sound Architecture (ALSA).

!!!Note

The left and right arrow keys are used to select a channel or device, and the "up and down arrows" control the volume of the currently selected device. To exit the programme use ALT + Q or press Esc. More information

Example of controlling an APA102 LED

Each on-board APA102 LED has an additional driver chip which sets the colour of the LED and then maintains that colour until a new command is received.

Please open SPI before execution as follows.

After configuration, you can run the led example by executing the following command line

How to use user-defined buttons

There is a user-defined button on the top of the board that connects to GPIO17. We can call python and RPi.GPIO to read the state。

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

FAQ

What should I do if the driver still fails to install even if I follow this wiki strictly?

If the installation of the driver fails according to the above methods, please click to download the following image (not applicable to 4 belts)

2018-08-06-raspbian-4GB-for-respeaker

Please perform the following steps:

  • First, if you want to use the interactive functions, please enter alexa-auth or dueros-auth to request authorisation, after successful authorisation, it will generate a .avs.json file in the /home/pi directory, then you can use the interactive functions.

  • Secondly, there will be a folder of routines for respeaker in /home/pi directory, so you can use the routines according to the mic you are using. But please update the routines in the respeaker directory after burning the system, you can run git pull origin master command in the respeaker directory to update the routines.

#include "portaudio.h" Error when run "sudo pip install pyaudio".

At the command line, enter the following command

Warning about installing snowboy with a warning that it is not suitable for the platform

Currently snowboy is only compatible with python2, so make sure it's python2 by installing a python virtual environment.

Sometimes there are dependency issues when sudo python file.py is used

When testing, I found that sudo executes from the system environment by default, and the dependencies used in the wiki are installed under ~/env, which can be solved with sudo ~/env/bin/python file.py.

Sound can be heard through the 3.5mm audio jack playback, but not when running ns_kws_doa_alexa_with_light.py

We have 3 players (mpv, mpg123 and gstreamer) available. mpg123 is more suitable for speech recognition and wakeup more, it is more responsive; while AudioPlayer is more suitable for gstreamer> mpv> mpg123. Gstreamer supports more audio formats and works well on raspberry pi. We can also specify the player for AudioPlayer using the environment variable PLAYER. So try the following command to enable voice *** Translated with www.DeepL.com/Translator (free version) ***。

Calling snowboy while running voice interaction doesn't work.

Please run audacity to make sure all 4 channels are good. If there is a channel with no data, there is no reply when we say snowboy.

Last updated

Was this helpful?