Build DIY Amazon Alexa With a MATRIX Creator on "Hands-free" Mode
Intro: Build DIY Amazon Alexa With a MATRIX Creator on "Hands-free" Mode
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.
- Raspberry Pi 3 (Recommended) or Pi 2 Model B (Supported) - Buy at Amazon - Pi 3 or Pi 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
- Micro-USB power cable for Raspberry Pi
- 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
- External Speaker with 3.5mm audio cable - Buy on Amazon
- 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
- Internet connection (Ethernet or WiFi)
- (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:
https://github.com/matrix-io/matrix-documentation/blob/master/docs/Demos/Alexa.md
14 Comments
catalincc 6 years ago
Hi,
I have few questions, please:
- for RPi, is that necessary that the GPIOs are enabled or not ?
- for the Matrix Creator, is it only the software as described at Step 5 to install, or also something else? Because it seems that the micarray is not found.
Thanks in advance.
DũngL10 6 years ago
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 <===
MikhailD3 6 years ago
I have done the alexa sample with a USB mic successfully. However I am having trouble with the Matrix. I followed the instructions and all software components start properly, however the Matrix is not responding. I also noticed that on johnnyfrx video there are two three LEDs blinking, while on my Matrix by the time all components are started I see only one. @hpsaturn any tips?
hpsaturn 6 years ago
https://github.com/matrix-io/matrix-creator-malos-android
Also, please check MALOS service is up 'ps aux | grep malos` and then recording some audio with arecord command like this:
"arecord -d 10 --device=mic_channel0 -r 16000 -c 1 -f S16_LE test.wav" and then play with aplay.
MikhailD3 6 years ago
As I was going through the different guides on your git hub page I might've installed both MLAOS and HAL. As I was digging in the forums someone suggested that this can be an issues, however I am not sure how to fix it. Could that be the issue? right now arecord produces sound recording with noise.
hpsaturn 6 years ago
DũngL10 6 years ago
have you been running yet? MikhailD3
i have the sam error
llangardaix 6 years ago
Works all fine!
One question its possible turn on leds when you have a question to Alexa?
Thank you
DũngL10 6 years ago
Which version raspbian do you use?
llangardaix 6 years ago
DũngL10 6 years ago
oh, yep. i'm run to step 7 but matrix creator not run. help me? thanks you so much
DũngL10 6 years ago
help me, i have problem :
pi@raspberrypi:~ $ sudo ./alexa_startup.sh
starting companion service
./alexa_startup.sh: line 4: cd: /home/pi/alexa-avs-sample-app/samples/: No such file or directory
./alexa_startup.sh: line 5: cd: companionService: No such file or directory
starting javaclient
./alexa_startup.sh: line 11: cd: /home/pi/alexa-avs-sample-app/samples/: No such file or directory
./alexa_startup.sh: line 12: cd: javaclient: No such file or directory
starting wake word agent
./alexa_startup.sh: line 18: cd: /home/pi/alexa-avs-sample-app/samples/: No such file or directory
./alexa_startup.sh: line 19: cd: wakeWordAgent/src: No such file or directory
MikhailD3 6 years ago
Does matrix work with kitt_ai wakeword engine?
hpsaturn 6 years ago
https://github.com/Kitt-AI/snowboy/tree/master/examples/Python
(demo_arecord.py)
Maybe this integration with Alexa Service is not ready (kitt.ai with arecord), but I don't know, maybe yes.