Introduction: Build DIY Amazon Alexa With a MATRIX Creator on "Hands-free" Mode

About: Mobile applications specialist, open culture enthusiast, software freedom activist

This guide provides step-by-step instructions for setting up Amazon Alexa (AVS) on a Raspberry Pi with a MATRIX Creator. It demonstrates how to access and test AVS using our Java sample app (running on a Raspberry Pi), a Node.js server, and a third-party wake word engine using MATRIX Creator mic array. You will use the Node.js server to obtain a Login with Amazon (LWA) authorization code by visiting a website using your Raspberry Pi's web browser.

Step 1: Required Hardware

Before you get started, let's review what you'll need.

  1. Raspberry Pi 3 (Recommended) or Pi 2 Model B (Supported) - Buy at Amazon - Pi 3 or Pi 2
  2. MATRIX Creator - Raspberry Pi does not have a built-in microphone, the MATRIX Creator has an 8 mic array for Alexa - Buy MATRIX Creator
  3. Micro-USB power cable for Raspberry Pi
  4. Micro SD Card (Minimum 8 GB) - You need an operating system to get started. NOOBS (New Out of the Box Software) is an easy-to-use operating system install manager for Raspberry Pi. The simplest way to get NOOBS is to buy an SD card with NOOBS pre-installed - Raspberry Pi 8GB Preloaded (NOOBS) Micro SD Card. Alternatively, you can download and install it on your SD card
  5. External Speaker with 3.5mm audio cable - Buy on Amazon
  6. 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 if you're unable to remote(SSH) into your Pi
  7. Internet connection (Ethernet or WiFi)
  8. (Optional) WiFi Wireless Adapter for Pi 2 (Buy on Amazon). Note: Pi 3 has built-in WiFi

For extra credit, enable remote(SSH) into your device, eliminating the need for a monitor, keyboard and mouse - and learn how to tail logs for troubleshooting.

Step 2: Let's Get Started

The original Alexa on a Pi project required manual download of libraries/dependencies and updating configuration files, which is prone to human error. To make the process faster and easier, we've included an install script with the project that will take care of all the heavy lifting. Not only does this reduce setup time to less than an hour on a Raspberry Pi 3, it only requires developers to adjust three variables in a single install script.

Step 3: Setting Up Your Pi

Configure your RaspberryPi like a original Alexa documentation, for this please completing steps: 1,2,3,4,5 and 6 from original documentation: Raspberry Pi

Step 4: Override ALSA Configuration

MATRIX Creator has 8 physical microphone channels and an additional virtual beam formed channel that combines the physical ones. Utilize a microphone channel by placing the following in /home/pi/.asoundrc

Copy code from here: asoundrc

Step 5: Install MATRIX Software and Reboot

Copy commands from here

Step 6: Run Your Web Service, Sample App and Wake Word Engine

Return to Raspberry Pi documentation and execute Step 7 but in the last terminal select the sensory wake word engine only, like this:

cd wakeWordAgent/src && ./wakeWordAgent -e sensory

Step 7: Talk to Alexa

You can now talk to Alexa by simply using the wake word "Alexa".

Try the following:

  • Say "Alexa", then wait for the beep. Now say "what's the time?"
  • Say "Alexa", then wait for the beep. Now say "what's the weather in Seattle?"

If you prefer, you can also click on the "Listen" button, instead of using the wake word. Click the "Listen" button and wait for the audio cue before beginning to speak. It may take a second or two before you hear the audio cue.

Complete documentation for this instructable: