It is very easy to setup Alexa Voice Services on a Raspberry Pi. Follow the steps below and you should have a Pi with Alexa,
- Raspberry Pi 3 (older models should work, but I have not tried them).
- USB mic so that Alexa can hear you
- Speakers so that you can hear Alexa
- Monitor, Keyboard/mouse (to connected to wifi and login into Amazon account)
Prepare the Pi:
- Install Raspbian using one of the methods listed here:
- Connect a monitor, and keyboard/mouse to the Pi.
- Connect Pi to Wi-Fi.
- Get any updates if necessary.
Register your device with Amazon:
This can be done on your computer or workstation or on the Pi
- Create developer account at Amazon.
- Login and follow the steps
- On the developer console, select Alexa tab.
- Under register a product (top right), select device
- Select an ID to your device and name and click next
- Note down the device ID, you will need this later
- On the next window, create a security profile
- Select a profile name and provide a description.
- Once you click next, note down the following. We will use these later
- Client ID
- Client Secret
- In the Web Settings tab, add the following
- Click next
- Select a category as you see fit (I selected other)
- Enter a description
- And answer the other two questions appropriately
- Click next and leave it unchecked
- Click Submit and you have successfully created a device profile
Install Alexa (this is on the Pi):
We will clone Alexa on the desktop and install from there
- Open a terminal window on the Pi and CD to your desktop
- cd Desktop
- Clone Alexa using:
Once complete, you should see a folder alexa-avs-sample-app on your Pi desktop
- Go to the folder and edit automated_install.sh. Here you will add the device ID, client ID and client secret from the steps above (from developer.amazon.com). Copy and paste to avoid any errors
- Save and close the file.
- Run the install script from the command line
- Answer the questions on the screen as you see fit (Yes for developer account).
- This process will take some time.
- By the end of it, you should have necessary software to run Alexa
Start Alexa Service:
- At the end of previous step, you should see the following message
- On the first terminal window, run the following for companion service
cd /home/pi/Desktop/alexa-avs-sample-app/samples/companionService && npm start
- You should see a communication port open and listening. Leave this window open
- On the second terminal window, run the following for java app and launch the web browser
cd /home/pi/Desktop/alexa-avs-sample-app/samples/javaclient && mvn exec:exec
- Click "yes" when asked to authenticate your device
- Your browser might warn you about the security risk. Proceed.
- This will pop-up a browser for you
- Do not click "OK" on the next pop-up window yet
- Login into your Amazon account and click "Okay" on the authentication screen.
- You should see "device tokens ready". If not, check out troubleshooting below
- Click "OK" on the pop-up window from Java app.
- This should setup necessary tokens for your Pi to communicate with Amazon servers
- On the third window, run the wake word agent (I selected KITT_AI)
cd /home/pi/Desktop/alexa-avs-sample-app/samples/wakeWordAgent/src && ./wakeWordAgent -e kitt_ai
If all goes well, you should be able to talk to Alexa!
- Make sure the device ID is same as you used while registering the device in developer.amazon.com
- Run generate.sh again to generate key/value pairs
- Go back to starting Alexa service step
- Setup ssh and vnc to access your Pi.
- Disconnect the monitor and keyboard from your Pi.