Alexa Pi: a Homemade Amazon Echo
by mrblank5 in Circuits > Raspberry Pi
27844 Views, 161 Favorites, 0 Comments
Alexa Pi: a Homemade Amazon Echo
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
What Is an Alexa Pi?
Things You Will Need
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
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.
Setting Up Your Amazon Development Account
Go to https://devloper.amazon.com
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
Downloading the Source Code
First go into terminal and type "sudo apt-get update"
When that is completed type in "sudo git clone https://github.com/alexa/alexa-avs-sample-app.git
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 automated_install.sh"
And put in your client Id, client secret, and product id from the Amazon developer account.
Then type sudo bash automated_install.sh
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
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
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 https://github.com/njh/perl-net-sdp.git" 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 https://github.com/hendrikw82/shairport.git" and press Enter.
Type in cd shairport and press Enter.
Type in Make and press Enter.
Type in ./shairport.pl -a AlexaPi and press Enter.
Now you will be able to stream music to your Alexa pi
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.
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.
https://www.alexaskillstore.com/
https://www.cnet.com/how-to/the-complete-list-of-a...
https://www.reddit.com/r/amazonecho/comments/31oj8...
Future Stuff
Controlling appliances such as lights, fans, locks, and possibly 3D printers.
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