Introduction: Build a DIY Amazon's Alexa With a Raspberry Pi and a MATRIX Creator

This tutorial will help you build your own Amazon's Alexa using a Raspberry Pi and MATRIX Creator, the first Microphone Array add-on for Raspberry Pi.

We will use Alexa Voice Services (AVS), it is the service used by Amazon Echo that allows us to accomplish many of the challenging tasks in this project.

Step 1: Parts That You'll Need

  1. MATRIX Creator.
  2. Raspberry Pi 2 or 3
  3. 5V 2.0A Power Supply
  4. Speaker (Needs Aux input.)

Step 2: MATRIX Creator MEMS Microphones

MATRIX Creator has 8 MP34DB02 MEMS audio sensor omnidirectional microphones.

  • Low power consumption
  • 120 dBSPL acoustic overload point
  • 62.6 dB signal-to-noise ratio
  • Omnidirectional sensitivity
  • –26 dBFS sensitivity

Step 3: Setting Up the Software (This Is From GitHub Quickstart)

Welcome to the MATRIX Creator! To enjoy your new board you’ll need to set it up. First, you need to have Raspbian installed on your Raspberry Pi. If you don’t have it, you can download it and follow the instructions.

Then you need to install the software that will allow you to program the MATRIX Creator. To do it, you need to configure APT. The following steps should do it:

echo "deb ./" | sudo tee --append /etc/apt/sources.list 

Now update the package list.

sudo apt-get update 

Then you can install the required packages.

sudo apt-get install matrix-creator-init cmake g++ git 

Now reboot the Raspberry Pi. After rebooting, the FPGA and SAM3 MCU will be programmed automatically. That is, after every reboot the FPGA will have the default firmware.

If you wish, you can also learn more about other features of MATRIX Creator on GithubQuestions? Post them on! Use the tag #matrix-creator.

Step 4: Set Alexa Voice Service (AVS) - Alexa - 1

Go to Alexa Voice Service (AVS) website and create a new developer account.

  • Create an account using your email and fill in the form with your personal information. You will be asked to agree; accept in order to use AVS.
  • You will then be asked about monetization. We don't earn money with this so select “No” for both options.
  • Once you complete the registration process, it’s time to configure AVS.

Step 5: Set Alexa Voice Service (AVS) - Alexa - 2

In the main page of AVS dashboard, go to ALEXA.

Then click on “Get Started” under the “Alexa Voice Service” section.

A simple list with available devices will then be displayed. Let's start by creating a new device.

Step 6: Set Alexa Voice Service (AVS) - Alexa - 3

Under Device Type ID choose a name for your device and Display Name

Then in the security profile you need to select the device, each device has a unique profile. So select your device and it show a some important information:

So copy Security Profile Description, Security Profile ID, Client ID and Client secret. Keep this information private it's only for your device. And keep this information it's important in next steps.

Step 7: Set Alexa Voice Service (AVS) - Alexa - 4

Configure the type of device, in this case select Home appliance. Fill in all forms and continue with the process.

Next you will be asked about Amazon Music; we recommend not enabling this feature yet. Finally, submit the configuration.

Your device should now be listed in the dashboard. Now we need to configure more technical details to set up with Raspberry Pi.

Step 8: Set Host Name in Raspberry Pi - 1

It's necessary to configure some things in Raspberry Pi so let's start.

In the command line:

sudo raspi-config

You will see a menu option.

Go to Advanced options and select Hostname.

Set your own HOST_NAME. It’s an important configuration, so keep that in mind.

Step 9: Set Alexa Voice Service (AVS) - Alexa - 5

Go back into AVS configuration and we need to set other configurations. So press Edit Button.

Here you find all device configuration, there go to Web Setting an edit it.

It show a page . Set:

Allowed Origins: http://HOST_NAME.local:5000
Allowed Return URLs: http://HOST_NAME.local:5000/code

So save this configurations.

Step 10: Configure MATRIX Creator HAL

Now it's necessary to clone MATRIX Creator HAL.

git clone
cd matrix-creator-hal
mkdir build
cd build
cmake ../
sudo make install

The HAL libraries are now installed on your Raspberry Pi.

Step 11: Configure MATRIX Creator Alexa Demo - 1

Now clone GitHub source code with:

git clone

Then go to following directory and install the following software:

cd matrix-creator-alexa-voice-demo 
sudo apt-get update
sudo apt-get install  memcached python-pip mpg123

Then run the next command:

sudo pip install -r requirements.txt

Now edit

ProductID = "PRODUCT_ID"
Security_Profile_Description = "SECURITY_PROFILE_DESCRIPTION"
Security_Profile_ID = "SECURITY_PROFILE_ID"
Client_ID = "CLIENT_ID"Client_Secret = ""

This information was also in Step 6.

Step 12: Configure MATRIX Creator Alexa Demo - 2

So now run the with:

./ &
[12/Aug/2016:00:41:16] ENGINE Listening for SIGTERM.
[12/Aug/2016:00:41:16] ENGINE Listening for SIGUSR1.
[12/Aug/2016:00:41:16] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '' has an empty config.[12/Aug/2016:00:41:16] ENGINE Started monitor thread 'Autoreloader'.
[12/Aug/2016:00:41:16] ENGINE Started monitor thread '_TimeoutMonitor'.
[12/Aug/2016:00:41:16] ENGINE Serving on
[12/Aug/2016:00:41:16] ENGINE Bus STARTED

Step 13: Configure MATRIX Creator Alexa Demo - 3

It's necessary to compile the microphone software at this point, so go to the micarray directory.

cd micarray
mkdir build
cd build
cmake ../

That is the compilation process for the microphone software.

Now you have all software configurations on your Raspberry Pi.

Step 14: Browser Confirmation

Make sure your Raspberry Pi is connected to your local network, open a web browser, and go to this address:


You will see an Amazon page as shown above.

Step 15: Run Alexa With Raspberry and MATRIX Creator

Return to the Raspberry, go to the matrix-creator-alexa-voice-demo folder, and run:


You did it! You’ve created your very own Amazon Alexa with a Raspberry Pi and a MATRIX Creator.


MATRIX_Creator (author)2017-03-02

Hey Everyone!

We just wanted to let you know that we have an updated version of the Alexa Guide that now includes the wake word feature. You can check it out here:

johnnyfrx (author)MATRIX_Creator2017-03-04

I headed over to the new build and all worked GREAT!! I posted a quick video and a couple of pics.

RyanHickmam (author)2017-02-20

Having issue as well

rmmod: ERROR: Module lirc_rpi is not currently loaded

NameError: global name 'refresh_token' is not defined

Raspberry Pi 3 B, Clean Image from scratch

johnnyfrx (author)RyanHickmam2017-02-26

This fixed it for me...

RyanHickmam (author)johnnyfrx2017-03-01

epic! that worked great! now im dancing with the issue:

rmmod: ERROR: Module lirc_rpi is not currently loaded


Hi Ryan,

We suggest you look at our latest demo. You can find it here:

Flynnprgmmr (author)2017-03-02

They have a new set of directions on their website which I tried to follow from scratch, I can't get the mics to work on it.

Flynnprgmmr (author)2016-09-14


I ran through the directions above and when I run the demo at the last step, I get the blue ring and the "hello" but there is a message:

Running workaround for GPIO 16 (IR-RX)
checking internet connection
connection OK

payload=client secret and access token (etc)

Touch MATRIX Creator IR Sensor.

The IR sensor doesn't seem to detect anything. So I hit CTRL+C and run the app again.

Running workaround for GPIO 16 (IR-RX)
checking internet connection
rmmod: ERROR: Module lirc_rpi is not currently loaded
connection OK
Touch MATRIX Creator IR Sensor.

As indicated in the error message, the IR detector isn't working.
If I reboot, and wave my hand over the IR then I get a blue LED flash on the left side of the Matrix.

As a side note, if I try to run the mic_demo, all I get are 0's

Any help would be appreciated. Can't wait for the Gesture and face recognition instructables.

Pi3, clean raspbian image, 2nd attempt from scratch.

RyanHickmam (author)Flynnprgmmr2017-03-01

did you or @thedanno figure this one out? im having the same issue

thedanno (author)Flynnprgmmr2016-11-06

I have the same problem except the lights on my Matrix are flashing every color when I start it up. Anyone get this to work properly? Anyone have this problem and fix it?

Tvixen (author)2016-11-24

Hi Guys

Great little print you created here... but Alexa Dot costs 49$ and the MATRIX costs 99$ plus the price for a Rasp3.... So what should be the argument to build it with your MATRIX print ?

santa1234 (author)Tvixen2017-02-10

I totally agree with you, making your own amazon echo using a matrix creator is too expensive

Ericd73 (author)Tvixen2017-01-05

From what I understand this isn't meant as a end customer device. Alexa is just one feature.

RichP33 (author)2016-11-14

Any chance y'all could update this for Alexa "Always On"?

hpsaturn (author)RichP332017-02-02

A new update of this instructable with Hands-Free mode can be found here:

DerekB52 (author)2016-10-18

does anything need to change for this to work with the always listening now that it's available?

hpsaturn (author)DerekB522017-02-02

A new update of this instructable with Hands-Free mode can be found here:

About This Instructable




Bio: MATRIX Creator is a sensor-packed dev board for Raspberry Pi that lets you build your IoT ideas.
More by MATRIX_Creator:Build a DIY Amazon's Alexa with a Raspberry Pi and a MATRIX CreatorRasberry PI Universal IR Remote with MATRIX Creator
Add instructable to: