Alexa is ran in the background of the Smart Mirror.
- alexa-client-sdk v1.10
- Follow https://developer.amazon.com/docs/alexa-voice-service/register-a-product.html to create your product profile on Amazon Developer
- Raspberry Pi 3B+ Kit
- USB Microphone
- 3.5mm Audio Cable
- Monitor
- Keyboard
- Mouse
Referenced from: https://developer.amazon.com/docs/alexa-voice-service/required-hardware.html
- Raspbian OS
- AVS Device SDK
- Follow https://developer.amazon.com/docs/alexa-voice-service/set-up-raspberry-pi.html to setup Raspbian OS and the Raspberry Pi
- With Raspbian OS loaded, run
sudo apt-get upgrade
in terminal to get the necessary updates in the Raspberry Pi - Get necessary files:
wget https://raw.githubusercontent.com/juliebee1024/smart-mirror-alexa/master/pi.sh \
wget https://raw.githubusercontent.com/juliebee1024/smart-mirror-alexa/master/setup.sh
- Create a config file:
sudo nano config.txt
- Copy and paste into the config file:
#NOTE: The Device Serial Number can be any unique number
DEVICE_SERIAL_NUMBER=""
CLIENT_ID=""
PRODUCT_ID=""
- Open a web browser and login to Amazon Developer (https://developer.amazon.com/avs/home.html#/avs/home) and click on your product
- Scroll down and copy & paste the Product ID into config.txt
- Click on "Security Profile" under the "Product Details" tab
- Scroll down and click on "Other devices and platforms"
- Copy & paste the Client ID into config.txt
- Enter any number (i.e. 123456) as the Device Serial Number
- Ctrl-o and enter to save
- Ctrl-x to exit
- Follow https://developer.amazon.com/docs/alexa-voice-service/input-avs-credentials.html starting at "Download your credentials" to get the config.json file
- In terminal, run the install script
cd /home/pi
sudo bash setup.sh config.txt
- Follow https://developer.amazon.com/docs/alexa-voice-service/build-the-avs-device-sdk.html for the rest of the installation process
Referenced from https://github.com/carolinedunn/Alexa-RPi-AutoStart
- Follow https://developer.amazon.com/docs/alexa-voice-service/get-a-refresh-token.html to get your refresh token and start the Alexa application
- Run the Alexa application by:
sudo bash /home/pi/startsample.sh
Reference https://developer.amazon.com/docs/alexa-voice-service/talk-with-alexa.html should you have any issues communicating with Alexa.
- For wake sound, follow https://developer.amazon.com/docs/alexa-voice-service/indicate-device-state-with-sounds.html
- Stop Alexa if it is running with Ctrl-c and download sound file from terminal:
wget https://raw.githubusercontent.com/juliebee1024/smart-mirror-alexa/master/hello.wav
- Open File Manager and move hello.wav from
/home/pi/Downloads
folder to/home/pi/sounds
folder - If you do not have permission to move files into the sounds folder, enter in terminal
sudo chown -R pi:pi /home/pi
and try step 2 again - Navigate to
cd /home/pi/avs-device-sdk/SampleApp/src/
andnano UIManager.cpp
- Double check to make sure
#include <cstdlib>
is included in the beginning of UIManager.cpp -- if not, add it in - Scroll down to
void UIManager::printState()
function - Find
} else if (m_connectionStatus == avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::Status::PENDING) {
ConsolePrinter::prettyPrint("Connecting...");
and add in system("play /home/pi/sounds/hello.wav");
such that it looks like this:
} else if (m_connectionStatus == avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::Status::PENDING) {
ConsolePrinter::prettyPrint("Connecting...");
system("play /home/pi/sounds/hello.wav"); //sound file for notification of bootup
- Save the file (Ctrl-o) and close (Ctrl-x)
- Rebuild the Sample App for changes to take effect:
cd /home/pi/build/SampleApp
sudo make
- Once the Sample App rebuilds, restart Alexa:
sudo bash /home/pi/startsample.sh
Referenced from https://github.com/carolinedunn/Alexa-RPi-AutoStart
- Stop Alexa if it is running with Ctrl-c and make a copy of the original .bashrc just in case:
cp /home/pi.bashrc /home/pi/.bashrc-original
- Edit the .bashrc file with
sudo nano /home/pi/.bashrc
- Scroll all the way to the bottom of the file and add in
sudo bash /home/pi/startsample.sh
on a new line after the finalfi
- Save (Ctrl-o) and exit (Ctrl-x)
- Enter
sudo raspi-config
in terminal -> select3 Boot Options
-> selectB1 Desktop/ CLI
-> selectB2 Console Autologin
<Finish>
and select<yes>
to reboot the Raspberry Pi
Referenced from https://github.com/carolinedunn/Alexa-RPi-AutoStart
- To set your location for weather and traffic data, follow https://developer.amazon.com/docs/alexa-voice-service/set-device-location.html
- To adjust sound sensitivity of the mic, type
alsamixer
in terminal - To force sound through 3.5mm audio jack or HDMI, type
sudo raspi-config
in terminal -> select7 Advanced Options
-> selectA4 Audio
-> choose either1
or2
depending on what you want - To train Alexa to your voice for a better sensitivity say "Learn my voice" and follow Alexa's instructions to create your voice profile (more information found: https://www.amazon.com/gp/help/customer/display.html/ref=hp_bc_nav?ie=UTF8&nodeId=202199440)