Amazon Alexa Raspberry Pi "recipe"

Image

Moderators: Admiral of the Fleet, Vice Admiral

Post Reply
User avatar
0v3rz34l0u5
Posts: 522
Joined: Tue Oct 23, 2018 8:29 pm
Location: Hertfordshire
Contact:
0v3rz34l0u5’s avatar
Loading…

Amazon Alexa Raspberry Pi "recipe"

Post by 0v3rz34l0u5 » Sun Mar 03, 2019 12:46 pm

YOU WILL NEED:
  • A Raspberry Pi 3B+ (a 3B will work too but the 3B+ has better wired and wireless network hardware and is only £2 more expensive)
  • Raspberry Pi Case (this is optional but it'll be tidy with a case and the official case is £6)
  • A Micro USB power supply (you can draw power from another device using a USB to microUSB cable).
  • An 8GB microSD Card (it'll work with cards from 4GB to 32GB)
  • An ethernet cable (and of course a spare port on your router or switch)
  • A keyboard and mouse (for the setup - I use one of these)
  • USB microphone
  • USB speakers or speakers with a 3.5mm jack
  • An Amazon account - if you haven't got one, create one - https://www.amazon.co.uk/ap/register
  • A GitHub account - if you haven't got one, create one - https://github.com/
DISCLAIMER:
This guide was written using a Raspberry Pi 3B+ running Raspbian Stretch with Desktop 13th November 2018.

I do not know whether any 3rd party software is safe. By following the guide below you accept ALL responsibility. I will not be held accountable for any issues that may arise.


One. Download the latest version of Raspian from the Raspberry Pi Foundation.
Download Raspbian Stretch with Desktop from https://www.raspberrypi.org/downloads/raspbian/

Two. "Burn" the image to the SD card using Etcher.
Download from https://www.balena.io/etcher/

Three. Run through the "out of the box" wizard.
Connect power (microUSB), network and a monitor to the Pi and allow it to boot up then follow the "Welcome to Raspberry Pi" wizard.
  1. Set the locale and keyboard language as required
  2. Set the password for user 'pi'
  3. Updating Raspbian

Four. Enable remote GUI access (and do some optional customisations to the desktop)
Go to "Start", Preferences, Raspberry Pi Configuration.
  1. System: Disable Splash Screen.
  2. Interfaces: Enable VNC.

Five. Update the Pi Firmware and Install the relevant packages
Open the Terminal and type (wait for each command to finish before proceeding).

Code: Select all

sudo rpi-update
sudo apt-get update
sudo apt-get upgrade
Six. Create an Amazon Developer account
Go to https://developer.amazon.com/login.html and login using your Amazon account.
  1. Read the terms and conditions. If you do not agree to the terms and conditions, do not click Accept!
Seven. Configure the Raspberry Pi Alexa service
Hover your cursor over the Alexa tab and then click Alexa Voice Service
  1. Click Get Started, Products, Create Product.
  2. Enter Raspberry Pi Alexa as the Product name.
  3. Enter Raspberry_Pi_Alexa as the Product ID.
  4. Select Application with Alexa built-in under Please select your product type and then Yes under Will your device use a companion app?
  5. Select Smart Home as the Product Category
  6. Enter Raspberry Pi Alexa into Brief product description.
  7. Tick Touch-initiated and Hands-Free under How will your users interact with your product?
  8. Select No under Do you intend to distribute this product commercially? No
  9. Click Next.
Eight. Configure an LWA Security Profile
Click CREATE NEW PROFILE
  1. Enter Raspberry Pi Echo as the Security Profile Name.
  2. Enter Raspberry Pi Echo as the Security Profile Description.
  3. Click Next.
  4. Make a note of the Client ID and Client secret. These will be required later.
  5. Add http://localhost:5050, https://localhost:5050, http://ALEXA.DEVICE.IP.ADDRESS:5050 and https://ALEXA.DEVICE.IP.ADDRESS:5050 into Allowed Origins (Don't forget to replace ALEXA.DEVICE.IP.ADDRESS with the device IP!).
  6. Add http://localhost:5050/code, https://localhost:5050/code, http://ALEXA.DEVICE.IP.ADDRESS:5050/code and https://ALEXA.DEVICE.IP.ADDRESS:5050/code into Allowed Return URLS (Don't forget to replace ALEXA.DEVICE.IP.ADDRESS with the device IP!).
  7. Read the terms and conditions. If you do not agree to the terms and conditions, do not tick the box and click Finish!
  8. Click Capabilities
    1. Tick Named Timers and Reminders
    2. Tick Display Cards > Display Cards with Text

Nine. Install the Alexa Voice Service
Open the Terminal and type (wait for each command to finish before proceeding).
IF YOU HAVE ENABLED TWO-FACTOR AUTHENTICATION ON YOUR GITHUB ACCOUNT, THE FOLLOWING WILL NOT WORK UNTIL YOU HAVE DISABLED IT. YOU CAN RE-ENABLE IT ONCE YOU HAVE COMPLETED THIS STEP.

Code: Select all

cd /opt
sudo chown pi
sudo git clone https://github.com/alexa-pi/AlexaPi.git (case sensitive)
sudo ./AlexaPi/src/scripts/setup.sh 
  1. Press enter
  2. Press enter
  3. Enter 1 then press enter (this will run AlexaPi on boot)
  4. Enter y then press enter (this will also install AirPlay functionality)
  5. Enter your Raspberry_Pi_Alexa as Device Type ID
  6. Enter your Security Profile description
  7. Enter your Security Profile ID
  8. Enter your Client ID
  9. Enter your Client Secret
  10. Go to https://ALEXA.DEVICE.IP.ADDRESS:5050 in a web browser on your PC or mac.
  11. Login to your Amazon account.
  12. Click Allow

Code: Select all

sudo reboot
Nine. Test!

References:
https://github.com/alexa-pi/AlexaPi/wiki/Installation
Image

Post Reply