Alexa on Raspberry Pi 3B+ install in 30 Minutes Easily

How to install Alexa on Raspberry Pi 3B+ in 30 Minutes. Installing Alexa on Raspberry Pi 3B+ is very easy and simple. After making this you will not need to buy any smart speakers like Amazon echo because here we will use our old speakers for Alexa on Raspberry Pi 3B+. So lets install Amazon Alexa on Raspberry Pi 3B+.

Amazon Alexa Assistant on Raspberry Pi 3B Plus

Raspberry Pi is a single-board computer that is also an IoT device. Using this you can use a Linux desktop and also do awesome IoT projects. We all know Alexa is a powerful virtual assistant made by Amazon.
Amazon Alexa on Raspberry Pi 3B+ is very handy for performing day to day tasks like alarm, reminders, news, sports update etc.


If you want to make Google Assistant powered Virtual Assistant with your Raspberry Pi 3B then follow this post.

Google Home Assistant on Raspberry Pi 3B Plus

Simultaneously Run Alexa And Google Assistant On Raspberry Pi 3B+

Install Raspbian OS os Raspberry Pi

To use Amazon Alexa on Raspberry Pi 3B+ we have to install the latest Raspbian OS in our Raspberry Pi 3B+. I already a dedicated post for this. Please visit the following post for the guide of Raspbian OS Installation.

How to Install Raspbian OS in Raspberry Pi 3B Plus

Products Need to use Alexa on Raspberry Pi 3B+

Register on Amazon Developer

First of all we have to make a developer account on Amazon developer.

If you have already an account just login. Otherwise, use your email id to create a fresh account & verify email id.

Amazon Alexa Assistant on Raspberry Pi 3B Plus

On registration page give some email id, phone no & address. Do not worry nothing will be verified. Make sure you chose the country right to get local assistant from Alexa.

Device Registration

First select Alexa Voice Services (AVS).

Amazon Alexa Assistant on Raspberry Pi 3B Plus

Now Click on Product & give some product name, ID.

Amazon Alexa Assistant on Raspberry Pi 3B Plus

Here select “Device with Alexa built-in

Amazon Alexa Assistant on Raspberry Pi 3B Plus

The product Category will be Wireless speaker & select other options as shown in the pictures.

device registration amazon alexa
device registration amazon alexa

Now we have to set Security profile. Select Create new profile & give some profile name & description.

security profile amazon developer account

Now click Others devices and give a client name and click generate ID.

security profile amazon developer account

Now Click on Download button to download the JSON File. This file is very important!

security profile amazon developer account

Setting up Speaker & Mic for Alexa on Raspberry Pi 3B+

To setup speaker and mic, first insert your usb mic or sound card. Then run following 2 commands to see the recording & playback device id.

arecord -l
aplay -l

Now note down card no and device no. As I am going to use default 3.5 mm jack so I have to use Card 0 & device 1 which in bcm2835 ALSA.

Now run the following command to set default audio devices.

After editor opens, copy the following text and paste there. Do not forget to replace the card no and device no with your card and device.

In my case mic id is 1,0 and speaker is 0,0. After it, Save it by pressing Ctrl+O & exit it by Ctrl+X.

nano /home/pi/.asoundrc gnu editor  on raspberry pi

Now just run the following command to set the volume, gain of your audio devices.

alsa mixer on raspberry pi

Alexa SDK Installation

To install Amazon Alexa on Raspberry Pi 3B+, first go to File Manager and create a Folder named “alexa” inside your home directory which typically “/home/pi/”.

Now copy the previous downloaded JSON file inside alexa folder.

raspberry pi alexa folder terminal

Now open that folder and press “F4” to open terminal on present directory.

To install AVS SDK run the following commands one by one. Run commands 1 line at a time & in the same order given below.

This tutorial will install google assistant in the “alexa” folder inside the home directory of “pi” user.

Now you will be asked to agree the terms and condition inside terminal. Just Type “AGREE” there.

alexa avs sdk

After installation completes, you will see this screen.

alexa avs sdk

Get Refresh Token

Now we have to grant alexa to control device. For this we have to get a token. To do this type the following command.

Then will see a code and a link. Just open the link in the browser where amazon account is logged in & enter the code. This is like 2 step verification.

amazon refresh token
amazon refresh token

After entering the code click on Allow.

amazon refresh token

At last registration successful will show.

amazon refresh token

If you get the following error during device authorization then you are unlucky like me.

An error occurred when we tried to process your request amazon fix alexa

Simple solution is to clear browser data and create a fresh new amazon developer account with new email ID. I am also became successful on second attempt.

So, after successful authorization you will see device “AUTHORIZED”.

ALEXA DEVICE AUTHORIZATION

If you see “Alexa is Idle” then you have successfully installed Alexa on Raspberry Pi 3B+

Alexa on Raspberry Pi 3B+ install in 30 Minutes Easily

Create Desktop Shortcut

To directly run Alexa on Raspberry Pi 3B+, you have to create a desktop shortcut, just create a new file & name it “alexa.sh“. Now just copy and paste the following and save that file.

After this make the file executable. To do this go to the properties of the “alexa.sh” and make the read, write & executable to “Anyone

alexa desktop shortcut raspberry pi

Now when you double click on the file from desktop and execute it, Alexa Assistant will start. Just say “Alexa” to ask your question.

Start on Boot

To run Alexa on Raspberry Pi 3B+ on startup, we have to add this file into crontab. To do this first run the following command.

After this add the following line in last line.

Now Save it by pressing Ctrl+O & exit it by Ctrl+X.
From now, after every startup of Raspbian OS, Alexa Assistant will start automatically.

To disable automatic startup, just remove the line you added in crontab & you will be done.

httpv://www.youtube.com/watch?v=Z0pPL3U__PU

Google Home Assistant on Raspberry Pi 3B Plus

Simultaneously Run Alexa And Google Assistant On Raspberry Pi 3B+

Share with Friends
0 0 votes
Rating
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments