The Simplest Way To Build A Raspberry Pi-Powered Amazon Echo

The Simplest Way To Build A Raspberry Pi-Powered Amazon Echo

A while back we detailed how to make your own Amazon Echo device using a Raspberry Pi, but if anything went wrong with it, you’d have to manually reboot the whole thing. It was a pain in the butt. Now, there’s an easier way to make your own Echo.

[referenced url=”https://www.lifehacker.com.au/2016/10/how-to-build-your-own-amazon-echo-with-a-raspberry-pi/” thumb=”https://i.kinja-img.com/gawker-media/image/upload/t_ku-large/wsckpi7k1j8upgcnp1sq.jpg” title=”How To Build Your Own Amazon Echo With A Raspberry Pi” excerpt=”The Amazon Echo is useful to have around the home. It can play podcasts, take reminders and notes, tell you the length of your commute, even control other appliances in your house. But it’s unavailable in Australia, and importing it is an expensive proposition if you’re not sure you’ll use it. Good news though, you can make a fully-functional one using a Raspberry Pi.”]

What exactly is different about this version? First off, the end result is basically the same: You can activate your DIY Echo by saying the wake word “Alexa”, and the device works just like a real Echo.

The installation process here is different though. Instead of using Amazon’s official resources, we’ll use a GitHub project called Alexa Pi. This installs the exact same Alexa voice service that Amazon uses on the Echo onto your Raspberry Pi. With this version of the project, if something goes wrong, the Alexa service will start automatically when you restart your Raspberry Pi. This is much better than the previous project that requires you to restart the service manually by opening three different Terminal windows. Beyond that, this method also supports other development boards, like the Orange Pi and CHIP.

Obviously this isn’t necessarily a cheap system, but it is fully customisable and a great project if you already have the materials sitting around. With that, let’s get to it.

What You Need

The Simplest Way To Build A Raspberry Pi-Powered Amazon Echo

As you’d expect, you’ll need a Raspberry Pi alongside a handful of parts:

  • A Raspberry Pi 3 (recommended), Raspberry Pi Zero W or Raspberry Pi 2 (you’ll also need a USB Wi-Fi adaptor with the Model 2) with Raspbian installed and Wi-Fi set up. If you haven’t installed Raspbian before, our guide covers everything you need to know. While I’m going to concentrate on installing this on the Raspberry Pi, a number of other devices are supported. You can find a whole list here. I ran the installation on a CHIP as well just out of curiosity and it worked fine.
  • A MicroUSB power cable.
  • An 8GB MicroSD card.
  • A USB microphone (I used this cheap mic, but pretty much any USB mic seems to work. The PlayStation Eye seems to work especially well if you’re looking for a slight upgrade.) If you’re using the Raspberry Pi Zero W you’ll also need a MicroUSB-USB adaptor.
  • Speakers (any powered speaker does the job, I decided to use a UE Mini Boom because I already owned it and even when it’s plugged into the Pi, it still works as a Bluetooth speaker).
  • A keyboard and mouse for setup (or use SSH, Adafruit’s Pi Finder makes this project much easier to do from your main computer because you can copy and paste the longer commands).

Now that you have everything gathered up, connected and plugged in, let’s build this sucker.

Step One: Register for a Free Amazon Developer Account

The Simplest Way To Build A Raspberry Pi-Powered Amazon Echo

Before you do anything, you’ll need to register for a free Amazon Developer Account, then create a profile for your DIY Echo. If you’ve already done this because you made the previous version of the DIY Echo, note that sections 10-13 are slightly different, so you’ll want to change those details. Otherwise, this is pretty straightforward even though it takes a lot of clicks:

  1. Log into your Amazon Developer Account.
  2. Click on the Alexa Tab.
  3. Click Register a Product Type > Device.
  4. Name your device type and display name (I arbitrarily chose “Pi2” for both, though you can enter pretty much whatever you want here), then click Next.
  5. On the Security Profile screen, click “Create new profile”.
  6. Under the General tab, next to “Security Profile Name” 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 Origins, click “Add Another” and type in: http://localhost:5050.
  10. Click “Add Another”, then type in http://your.raspberrypi.ip.address:5050 but replace with your.raspberrypi.ip.address with your Raspberry Pi’s IP address. 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 type in: http://localhost:5050/code 
  12. Click “Add Another” and add in http://your.raspberrypi.ip.address:5050/code once again replacing your.raspberrypi.ip.address with your own info. Click Next when you’re done.
  13. The Device Details tab is next. It doesn’t matter much what you enter here. Pick a category, write a description, pick an expected timeline, and enter a 0 on the form next to how many devices you plan on using this on. Click Next.
  14. Finally, you can choose to add in Amazon Music here. This does not work on the Pi powered device, so leave it checked as “No”. Click Save.

Now you have an Amazon Developer Account and you’ve created a profile for your Pi-powered Echo. It’s time to head over to the Raspberry Pi and get Alexa working.

Step Two: Install Git and AlexaPi

The Simplest Way To Build A Raspberry Pi-Powered Amazon Echo

Next up, you’ll need to fire up Terminal on your Raspberry Pi because we’re going to do the entirety of this project in the command line. Before you start the installation you need to update and install a couple things:

  1. Type in sudo apt-get install update and press Enter to make sure your version of Raspbian is up to date. Let it do its thing here.
  2. Type in sudo apt-get install git and press Enter to install Git. Again, let it do its thing.
  3. Type in cd /opt and press Enter to change the directory.
  4. Finally, type in 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 its thing.

That’s it for the downloading portion, onward to actually installing it.

Step Three: Run the AlexaPi Installation Script

The Simplest Way To Build A Raspberry Pi-Powered Amazon Echo

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

  1. Type in sudo ./AlexaPi/src/scripts/setup.sh and press Enter.
  2. You’ll be asked a series of questions. If you’re using the Raspberry Pi, just press Enter for both the operating system and device prompts. The last question asks if you want to add AirPlay support. If you have an iOS device, this makes it so you can easily stream music from your iPhone to your DIY Echo over Airplay. The script will then download a bunch of software for the next five to 10 minutes, so go ahead and relax for a bit.
  3. Eventually, you’ll be asked to enter in your Amazon developer information. Type in the Device Type ID and Security Profile Description you made way back in step one (we used AlexaPi). Next, you’ll need to enter in all those long, complicated numbers for your Profile ID, Client ID and Client Secret.
  4. Finally, the last thing you need to do is authorise your device. You only need to do this once. Head back to your main computer and open up a web browser. Than type in http://your.raspberrypi.ip.address:5050 replacing your.raspberryi.ip.address with your Raspberry Pi’s IP address from earlier. You’ll then need to log into your Amazon account. After that, you’ll see an authorisation token.

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

Go ahead and try it, say “Alexa” into the mic, and it should reply back with a “Yes?” If it isn’t working, you can type in sudo systemctl status AlexaPi.service and press Enter to check the status. Alexa will start up automatically when you reboot your device or if the power goes out for some reason, so you shouldn’t ever have to think about it again.


The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments