Introduction: Rasberry Pi Alexa
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)
Step 1: Installing NOOBS
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.
Step 2: Changing Permissions.
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.
Step 3: 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.
Step 4: 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: Your IP Address :5000" EXAMPLE "http:184.108.40.206:5000"
- Add 2 things to the allowed return URLs:
- "http: Your IP Address :5000/code"
Step 5: Testing It Out.
- 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!
Step 6: 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.