It must be very exciting to install Alexa on Raspberry pi setup. were we can customize as per our requirements.

With the support of Alexa built-in products with AVS (Alexa voice service), we can make develop our custom products.

Again like other voice assistance service providers like google assistance, Siri, Cortana.

It can automate home, office, or can carry where you go. Voice assistance to check and reply to emails, messages on social sites.

Even cab be connected or embed with Apple Mac OS, Android mobile devices.

It is headless means no need to attache monitor for using it only an internet connection (via wi-fi or Lan), microphone, and speaker are required.

Don’t forget about power source.

Amazon provides full support and documentation for setup Alexa on raspberry pi in easy steps.

Here I’m going to explain simply so that anyone familiar with raspberry will be able to set up without complications.

Again here using video and images to explain it in a better way.

How to install Alexa on Raspberry Pi

Firstly need to setup raspberry pi follow the link “what is raspberry pi “.

In the above link step by step guide to setup hardware and noobs for rapberian os installation.

Following video explain how to setup raspberry pi.

Rest is needed to attach USB microphone and 3.5 mm jack speaker as input and output devices.

alexa-on-raspberry-pi-hardware-setup

List of some raspberry pi supported mic

Brand

Model

Status

Type

Notes

Blue

Snowball iCE

Working

Microphone

Creative

VF0790

Working

Mic and camera

Google

AIY v1

Working

Mic and speaker

Jabra

Speak 410

not function 

Mic and speaker

Premium microphone and speaker combination

Logitech

C270

Working

Mic and camera

Logitech

 C525

Working

Mic and camera

Logitech

Webcam Pro 9000

Working

Mic and camera

Logitech

Z50

Working

Speaker

Matrix

Voice

Working

Mic array

PlayStation

Eye (PS3 Eye)

Working

Mic and camera

Good for testing

Seeed Studio

Mic Array 2.0

Working

Mic array

Premium microphone array

Once hardware and software basic setup complete. We can move ahead for Alexa on raspberry pi setup.

raspberry-pi-raspbian-desktop

Firstly open a terminal window on raspbian operating system desktop. Then type the following commands.

$ cd /home/pi/

$ sudo apt-get update

After updating all packages up to date now ready to integrate AVS (Alexa voice service).

How to integrate Alexa with Raspberry Pi

Before download and build AVS device SDK needs to register a device and open a developer account.

So that can create a device config file (config.json) that contains client ID and client secrets. Also need to create a security profile.

After doing all these actions refresh the token to authorize to access Alexa.

But first thing first open or create an amazon Alexa developer account.

If you are creating an account first time then need to fill in all the details like first and last name, email and phone number, location, address, etc.

create-amazon-alexa-developer-account

Need to define your role in the team. Because from this account you can work as a developer team.

After create account or log-in and you will see welcome screen.

welcome-screen-alexa-developer-account

Just click on get started then click on products as shown below.

alexa-voice-service-developer-console

Now click on ADD NEW PRODUCT at the right top of the screen. Enter the details to set up Alexa on raspberry pi.

  1. Enter product name AVS Tutorial Project or any name of your choice.
  2. The next option is Product ID .enter ID for your product.
  3. In Product Type select Device with Alexa built-in.
  4. Will your device use a compression app? select No.
  5. The product category selects Other.
  6. In specification provide value like a prototype.
  7. Can write the description of your choice.
  8. select the next option Hand Free.
  9. Skip the next step or upload an image of your choice 142×130 px.
  10. Want to distribute product select No.
  11. The device listed for Alexa business? select No.
  12. Device associated with Alexa IoT core select No.
  13. product for children also selects No.

Now after clicking on the next page will display. Here need to create a security profile for Alexa on raspberry pi.

create-security-profile-alexa-on-raspberry-pi

Click on CREATE NEW PROFILE then type security profile name and description.

Choose Other devices and platforms from the Web – Android/Kindle – iOS – Other devices and platforms from the menu.

Then click on download for downloading the config.json file. Copy jason.config file and paste into home/pi/ directory.

download-and-copy-jason.config-file-into-home-pi

Download the SDK configuration scripts for Alexa On Raspberry Pi

Open /home/pi/ directory in terminal and enter the following commands.

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

Note: Above commands should type carefully because it is case sensitive. In case receive any error then verify the command.

As soon as the download finished again command prompt will appear.

Now need to run setup.sh script from the command prompt with some additional arguments.

Script builds SDK and install dependencies for following functions.

  • Maintain an HTTP/2 connection with AVS.
  • Play Alexa TTS and music.
  • Record audio from the microphone.
  • Store records in a database (persistent storage).

Type the following command and press enter.

cd /home/pi/
sudo bash setup.sh config.json [-s 123456]
terminal-command-for-setup.sh-file-with-arguments

There are two arguments with setup.sh. The first one is config.json file which we create and download earlier. It has device details and security configuration.

The second argument is Device Serial Number which is unique for each instance of SDK. If you don’t supply SDK generate default value 123456.

From here almost halfway is finished to install Alexa on raspberry pi.

agree-to-term-and-conditions

The next screen will display AVS Device SDK Raspberry Pi Term and Agreements. Read it and type AGREE then press the return key.

From this point it takes around twenty minutes to finish.

During installation at some point, SDK setup stops and ask to accept sensory wake word’s term and conditions. Type yes and press return to proceed.

The Wake Word Engine (WWE) Alexa on raspberry pi from sensory compares incoming audio to an onboard model of Alexa wake word.

Also initiates the communication of voice to the server when triggered.

For Prototype Device WWE (wake word engine) is free. But for commercial devices need to buy licenses.

Get refresh token for Alexa on raspberry pi

Once completion message received on the terminal as mentioned in the picture.

completion-alexa-on-raspberry-pi-sdk

In case received any error or process stops then you can start it over. The setup process will install the rest of the SDK packages.

Now run the sample app using the following command.

Before running the command make sure all input/output devices (microphone and speaker) should be attached with raspberry pi.

cd /home/pi/
sudo bash startsample.sh
run-alexa-sample-app

After that Alexa on the raspberry pi is running. All the AVS device SDK installed and credentials loaded.

But the device still needs a refresh token to maintain communication with Alexa voice service.

For the production of Alexa enabled products can use the same Client ID and Product ID.

But each user required a unique refresh token for AVS identification via LWA( login with amazon).

Once the above command starts running then need to scroll upside all the debugging messages and search for authorization code as mention in the image.

authorization-code-refresh-token-for-device

Note down the code which is unique for each device.

Click on ‘https://amazon.com/us/code‘ login via LWA (login with amazon) and register your device by entering this code.

It might take around thirty-second CBLAuthDelegate to successfully get a refresh token from LWA ( Login with Amazon).

amazon-register-device-using-lwa

After punching the code and press continue will ask to allow AWS (Alexa voice service) and Alexa account connection.

Click on allow as shown in the image.

alexa-voice-service-account-connection-allow

At last the success message will come up in new page. walla it’s time to talk with alexa on raspberry pi.

registration-alexa-on-raspberry-pi

Talk with Alexa on raspberry pi

Here now first Alexa based prototype project is ready for testing. Running after few debugging messages you will see the IDLE message.

Which means the device is ready to receive voice commands.

While called Alexa bunch of messages start to scroll on the terminal which indicates device status changed IDLE to Listening mode.

In case I never changed from IDLE to Listening mode then need to verify the microphone is working properly or not?

Sometimes keep mouth close to the microphone started to respond because of less sensitive microphones.

Use wake-word Alexa and will see the status changed to Listening now after wake-word give the command for example “Alexa what is time now”.

After command again status will change it will show in terminal like Thinking then will show speaking when Alexa will start to speak.

  • Say “Alexa”, then ask “What time is it?”
  • Say “Alexa”, then say “Who is Eon Musk?”
  • Say “Alexa”, then say “How do you say friend in Spenish”

Multi turn interaction with Alexa on raspberry pi

If you ask Alexa to set an alarm on 12 then it will ask for am or pm.

While you instruct about am or pm you don’t need to call Alexa at the starting of the phrase again.

This is known as multi turn speech interaction.

Device kits for AVS

Following the device, kits can be used and integrate with our project Alexa on raspberry pi.

General Purpose Audio front end device kits

  • Amazon Alexa Premium Far-Field Voice device Kit
  • Cirrus Logic Voice Capture device Kit
  • DSP Group HDClear 3-Mic device Kit
  • Intel Speech Enabling device Kit
  • Microsemi AcuEdge device Kit
  • Synaptics AudioSmart 4-Mic device Kit
  • Synaptics AudioSmart 2-Mic device Kit
  • XMOS VocalFusion 4-Mic Stereo-AEC device Kit
  • XMOS VocalFusion 4-Mic Mono-AEC device Kit
  • XMOS VocalFusion 2-Mic (XVF3510) device Kit

Smart Speaker and Sound Bar

  • MediaTek MT8516 
  • NXP i.MX 8M
  • Amlogic A113X1 Far-Field
  • Allwinner SoC-Only 3-Mic Far-Field Dev
  • Qualcomm Smart Audio 400 Platform

Headphone / Headset

  • Qualcomm Smart Headset Reference Design
  • Knowles AISonic SmartMic Headset

Some smart home device kits from amazon can be integrated with Alexa on raspberry pi.

  • Espressif ESP32-Vaquita Device Kit
  • NXP i.MX RT MCU AVS Solution
  • Qualcomm Home Hub 100 Device Kit
  • Qualcomm Mesh Networking Device Kit

Set location of alexa on raspberry pi

When we ask Alexa about the weather, she never replies with a proper answer. The reason is Alexa voice service never knows the location of the device.

For setting up device location on AVS (Alexa voice service) follow steps.

  • Open Alexa.amazon.com page in the browser.
  • Scroll down and click on settings.
  • Select the device. It can be identify by product name.
  • By changing zip Code can be set device location.

What can be done with Alexa on raspberry pi

From here you are well familiar with how to set up Alexa on raspberry pi.

More than that now you know how to use it as a product development platform.

You can add more features like when speaking wake word Alexa the LED starts to glow or change its color.

For blind persons instead of light sound can be added. It’s totally up to you how far want to develop your project or product.

For all these things only need to download the related library and put it into /home/pi/ directory.

Importantly don’t forget copy into a related folder. All the library is available on Alexa Sound Library for AVS.

If you wish you can embed Alexa with home appliances, TV, lights, fan, thermostat.

It can be done via gpio pins or even can use wi-fi or Bluetooth on raspberry pi.

Even it will be useful for developing a voice-controlled robot or toy to assist you.

Possible to develop games or toys to play with Alexa’s voice-enabled.

There are so many options (Library, API, SDK) available from Amazon to develop a new product.

But there are some restrictions you need to pay to some extend.

No reverse engineering allowed that means you can not modify. Even can modify up-to their permissible limits.

If you wish to experiment with codes then can try Mycroft Ai. Witch is based on an open-source platform where you can contribute also.

Wish to know how to set up Raspberry pi or want to know what is raspberry pi so that can install Kodi on it as a media center then follow what is raspberry pi.

How do I use Alexa on Raspberry Pi?

First, need to set up Alexa on raspberry pi, and for that first install the Raspbian operating system.
Then register at Amazon Alexa Developer Account.
After registering the need to run the setup process which is ling and explained in detail in the article above.
Between setup will ask for a license key and will verify your device.
After completion ready to go and Alexa is ready for listening to your commands.

Can Alexa control raspberry?

Sure not only Alexa can control raspberry although can control other devices through it.
Only need to program ports like SPI (serial programmable interface) and connect your costume devices.
Or can use the Wi-Fi interface to connect and control IoT devices.

How do I build Amazon Echo on Raspberry Pi?

If it’s a commercial project then Amazon will charge for that otherwise it’s free to use.
First, need to set up Alexa on raspberry pi, and for that first install the Raspbian operating system.
Then register at Amazon Alexa Developer Account.
After registering the need to run the setup process which is ling and explained in detail in the article above.
Between setup will ask for a license key and will verify your device.
After completion ready to go and Alexa is ready for listening to your commands.
And don’t forget about mic and speaker setup along with a good internet connection.

How can I use Amazon echo at home?

It can use the Wi-Fi interface to connect and control IoT devices.
In a simple way, you can operate or turn on and off your devices like lights, fans, TV, etc.
Apart from that all standard computer or cellphone-based functions like phone calls, E-mail, Listening to Music and so on.

What is Alexa and how much does it cost?

Alexa is a speech recognition software that runs on an Amazon server. It cost nothing only we need to pay for a device to access its services.
Usually, start from 25 – 50 Dollars to a few hundred dollars.

What’s the difference between ECHO and Alexa?

Alexa is a speech recognition software that runs on the Amazon server and ECHO is a hardware device makes enables us to access Alexa services from the Amazon server through an internet connection.

Is there a monthly fee for Alexa?

There is no such monthly fee for using Alexa. May be the services like Spotify or others can be chargeable.

What is Alexa and how does it work?

Alexa is a speech recognition software that runs on the Amazon server and accesses its services that need special interface equipment that enable us to access Alexa services from the Amazon server through an internet connection.

Is Alexa always listening?

As much as I know they said Alexa only listen when call wake word. Only after that Alexa listen to your instruction.

This Post Has One Comment

Leave a Reply