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+.

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.

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).

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

Here select “Device with Alexa built-in“

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


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

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

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

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.
1 2 | 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.
1 | nano /home/pi/.asoundrc |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | pcm.!default { type asym capture.pcm "mic" playback.pcm "speaker" } pcm.mic { type plug slave { pcm "hw:<card number>,<device number>" } } pcm.speaker { type plug slave { pcm "hw:<card number>,<device number>" } } |
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.

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

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.

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.
1 2 3 4 5 6 | sudo apt-get update sudo apt-get upgrade wget https://raw.githubusercontent.com/alexa/avs-device-sdk/master/tools/Install/setup.sh \ wget https://raw.githubusercontent.com/alexa/avs-device-sdk/master/tools/Install/genConfig.sh \ wget https://raw.githubusercontent.com/alexa/avs-device-sdk/master/tools/Install/pi.sh sudo bash setup.sh config.json [-s 1234] |
Now you will be asked to agree the terms and condition inside terminal. Just Type “AGREE” there.

After installation completes, you will see this screen.

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.
1 | sudo bash startsample.sh |
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.


After entering the code click on Allow.

At last registration successful will show.

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

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”.

If you see “Alexa is Idle” then you have successfully installed Alexa on Raspberry Pi 3B+
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.
1 2 3 | #!/bin/bash cd "/home/pi/alexa/build/SampleApp/src" ./SampleApp "/home/pi/alexa/build/Integration/AlexaClientSDKConfig.json" "/home/pi/alexa/third-party/alexa-rpi/models" DEBUG9 |
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“

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.
1 | crontab -e |
After this add the following line in last line.
1 | @reboot bash /home/pi/Desktop/alexa.sh |
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+