The Easiest Way to Build a Raspberry Pi Based Amazon Echo

A while ago, we covered in detail how to create your own Amazon Echo device using the Raspberry Pi , but if something goes wrong, you’ll have to manually reboot the whole thing. It was a pain in the ass. There is now an easier way to create your own echo.

How exactly is this version different? First, the end result is basically the same: you can activate your DIY Echo by saying the wake-up word “Alexa,” and it will work just like a real Echo .

However, the installation process is different here. Instead of using the official Amazon resources, we will be using a GitHub project called Alexa Pi . This installs the same Alexa voice service that Amazon uses for the Echo to your Raspberry Pi. In this version of the project, if something goes wrong, the Alexa service will start automatically when the Raspberry Pi is restarted. This is much better than the previous project, which requires manually restarting the service by opening three different terminal windows. Apart from this, this method also supports other development boards such as Orange Pi and CHIP .

Obviously this is no cheaper system than something like the Echo Dot , but it’s completely customizable and a great project if you already have the stuff. So let’s get down to business.

What you need

As you’d expect, you’ll need a Raspberry Pi along with a few details:

Now that you have everything assembled, connected and connected, let’s create this suction cup.

Step 1: Register a Free Amazon Developer Account

Before you do anything, you need to register for a free Amazon developer account and then create a profile for your DIY Echo. If you have already done this because you made a previous version of DIY Echo, please note that sections 10-13 are slightly different, so you will want to change those details. Otherwise it’s pretty straightforward, even if it takes a lot of clicks to do it:

  1. Sign in to your Amazon developer account .
  2. Click the Alexa tab.
  3. Click Register Product Type> Device.
  4. Give your device type and display name (I arbitrarily chose “Pi2” for both, although you can enter just about anything you want here), then click Next.
  5. On the Security Profile screen, click Create New Profile.
  6. On the General tab, next to the Security Profile Name field, name your profile. Do the same for the description. Click Next.
  7. Make a note of the Product ID, Client ID, and Client Secret that the site generates for you.
  8. Click the Web Settings tab, then click the Edit button next to the profile dropdown.
  9. Next to Allowed Origin, click Add More and enter: http://localhost:5050 .
  10. Click Add More, then enter http://your.raspberrypi.ip.address:5050 but replace your.raspberrypi.ip.address with the IP address of your Raspberry Pi. You can find your Pi’s IP address using the Pi Finder tool detailed here .
  11. Next to Allowed Return URLs, click Add Another and enter: http://localhost:5050/code
  12. Click Add More and add http://your.raspberrypi.ip.address:5050/code again replacing your.raspberrypi.ip.address your information. When finished, click Next.
  13. Next comes the Device Information tab. It doesn’t matter what you enter here. Choose a category, write a description, choose an expected timeline and enter 0 in the form next to how many devices you plan to use this on. Click Next.
  14. Finally, you can add Amazon Music here. This does not work on a Pi powered device, so leave it checked. Click Save.

You now have an Amazon developer account and have created a profile for your Pi based Echo. It’s time to move on to the Raspberry Pi and get Alexa to work.

Step two: install Git and AlexaPi

Next, you need to launch Terminal on your Raspberry Pi because we’re going to run this entire project on the command line. Before starting the installation, you need to update and install a couple of things:

  1. Type sudo apt-get install update and press Enter to make sure your Raspbian version is up to date. Let him do his job here.
  2. Type sudo apt-get install git and press Enter to install Git. Again, let him do his thing.
  3. Type cd /opt and press Enter to change directory.
  4. Finally, type sudo git clone https://github.com/alexa-pi/AlexaPi.git and press Enter to clone the AlexaPi GitHub repository. Again, give it a second to download and do your thing.

That’s all for the download and then the actual installation.

Step three: run the AlexaPi installation script

Next, you will run the installation script. This automates the installation of everything else you need to get Echo up and running.

  1. Type sudo ./AlexaPi/src/scripts/setup.sh and press Enter.
  2. You will be asked a series of questions. If you are using a Raspberry Pi, simply press Enter to display the operating system and device prompts. The last question asks if you want to add AirPlay support. If you have an iOS device, you can easily stream music from your iPhone to DIY Echo via Airplay. The script will then download a bunch of software over the next 5-10 minutes, so relax a bit.
  3. Eventually, you will be asked to enter your Amazon developer information. Enter the Device Type ID and Security Profile Description that you provided in the first step (we used AlexaPi). Then you will need to enter all these long and complex numbers for your profile id, client id, client secret.
  4. Finally, the last thing you need to do is authorize your device. You only need to do this once. Go back to your main computer and open your web browser. Then enter http://your.raspberrypi.ip.address:5050 replacing your.raspberryi.ip.address with the IP address of your Raspberry Pi obtained earlier. Then you will need to sign in to your Amazon account. After that, you will see the authorization token.

That’s it, the Alexa voice service is now installed on your Raspberry Pi. You just need to start the service. You can simply reboot the device completely, or type sudo systemctl start AlexaPi.service and press Enter to start it.

Try it, say “Alexa” into the microphone and he should answer “Yes?” If it doesn’t work, you can type sudo systemctl status AlexaPi.service and hit Enter to check the status. Alexa will launch automatically when you restart your device or if the power goes out for some reason, so you don’t have to think about it again.

More…

Leave a Reply