Family Encyclopedia >> Electronics

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

In today's smart homes and offices, voice assistants streamline daily tasks. While off-the-shelf devices like Amazon Echo are popular, crafting your own delivers unmatched customization. Drawing from hands-on experience with Amazon's Alexa Voice Service (AVS), this guide walks you through building a fully functional Echo using a Raspberry Pi.

Contents

Materials

To complete this project, gather these essentials:

  • Raspberry Pi 3 or Pi 2 Model B with Micro-USB power cable
  • Micro SD card (8GB minimum) – Use NOOBS for easy OS setup; preloaded cards simplify the process
  • Mini USB 2.0 microphone
  • External speaker with 3.5mm audio cable
  • USB keyboard, mouse, and HDMI monitor
  • Internet connection (Ethernet or WiFi) – Pi 2 requires a WiFi adapter; Pi 3 has built-in WiFi

Sign Up for an Amazon Developer Account

Create a free Amazon Developer account here. Review and accept the AVS terms and agreements.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Accept the Application Distribution Agreement.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Indicate if you plan to monetize apps.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Create Your Device on Amazon Developer

Log in and navigate to "Alexa Voice Service." Note your Product ID, Client ID, and Client Secret – you'll need them later.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Welcome screen appears next.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Product setup steps:

  1. Name your device.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

  1. Enter a Product ID (no spaces/special characters). Save it securely.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

  1. Select "Alexa-enabled device."

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

  1. Yes to companion app.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

  1. Choose "Wireless Speakers."
  2. Description: "Raspberry Pi project on Github."
  3. Check "Touch Initiation" and "Handsfree."

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

  1. Skip image upload.
  2. No to commercial/children's products.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Click "Next."

Create Your Security Profile

Set up a Login with Amazon (LWA) profile for secure authentication.

  1. Click "Create New Profile."

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

  1. Name: e.g., "Alexa Security Profile."

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

  1. Description: e.g., "Alexa Security Profile Description."

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

  1. Click "Next." Note generated Client ID and Secret.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

  1. Add Allowed Origins: "https://localhost:3000" then "https://localhost:3000."

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

  1. Allowed Return URLs: "https://localhost:3000/authresponse" and "https://localhost:3000/authresponse."

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Click "Finish."

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Clone the Alexa Sample App

  1. Open Terminal.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

  1. Run:
cd Desktop
git clone https://github.com/alexa/alexa-avs-sample-app.git

Update the Installation Script with Your Credentials

Edit automated_install.sh with your Product ID, Client ID, and Client Secret.

  1. Run:
cd ~/Desktop/alexa-avs-sample-app
nano automated_install.sh
  1. Navigate and replace placeholders.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

ProductID="Your Device Name"
ClientID="amzn.xxxxx.xxxxxxxxx"
ClientSecret="4e8cb14xxxxxxxxxxxxxxxxxxxxxxxxxxxxx6b4f9"
  1. Ctrl+X, Y, Enter to save/exit.

Run the Installation Script

cd ~/Desktop/alexa-avs-sample-app
./automated_install.sh

Answer prompts confirming Amazon setup. Installation takes ~30 minutes.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Success looks like this:

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

The Three Terminals

Run these in separate terminals, in order. Install npm or mvn if missing (links in notes).

Terminal 1

Runs the authorization web service.

cd ~/Desktop/alexa-avs-sample-app/samples
cd companionService && npm start

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Keep open; listens on port 3000.

Terminal 2

Handles AVS communication.

cd ~/Desktop/alexa-avs-sample-app/samples
cd javaclient && mvn exec:exec

Approve device registration. Ignore security warnings; log in with developer credentials and grant permissions.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Confirm in dialog.

Build Your Own Amazon Echo with Raspberry Pi: Expert DIY Guide

Terminal 3

Wake word engine (optional for voice activation).

Sensory:

cd ~/Desktop/alexa-avs-sample-app/samples
cd wakeWordAgent/src && ./wakeWordAgent -e sensory

Or KITT.AI:

cd ~/Desktop/alexa-avs-sample-app/samples
cd wakeWordAgent/src && ./wakeWordAgent -e kitt_ai

Test It

Say "Alexa" (wait for beep), then "What time is it?" If it responds, success! Explore more skills on Amazon's Alexa site. Your DIY Echo matches commercial capabilities.