Amazon Alexa Assistant on Raspberry Pi 3B Plus

In this post, I will show you how to make a Raspberry Pi-powered free Amazon Alexa Assistant device. After making this you will not need to buy any smart speakers like Amazon echo because here we will use our old speakers. If you want to make Google Assistant powered Virtual Assistant with your Raspberry Pi 3B then follow this post.

Raspberry Pi is a single board computer which 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.
This assistant is very handy for performing day to day tasks like alarm, reminders, news, sports update etc.

Google Home Assistant on Raspberry Pi 3B Plus

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

Install Raspbian OS

First of all, 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

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

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

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.

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.

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

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.

sudo apt-get update
sudo apt-get upgrade
wget \
wget \
sudo bash config.json [-s 1234]

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.

sudo bash

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


If you see “Alexa is Idle” then you have successfully Alexa assistant on Raspberry Pi.

Create Desktop Shortcut

To create a desktop shortcut, just create a new file & name it ““. Now just copy and paste the following and save that file.

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 “” 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 assistant on startup, we have to add this file into crontab. To do this first run the following command.

 crontab -e

After this add the following line in last line.

@reboot bash /home/pi/Desktop/

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.


Google Home Assistant on Raspberry Pi 3B Plus

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


  1. i also in same problem, at last it shows me an error: Failed to create to SampleApplication

    I attached my mic with sound adapter which have 3.5mm audio inport for mic.
    I also use same system that you have.

    what should i do ?

Comment Box