Introduction: How to Make an Amazon Echo With a Raspberry Pi

So, you want a new project to work on with your Pi. Maybe you have always wanted an Amazon Echo, but wanted to try it out before buying the actual thing. Or, maybe you just are looking for a fun new project to work on! Regardless, this project is easy, fun, and in the end you will have a fully functioning "PiLexa"!

There are a few pre-requisites before you get started.

Materials Required:

  • A Raspberry Pi (Pi 3 is preferred) with Raspbian installed. (If you do not have this installed, there are many guides out there in order to configure your Pi with that UI).
  • Amazon Account for the Alexa application.
  • MicroUSB power cable
  • 8GB MicroSD card
  • USB Microphone
  • Aux Speakers
  • Keyboard, mouse for setup

Step 1: Register/log Into Your Amazon Developer Account

The first step into integrating your Pi into a functional Alexa is to get your own customized Echo software from the official Amazon Developer website. Registration is easy if you already have an Amazon account. Just follow each of the steps until you get to the dashboard.

Step 2: Click on the Alexa Tab.

Step 3: Click on "Get Started" Under the Alexa Voice Service

Step 4: Click on Create Product.

Step 5: Fill Out Page As Shown.

Make sure to click on "Next" when complete. The details are not very critical, but copying it down word-for-word is probably the easiest option.

Step 6: Creating a New Amazon Alexa Profile for the Pi

Once you click on "Create New Profile", you will be asked to input a Security Profile Name and Description. Fill it in any way you would like, or just copy what's in the picture above. Next, under "Allowed Origins, type:

http://localhost:5050

and click "Add". Then, add another Allowed origin but this time type:

http://your.raspberrypi.ip.address:5050

Obviously, you're gonna replace the "your.raspberrypi.ip.address" with your actual Raspberry Pi IP address. To find this, go onto your Pi in the Terminal app and type:

sudo ifconfig

Then, under where it says wlan0:, the first IP probably starting with 192.168 or 10.1. will be what you put in for your.raspberrypi.ip.address.

Then, where it says "Allowed Return URLs", type in:

http://localhost:5050/code

Then click "Add" and then type in:

http://your.raspberrypi.ip.address:5050/code

And you obviously replace your.raspberrypi.ip.address with what you put before.

After, click the "I agree" checkbox and then click "Finish".

Step 7: Install Git and the AlexaPi OS

This is where you must use Raspbian to implement the custom OS you just created. This is as easy as just copying down some lines of code and the custom ID's that are involved with the Alexa product you just created.

Begin by typing:

sudo apt-get install update

and pressing "Enter" to ensure your Pi is up to date. Then type:

sudo apt-get install git

and "Enter" to install Git. After, type:

cd/opt

and "Enter" to have the terminal navigate to the opt folder. From there, finally type in

sudo git clone https://github.com/alexa-pi/AlexaPi.git

for the Terminal to replicate the AlexaPi GitHub repository. Wait for this to download. Then to move into the next step, type:

sudo ./AlexaPi/src/scripts/setup.sh

and press "Enter".

Step 8: Installing the AlexaPi Software

If you have gotten this far, you now are running the installation script from the repository. Since you are using the RaspberryPi, just press "Enter" when prompted for "your OS". Then, specify that you are using a Pi by typing

raspberrypi

when it says "your device". Keep following the prompts and give the necessary info from your Amazon Developer page under the profile you recently created. To make it easier, just navigate to "Apps and Services" on the site, then click "Security Profiles". Once you are through tediously copying each unique ID, it will install the config files and prepare itself to be authorized by Amazon.

Step 9: Authorize Your Device and You Are Ready to Go!

The final step is to authorize your Pi with Amazon. To do this, use a separate computer and open a web browser. Then type:

http://your.raspberrypi.ip.address:5050

obviously replacing your.raspberrypi.ip.address with the one your device is associated with. Click "Authorize" and you should be good to go!

Restart your Pi for it to be initialized or type:

sudo systemctl start AlexaPi.service

to start it and check the status of the app. Enjoy your new Amazon Al-I mean, PiLexa!