Introduction: MATRIX Voice and MATRIX Creator Running Alexa (C++ Version)
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.
- A 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.
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.
Step 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 already have a registered product that you can use for testing, feel free to skip ahead. If not, follow step-by-step instructions here. The following steps will show you how to install and sync your Raspberry Pi with your recently registered Amazon Alexa Device.
For Allowed origins use: http://localhost:3000 and https://localhost:3000
For Allowed Return URLs use http://localhost:3000/authresponse and https://localhost:3000/authresponse
Downloadable Image (Recommended)
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.
The following steps marked with (Manual) are only required if you downloaded the default Raspbian Stretch image.
Step 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/doc/apt-key.gpg $(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.
Step 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/yc/sensory-support/tools/RaspberryPi/setup.sh && wget https://raw.githubusercontent.com/matrix-io/avs-device-sdk/yc/sensory-support/tools/RaspberryPi/config.txt
Step 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 ID, Product ID and Client Secret from the registration steps to fill the file config.txt. Check here if you need help editing the file.
Step 5: Installing Alexa SDK
This setup script will pass your device config to Amazon and install the final dependancies needed. Note, this setup may take over an hour if you did not use our pre-installed image.
bash setup.sh config.txt
Step 6: Linking Your Device to Your Amazon Account
After the setup script has finished running, you'll need to generate an authorization token. Run this command, and open your browser and navigate to http://localhost:3000. Login with your Amazon credentials and follow the instructions provided:
Note: Users using an ssh session can load the website in their terminal by using
Step 7: Run Alexa!
Let's run the Sample App:
Your Alexa device should be running and good to go!