Table of Contents
This tip is about the how to Build Amazon Alexa Smart Speaker With a Raspberry Pi. So read this free guide, How to Build Amazon Alexa Smart Speaker With a Raspberry Pi step by step. If you have query related to same article you may contact us.
How to Build Amazon Alexa Smart Speaker With a Raspberry Pi – Guide
Voice-controlled virtual assistants like Apple’s Siri, Google Assistant and Amazon’s Alexa simplify brilliant control home products by speaking basic orders like “Alexa, turn on the lights”. Each of these devices has its features and shortcomings, so choose the one that will work for your needs.
Hardware you will need
Before you start building your DIY Raspberry Pi Alexa, you will need:
Before you start, and if you haven’t already, you’ll need to enable SSH connections to your Raspberry Pi. If you prefer, you can set your Raspberry Pi up using a keyboard, mouse and monitor. You’ll need a microphone, but if you don’t have one, a USB webcam with a microphone will do the same job.
Under normal circumstances, I recommend installing Raspbian Lite to keep resource usage low. The script you need to install Alexa doesn’t install on a standard installation of Raspbian Lite, however. To work around this, install GStreamer, a Linux media framework, to allow installation by running the following via SSH or in a terminal screen:
sudo apt update && sudo apt upgrade sudo apt install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1. 0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-pulseaudio
Create an Amazon Developer Account and Security Profile
Before installing the Alexa software, you will need to create an Amazon developer account. If you have an existing Amazon account, you can log in and register for an Amazon developer account this way. After logging in, go to Alexa in the navigation bar and then Alexa Voice Service. Click Get Started, then Products > Create Product. Give your device a name and product ID. Choose Device with Alexa Built-in and select No for the companion app question. Select Other from the product category drop-down menu and type Raspberry Pi in the box provided below. Give a short description, such as “Sample Raspberry Pi Alexa build”. Choose Touch-initiated and Hands-free for user interactions final. You don’t have to worry about choosing an image. Choose No at four final questions and click Next.
On the next screen, you will need to create an Amazon security profile to link your security data to your Raspberry Pi Alexa. Click Create New Profile. Choose a name and description, similar to mine below. In the next step, choose Other Devices and Platforms, enter a Customer ID name (it can be anything you want), agree to the terms and conditions, and click Generate ID. You will then see a pop up letting you know that your product has been created. Then enable your profile. Go to the Login with Amazon developer page and select your profile from the drop-down menu and click Confirm. Enter a domain like raspberrypi.local in the box provided and click Save.
Download the Amazon Assistants Pi Script
To install Amazon Alexa on your Raspberry Pi easily, you will use a script called Assistants Pi. This provides an easy method for you to install Alexa without having to build the SDK manually.
To get started, you’ll need to install Git to get the necessary files from the script’s developer. Connect to your Raspberry Pi using an SSH client, or if you’re not running your Pi headless, open up a terminal and type:
sudo apt install git
Once Git is installed, clone the necessary files by typing:
git clone https://github.com/shivasiddharth/Assistants-Pi
You will need to make the script files executable. do this by typing
CD /home/pi/Assistants-Pi/scripts/sudo chmod +x installer.sh prep-system.sh service-installer.sh audio-test.sh
Pre-configuration before installation
Before you can run the Pi scripts from the starter wizards before installing Alexa, you will need to install PIP for Python on your Raspberry Pi. Make sure it’s installed with the following:
pip –version
You should receive a response confirming your version. Otherwise, reinstall PIP using apt. If the PIP is installed correctly, your next stage is to run the Assistants Pi staging script, pre-system.sh. Run the following:
sudo /home/pi/Assistant-Pi/scripts/prep-system.sh
This will start installing all necessary packages for you, as well as verifying that Raspbian is up-Up to the present date. Once everything is installed, you will have six options to choose from for your audio and microphone setup. Most people will need to choose USB-MIC-ON-BOARD-JACK, so press 3 and press enter. Choose this option if you are using a USB microphone with a speaker connected to the audio port.
Restart your Raspberry Pi at this stage by typing:
sudo reboot
Once rebooted, verify that the audio configuration is correct by running the following:
sudo /home/pi/Assistants-Pi/scripts/audio-test.sh
This will run a speaker and microphone check to ensure the Raspberry Pi works with both.
Run the install script
Assuming you didn’t have any problems with your microphone or speaker during the audio test, run the following command to install Alexa on your Raspberry Pi:
sudo /home/pi/Assistant-Pi/scripts/installer.sh
You will have the option to install Alexa, Google Home Assistant, or both. The script requires additional steps for Google Assistant to be installed here, so it’s best to skip that. Choose option 2 to install Alexa only. You will need to enter your customer ID. Go back to the Alexa developer portal to find this by clicking on your “product” name. Write down your product ID.
Click your product name, click Security Profile, and click Other Devices and Platforms. Use the Customer ID found here and enter the Product ID before agreeing to the terms and conditions. Type AGREE and hit enter. The script will run during its installation, installing any other necessary packages. This may take some time to complete. You may need to accept one or two licenses; just read and press Y for any confirmation menu.
Final configuration and testing
Once the script has finished installing, you have a final script to run:
sudo /home/pi/Assistants-Pi/scripts/service-installer.sh
Run the following, just to make sure the service is started and activated:
sudo systemctl enable alexa.service sudo systemctl start alexa.service
You will need to register and authorize your Pi. Enter the following:
sudo /home/pi/Pi-Assistants/Alexa/startsample.sh
Final note
I hope you like the guide How to Build Amazon Alexa Smart Speaker With a Raspberry Pi. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.