Alexa Pi: a Homemade Amazon Echo





Introduction: Alexa Pi: a Homemade Amazon Echo

About: Trombonist, Bassist, Guitarist, Drummer, Future engineer.

Do you want a cool, useful, and easy to do project that can be completed in a weekend? Well then this is the project for you! In this tutorial I will be guiding you on how to make your very own Alexa Pi

Step 1: What Is an Alexa Pi?

The Alexa Pi project is a raspberry pi that is running amazons "Alexa voice services" and a wake word agent service to make a (nearly) fully functioning Amazon Echo for less than $50. The reason I say nearly is because it does not have the capability to use Amazon Music, but there are other alternatives to use for that such as airplaying your music to it.

Step 2: Things You Will Need

1. A Raspberry Pi 3(raspberry pi 2 will work but I recommend the Pi 3 because it is a lot faster)
2. Speaker that you can plug into the pi's audio jack
3. USB microphone(I'm using a PlayStation eye but I found that a USB webcam with a microphone also works)
4. Micro USB for power
5. Heat sinks
6. 8gb micro sd card

Step 3: Setting Up Your Pi

The first thing we will need to do is set up our Pi with raspbian. For this build you will need to download an image of raspbian Jessie(which you can get at this link: )
Once you have downloaded the image you will need to flash the micro SD card. To do this follow this tutorial on the raspberry pi website:

Once you have flashed your sd card eject it and put it in your Pi and power it up. Once the raspberry pi has booted up and you are on the desktop you are going to need to connect the Pi to your wireless network.
When you have connect to your wireless network go to preferences and click on audio then click select controls and select pcm. Then click on the top bar and click on your microphone and click on select controls and click on microphone.

Step 4: Setting Up Your Amazon Development Account

Go to
Then create/login to your Amazon developers account. Click on the Alexa tab, then click register an new product and check off device. Then set your device type and name( I chose alexapi for both) Then Click Next.
On the Security Profile screen, slick “Create new profile.”
Under the General tab, next to “Security Profile Name” name your profile. Do the same for the description. Click Next.
Make a note of the Product ID, Client ID, and Client Secret that the site generates for you.
Click the Web Settings tab, then click the Edit button next to the profile dropdown.
Next to Allowed Origins, click, “Add Another” and type in: https://localhost:3000.
Next to Allowed Return URLs, click “Add Another” and type in: https://localhost:3000/authresponse Click Next when you’re done.
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.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 created your account we can move on to the next step

Step 5: Downloading the Source Code

First go into terminal and type "sudo apt-get update"
When that is completed type in "sudo git clone
This part is when you will want to ssh to your pi so that you can easily put in your developer info without any mistakes.
When that is done type in "cd Desktop/alexa-avs-sample-app"
Then type "Sudo nano"
And put in your client Id, client secret, and product id from the Amazon developer account.
Then type sudo bash
This can take anywhere from 30 mins to 1 and a half hours to finish and if it asks if you want to replace any thing just say yes

Step 6: Running the Alexa Program

For this we will need to open three separate terminal windows.
In the first one type in "cd Desktop/alexa-avs-sample-app/samples"
Then type "cd companionService && npm start"

In the second window type in "cd Desktop/alexa-avs-sample-app/samples"
Then type "cd javaclient && mvn exec:exec"
When the box asking you is you want to open the link in your browser click yes. After you get the window saying your connection isn't safe click on advanced options and click continue to URL. Then fill in your credentials and press ok and wait until it says device tokens ready. Then go back to the java window and press ok and you should see you token in the box.

Now in our third and final terminal window we are going to run our wake word agent. There are two agents but only one works. So what we are going to do is type in "cd Desktop/alexa-avs-sample-app/samples"
Then type in "cd wakeWordAgent/src && ./wakeWordAgent -e sensory"
Now your Alexa Pi should be up and running

Step 7: Setting Up Your Pi for Music AirPlay

Type in "sudo apt-get install git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils libmodule-build-perl" and press Enter. This installs different software you’ll need.

Press Y when prompted and wait for everything to download and install.

Type in "git clone" and press Enter. This is required for the newest version of AirPlay’s software. The next few commands build and install this software.

Type in "cd perl-net-sdp" and press Enter.

Type in "perl Build.PL" and press Enter.

Type in "sudo ./Build" and press Enter.

Type in "sudo ./Build test" and press Enter.

Type in" sudo ./Build install" and press Enter.

Type in CD .. and press Enter.

Now you’ll grab shairport, the DIY Airport software. Type in "git clone" and press Enter.

Type in cd shairport and press Enter.

Type in Make and press Enter.

Type in ./ -a AlexaPi and press Enter.

Now you will be able to stream music to your Alexa pi

Step 8: PS3 Eye Microphone Problems

so i had so trouble setting up my PS3 eye microphone with the raspberry pi but i ended up going to these 2 websites for help on how to set it up. I'm not great at explaining what i did(in fact i'm not sure what i did) but here are the 2 websites to look at if you are using the PS3 eye as your microphone.

Step 9: Congratulations You Now Have a Fully Function Alexa!

Congrats! you made it through. To activate your Alexa all you have to do is say "Alexa" and wait for a ding noise. Now At this point you might want to know what you can do with your alexa pi, so here are a few links that will help you with your question.

Step 10: Future Stuff

Releasing a script for download so that the Alexa will automatically boot after loss of power.

Controlling appliances such as lights, fans, locks, and possibly 3D printers.

Step 11: Feedback

Do you have any feed back you would like to share for this instructable? i'd like to know what i can improve. ex. did the alexa pi work for you, were there pictures i could have added? that kind of thing, feel free to post it in the comments section. Thanks



    • Water Contest

      Water Contest
    • Clocks Contest

      Clocks Contest
    • Oil Contest

      Oil Contest

    27 Discussions


    4 months ago

    did you get the auto start on boot script working yet?

    These instructions were very simple to follow thank you! For some reason I kept getting an error when running "npm start" after hours of searching I found that all I needed to do was use sudo... same with the "mvn exec:exce". So if anyone else is getting an error, try sudo first.

    Thanks for the help!

    Can you tell me the command to open and edit the ALSA config? I tried to follow what was done in the link you recommended, but I could not find the .asoundrc file.

    Sorry my Linux skills are a little basic...

    1 reply

    It should be sudo nano /etc/.asoundrc if anything is in the file delete it and paste in the stuff from earlier. If that doesn't work tell me and I'll check my commands and get back to you

    I really want to get my ps3 eye working for this. can you please try to remember what you did! I'm stuck....

    2 replies

    Just use the second link and past it into your ALSA config. Delete evrey thing else in it and just past that. Reply if it worked or not. I'd don't think the first link actually did anything

    Paste this into .asoundrc


    1 year ago

    I got it working, have you developed the restart auto wake up script yet? Also, when I am installing Shairpoint, I enter "perl Build.PL" & it errors out. it says it is missing 2 files. Makefile.PL & META.yml. I can do most of the rest OK, but when I try to launch it it fails. Jay

    1 reply

    I'm not really sure. Try re installing, I haven't used that feature in a while because I got some nice Sonos speakers which can be controlled with the pi. Hope it works out, I'm glad you got the Alexa working!


    1 year ago

    what are you using to stream music then???

    The bearer token isn't showing up. Also, my DSN says 123456789.

    1 reply

    first question: did you get the amazon error page or were you able to put in your credentials? you might have put in your developer details in incorrectly, i suggest that you repeat step 5 but ssh to your raspberry pi. this way you can copy and paste your developer details without the chance of messing up.

    I'm getting a compile error from GPIOWakeWordEngine.cpp that wiringPi.h is not found. Any idea how to fix? This is on an RPI3.

    4 replies

    Figured it out, needed to load the wiringpi package using apt-get then it compiled correctly. Now I have to wait for Amazon to fix their side as it's giving an error when I do the second launcher and try to authorize the device.

    The error is with the developer account and you might need to set up another device and try again. I came across this problem and that's what I tried but I'm not sure. If you have any more questions look up Alexa Pi and there are multiple github forums where people can answer your questions.

    I know in the instructable it says only one wake word agent works but I have since figured out that they both work and I was doing something wrong. Try cd Desktop/Alexa-avs-sample-app/samples
    Then do cd wakeWordAgent/arc && ./wakeWordAgent -e kitt_ai

    I'll be home in an hour or so and I'll check my files and if you're still having the problem I'll post the wiringPi.h file in the Instructables for you to download and put on the Pi. Hope it works out

    at this step

    Then type "cd javaclient && man exec:exec"

    I get a No manual entry for exec:exec. any idea what i could've done wrong

    2 replies

    now i'm thinking its supposed to be mvn exec:exec

    do you have any feed back on this instructable? id like to know what i can improve. ex. did the alexa pi work for you, were there pictures i could have added? that kind of thing