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

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

About: MATRIX Creator is a sensor-packed dev board for Raspberry Pi that lets you build your IoT ideas.

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.
  • 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.

IMPORTANT:

  • 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.

Manual Installation
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:

bash startauth.sh

Note: Users using an ssh session can load the website in their terminal by using

links http://localhost:3000

Step 7: Run Alexa!

Let's run the Sample App:

bash startsample.sh

Your Alexa device should be running and good to go!

Share

    Recommendations

    • Fix It! Contest

      Fix It! Contest
    • Metalworking Contest

      Metalworking Contest
    • Tiny Home Contest

      Tiny Home Contest

    23 Discussions

    I am trying to build a DIY Amazon's Alexa with a raspberry pi 3 and matrix creator and I followed the instructions on this website along with this website - https://github.com/matrix-io/matrix-creator-alexa-...

    However, with step 13 in order to compile the microphone software I am required to go to the micarray directory by using '' cd midcarray'', it failed to locate file

    1 reply

    help me: i'm work finish but matrix creator not work? why?

    INFO: *** THREAD JOINING: Sensory ***
    ERROR:An error happened in the mainLoop of SensoryWakeWord snsrRun(): task.fex: Operation failed.
    INFO:SensoryWakeWordEngine: mainLoop thread ended
    INFO:WakeWordAgent: State set to WAKE_WORD_PAUSED(6)
    INFO:WakeWordAgent: IPC Command received:4
    INFO:WakeWordAgent: State set to WAKE_WORD_RESUME_REQUESTED(7)
    INFO:SensoryWakeWordEngine: handling resume
    INFO:SensoryWakeWordEngine: mainLoop thread started
    INFO:WakeWordAgent: State set to IDLE(2)
    INFO:===> WakeWordAgent: wake word detected <===

    0
    None
    chngmq

    10 months ago

    i cannot find the micarray directory, may i know why?

    2 replies

    can anyone help me with this error?

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

    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

    3 replies

    This fixed it for me...

    https://github.com/sammachin/AlexaPi/issues/58

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

    rmmod: ERROR: Module lirc_rpi is not currently loaded

    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.

    Hello,

    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.

    2 replies

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

    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?

    0
    None
    Tvixen

    1 year ago

    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 ?

    2 replies

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

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

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