MATRIX Voice and MATRIX Creator Running Alexa (C++ Version)

This guide shows you how to set up Amazon Alexa on a Raspberry Pi using the MATRIX Voice or MATRIX Creator as a microphone.

Required Hardware

Before getting started, let’s review what you’ll need.

  • Raspberry Pi 3 (Recommended) or Pi 2 Model B (Supported).
  • MATRIX Voice or MATRIX Creator – Raspberry Pi does not have a built-in microphone, the MATRIX Voice/Creator have an 8 mic array – Buy MATRIX Voice/MATRIX Creator.
  • Micro-USB power adapter for Raspberry Pi.
  • Micro SD Card (Minimum 8 GB) – An operating system is required to get started. You can download Raspbian Stretch and use etcher.io to flash the image onto your SD Card.
  • External Speaker with 3.5 mm audio cable.
  • USB Keyboard & Mouse, and an external HDMI Monitor – we also recommend having a USB keyboard and mouse as well as an HDMI monitor handy. You can also use the Raspberry Pi remotely, see this guide from Google.
  • Internet connection (Ethernet or WiFi)
  • (Optional) WiFi Wireless Adapter for Pi 2. Note: Pi 3 has built-in WiFi.

Let’s get started

Once you have the Raspberry Pi running with your MATRIX board and SD card image, we’ll need to register out device with an Amazon Developer account.

1. Register a Product in Amazon Developer

You’ll need to register a device and create a security profile in the Amazon developer website. If you have already registered a product and even created Security Profile we still recommend you create a new one for this demo. Follow step-by-step instructions here.

The manual installation below may take over an hour to finish so we have provided a downloadable image here with everything pre-installed. You can use etcher.io to flash the image onto your SD Card.

Skip to Step 4 if you use our image.

Manual Installation

The following steps marked with (Manual) are only required if you downloaded the default Raspbian Stretch image.

2. Installing MATRIX Software (Manual)

In order for the Alexa Voice Service to utilize the microphones of the MATRIX Creator or MATRIX Voice, you need to install the following:

# Add repo and key
curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list
# Update packages and install
sudo apt-get update
sudo apt-get upgrade
# Reboot
sudo reboot

After reboot connect again and run:

# Update again
sudo apt-get update
# Install MATRIX Pacakages
sudo apt install matrixio-creator-init
# Install kernel modules package
sudo apt install matrixio-kernel-modules
# Reboot
sudo reboot

Wait a bit and reconnect again.

3. Downloading Alexa SDK Scripts (Manual)

Download the install script. We recommend running these commands from the home directory (~/) or Desktop, however, you can run the script anywhere.

wget https://raw.githubusercontent.com/matrix-io/avs-device-sdk/master/tools/MatrixLabs/setup.sh && wget https://raw.githubusercontent.com/matrix-io/avs-device-sdk/master/tools/MatrixLabs/config.txt

4. Registering Your Pi as an Alexa Device

With all the initial installations downloaded, all that’s left is to configure your Raspberry Pi so that it’s identified by Amazon as the Alexa device you registered in step 1.

Open the file in a editor and use the Client IDProduct ID from the registration steps to fill the file config.txt. Check here if you need help editing the file.

5. Installing Alexa SDK

This setup script will pass your device config to Amazon and install the final dependencies needed. If you followed the manual installation, you may need to retry this command a few times (until there are no errors).

bash ./setup.sh ./config.txt

This installation can take about 30 min, so go and find something to do while waiting :). After finished reboot the Pi:

sudo reboot

6. Run Alexa!

Let’s run the Sample App:

bash ./startsample.sh

The first time the app will display a message like this:

######################################################
#       > > > > > NOT YET AUTHORIZED < < < < <       #
######################################################
############################################################################################
#     To authorize, browse to: 'https://amazon.com/us/code' and enter the code: {XXXX}     #
############################################################################################

Open a browser (could be on another device), go to https://amazon.com/us/code and use the code provided {XXXX} inside the curly brackets. Login in Amazon, then select “Allow” and wait for it to get the token (it may take as long as 30 seconds). This authentication is just required this first time running the app. After authentication is done you should see this message:

########################################
#       Alexa is currently idle!       #
######################################## 

Now, you can say Alexa!

Source: MATRIX Voice and MATRIX Creator Running Alexa (C++ Version)

Scroll to Top