Rasberry Pi Alexa
![Capture.PNG](/proxy/?url=https://content.instructables.com/F4P/2WIT/IOFZAGOP/F4P2WITIOFZAGOP.png&filename=Capture.PNG)
This project is meant to turn your $35 computer into a voice assistant with Amazon's Alexa voice service. Like Google Now and Siri, Alexa will answer questions about weather, your schedule, and more. Unfortunately due to the terms of service, you are required to use a button, but it is still a very cool project to complete. I will be using a Python Client from HERE. It shouldn't be to hard to complete, but if you have any questions, feel free to ask in the comments below. Now let's get started! (THIS video may help if you don't understand something; many of the steps are similar.)
What Parts You Need:
- A Raspberry Pi (Any model should work.)(I will be using a model 2)
- Micro SD Card (Recommended 8 gigabytes or more.)
- USB Microphone (Make sure it is compatible with linux.)
- Speaker that connects to Raspberry Pi (Most speakers will work.)(Needs Aux input.)
- Keyboard and Mouse
- HDMI TV or Monitor
- A Button
What Cables You Need
- HDMI Cable
- Micro USB Cable
- Two cables to connect button to Raspberry Pi
- AUX cable
Optional Parts (Make it somewhat portable)
- USB Wifi adapter (Make sure it is compatible with linux.)
- External Battery
Installing NOOBS
![Website.PNG](/proxy/?url=https://content.instructables.com/F7T/6RBI/IOFZAEYR/F7T6RBIIOFZAEYR.png&filename=Website.PNG)
![raspbian.png](/proxy/?url=https://content.instructables.com/F71/S2XQ/IOFZAF1L/F71S2XQIOFZAF1L.png&filename=raspbian.png)
We will be using a version of Jessie called Raspian. NOOBS is the easiest way to install it. Using a computer that has access to the internet:
- Head to the official Rasberry Pi wesite, (Or just click here) and head to the downloads tab. Hit the NOOBS box and download the NON-LITE one.
- Once the download is complete, insert your micro SD card, format it (link to program to format it), and unzip the contents of the zip file you just downloaded onto your formatted SD card.
- Eject the Micro SD card and insert it into the Rasberry Pi.
- Power on the Raspberry Pi, plug it into an HDMI monitor or TV, and go through the setup process of installing Raspian.
- Once you are on the Desktop, (see pictures) move on to the next step.
Changing Permissions.
![IMG_20160520_235044.jpg](/proxy/?url=https://content.instructables.com/FIS/80CF/IOFZAFBZ/FIS80CFIOFZAFBZ.jpg&filename=IMG_20160520_235044.jpg)
![IMG_20160520_235238.jpg](/proxy/?url=https://content.instructables.com/F5V/QJJY/IOFZAFCG/F5VQJJYIOFZAFCG.jpg&filename=IMG_20160520_235238.jpg)
We will be making it much easier to work with the root directory.
- While on the desktop of your raspberry pi, launch terminal.
- Type into the terminal "sudo pcmanfm".
- Click on the root folder.
- Right click inside the application (see pictures), and click "Folder Properties".
- Navigate to the "Permissions" tab and change "View Content" and "Access Content" to Anyone.
- Make sure your Raspberry Pi is connected to the internet.
- You may close the pcmanfm application.
- Move on to the next step.
Installing the Python Client
- Open Terminal and type in "cd /root".
- Then "git clone https://github.com/sammachin/AlexaPi.git" "
- Move on to next step.
Registering As an Amazon Developer.
- Go to developer.amazon.com and create an account.
- Navigate to the Alexa tab and click on the Alexa Voice Service box.
- Navigate to "Register a Product Device>Device" and enter the following:
- Device Type ID = "RaspberryPi"
- Display Name = "RaspberryPi"
- Under the Security Profile Tab, create a new security profile.
- Security Profile Name = "Raspberry Pi"
- Security Profile Description = "RaspberryPi"
- Open another terminal window and enter "Hostname -I" That is your IP address.
- Go to the "Web Settings" and hit edit.
- Add 2 things to the allowed orgins:
- "http:localhost:5000"
- "http: Your IP Address :5000" EXAMPLE "http:123.45.67.8:5000"
- Add 2 things to the allowed return URLs:
- "http:localhost:5000/code"
- "http: Your IP Address :5000/code"
- Continue on with the setup until you get to "How many devices are you planning to commercialize?" and enter 0."
- Finish entering the rest of the information out.
- In the terminal used in the previous step, enter "./setup.sh"
- Use the the information you entered into the Amazon Website and the generated keys from the website to complete the setup in the terminal.
- Move on to last step.
Testing It Out.
![Raspberry-Pi-GPIO-Layout-Model-B-Plus-rotated-2700x900.png](/proxy/?url=https://content.instructables.com/FUQ/1NRQ/IOFZAFZA/FUQ1NRQIOFZAFZA.png&filename=Raspberry-Pi-GPIO-Layout-Model-B-Plus-rotated-2700x900.png)
- You may close out of everything but a terminal window.
- Type "cd /root/AlexaPi"
- Plug in your speaker and microphone.
- Then type "python main.ph" into the terminal.
- You should hear "Hello!"
- Connect a button to pin 17 and a ground pin on the Raspberry Pi and go wild! (Picture shows GPIO pins for model B/B+) Picture of this can be found in AlexaPi folder on Raspberry Pi.
- The voice service should automatically start when you plug in the Rasberry Pi, so you can unplug the monitor, keyboard, and mouse.
- The app for Amazon does work and can be found on the Google Play Store and Apple's App Store for iOS.
- If you liked this project or want to give me constructive criticism, feel free to drop a comment below!
IFTTT
Another cool use of the Alexa Voice Service is through If This Than That. Click Here to check it out! You can set up a custom trigger word and automate the world around you with only your voice.