Alexa is Amazon’s voice assistant, and it has recently been released in the UK, so why would you want to run it on the Raspberry Pi, cost! For only £30, you can make an Amazon Echo, instead of spending £150.

Step 1: Setting up the Pi.

I will not talk about how to set up the Pi from the very start in this article, there are many online if you need help.
Whether you decide to ssh into the Pi or use it with a monitor, that is your choice. However you decide to access your Pi, we now need to open the terminal.
Run the command:
sudo ifconfig
and note down your IPv4 address. You will need this for later.

The Raspberry Pi should have Git pre-installed, but to be sure, run the command:
sudo apt-get install git
When that has finished, type:
cd Downloads
To install the Alexa voice service onto the Pi, we need to type:
git clone https://github.com/TechScoutOnline/AlexaPi
We need to go to the folder for the files we just downloaded:
cd AlexaPi/

The hardware needed for the Voice service to work is a speaker and a microphone, the speaker can run through HDMI if you have a TV plugged in. If not you can connect a speaker to the 3.5mm headphone jack on the Pi. The microphone can be a USB microphone or a microphone enabled webcam. Plug both the speaker and microphone in.

We also need to plug in a button into the Pi, that you press to activate Alexa. You will need a push button, breadboard, and two Arduino jumper wires.

Leave the Pi as it is, for now, we will come back to it later.

Putty - Raspberry Pi SSH

Putty – Raspberry Pi SSH

Step 2: Setting up the Alexa Voice Service.

To begin this project, you need to sign up for a free Amazon Developer account.
Once you are logged in, click on the Alexa tab, at the top of the page.
This will give you two options, click on the Alexa Voice Service ‘Get Started’ button.

You should now see a ‘Register a Product Type’ button. Click on the down arrow and select ‘Device’, as you are registering your Pi.
You need to enter a Device ID and a Display Name, call these the same thing for ease. You can enter any name, but I would recommend ‘AlexaPi’ for both. (Do not enter the quotation marks into the name).
Click Next.

amzndevregisterproduct

Under the drop down menu ‘Select Security Profile’, there should only be one option, if you are new to Amazon Developers, ‘ Create a new profile’, select it.
You will now need to enter a Security Profile name and Description. Enter the same name as your Device ID, so ‘AlexaPi’ for both (Again, no quotation marks.)
Click Next.

Next to the General tab, there should be a Web Settings tab, click it. Now click on the Edit button, on the right of the box.
We now need the IP address you noted down earlier.
Next to Allowed origins you need to ‘Add Another’. In the text box that comes up, you need to type http://localhost:5000 add another again, and type in http://(yourIP):5000
After that, you need to click ‘Add Another’ next to Allowed Return URLs and add http://localhost:5000/code. Add Another, and type http://(yourIP):5000/code
Click Next

You don’t need to add an image, so we can skip that.
Under Category, select other.
Enter AlexaPi into the description.
Select Longer than 4 months/TBD for the time for commercialisation.
For how many devices, enter 1.
Click Next

When asked if you want to enable Amazon Music, select No.
Click Submit

You should now be taken back to the main Alexa Voice Service page. Click on your newly made voice service to see all the information you entered. Don’t close the web page because you will need it for the next step.

Step 3: Setting up the Alexa Voice Service on the Raspberry Pi.

Note: We will be switching back and forwards from the Amazon Developer website and our Pi setup program in this stage.

devalexapiblurred

Back to the Pi now, in the terminal type: sudo ./setup.sh
If it asks you to continue, type Y
We need the Amazon Developer website back up again.
The next thing the setup process will ask you to do is to enter your Product ID. This is the Display Name that you called your Pi, in our case, it is AlexaPi.
Back to the Developer website now, and we need to click on the Security Profile tab on the left-hand side of the page.
Back to the Pi, and it will ask you for your Security Profile Description, which is AlexaPi in our case.
The next few steps will ask you for your Security Profile ID, Client ID, and Client Secret, all of which you can copy and paste from the Developer website.

Some code will be displayed starting with the word ENGINE. This is normal. To complete the setup process you will now need to go to a web browser, such as Chrome and type in your Pi’s IP address from earlier, for example, (yourIP):5000
You will be taken to the webpage for your Alexa Pi and asked to log in. You will need to do so with the developer account you used to create the Alexa Voice Service with, of it will not work.

The Raspberry Pi terminal will produce some mode code and say ‘You can reboot now’. Don’t reboot for the minute.

You should now be able to enter new commands into the Pi. Enter the command python main.py

Step 4: Play

You should now hear Alexa’s voice say ‘Hello’ through your speaker if you do, CONGRATULATIONS! You have made Alexa work on the Raspberry Pi.

Download the Alexa app from the Play store or App store and sign in with the same Amazon developer account you used with this project.

To ask Alexa something, hold down the button and speak, once you have finished speaking, let go of the button. For example, you could ask, “Alexa, what can you do?” She will then say for you to check your Alexa app for more details.

Enjoy playing with your £35 Amazon Alexa, if you have any problems please let me know in the comments below. I will try to help as much as I can.

 

A massive thanks to Raspberry Pi for allowing this article to happen!

SHARE
Previous articleRed Dead Redemption 2 Trailer
Next articleOnePlus 3T – Bigger Specs Bigger Price
I am the owner of Tech As It Happens! I have a passion for all things technology and love the fact that it is an ever changing industry with something new to learn every day. I am also an Android user.

LEAVE A REPLY

Please enter your comment!
Please enter your name here