In this tutorial, we’ll install Alexa Voice Service (AVS) on a Raspberry Pi 4 to essentially “make” our own Alexa speaker. We’ll nickname this project, “AlexaPi.” This project is possible thanks to the Amazon Alexa Voice Service (AVS) SDK. If you have your heart set on an Echo Show on Raspberry Pi (Alexa with a screen), we’ll cover a Raspberry Pi Alexa with a visual interface in a future article. Completing the steps in the article is a prerequisite to the AlexaPi with screen project.
Why Build an Alexa when you could just buy one?
If you don’t already own a Raspberry Pi, it is less expensive to buy an Amazon Echo device. As of this writing, a brand new Echo Dot sells for $24.99 on Amazon’s website which is $10 cheaper than the cheapest Raspberry Pi 4 and that’s not including the cost of other components.
The joy of AlexaPi is not the outcome, but the educational journey. You’ll get a glimpse of how Alexa works behind the scenes, and possibly spark an interest in designing your own custom device with Alexa embedded. Amazon has made this Pi project possible for the purpose of encouraging device manufacturers to embed Alexa in their products.
What is the difference between AlexaPi and Echo devices?
AlexaPi has many of the basic features of an Echo device, but is not intended to be a replacement for purchasing an Echo device. Below are a few of the key similarities and differences between Echo and AlexaPi.
- Music services enabled by default include iHeartRadio, TuneIn, and Audible (for US users, at the time of the writing of this article). According to Amazon, additional Music Service Providers (MSPs) must be requested with “your Amazon point of contact.” Once again, this project was created for hardware manufacturers to embed Alexa in their commercial products.
- Smart Home devices such as TP-Link Kasa, Teckin, Avatar, and more can be controlled via your AlexaPi with the same process as an Echo device.
- Alexa Skills are available on AlexaPi. For example, say, “Alexa open cat food.” This is a skill I wrote that plays the sound of opening a can of cat food.
- Calling & Messaging - At the time of the writing of this article in the US, calling via AlexaPi is not supported.
What You’ll Need
- Raspberry Pi 3 or Raspberry Pi 4
- 16GB (or larger) microSD card (see best Raspberry Pi microSD cards) with a fresh install of Raspberry Pi OS
- Power supply/Keyboard/Mouse/Monitor/HDMI Cable (for your Raspberry Pi)
- USB Microphone
- Speaker with 3.5mm or USB connector. We’ve only tested with a 3.5mm speaker but USB should also work.
Timing: Plan for a minimum of 1 hour to complete this project. The main install step takes 30 minutes to over an hour depending on your Pi model and internet speed.
The majority of this tutorial is based on terminal commands. If you are not familiar with terminal commands on your Raspberry Pi, we highly recommend reviewing 25+ Linux Commands Raspberry Pi Users Need to Know first.
AlexaPi Setup and Install
1. Connect your USB microphone and speaker to your Raspberry Pi.
2. Boot your Raspberry Pi. If you don’t already have a microSD card see our article onhow to set up a Raspberry Pi for the first time or how to do a headless Raspberry Pi install.
3. Launch Chromium browser on your Pi desktop.
4. Create or login to your Amazon developer account at: https://developer.amazon.com/
5. Click on Developer Console in the top right corner.
6. Mouse over Alexa and click Alexa Voice Service.
7. Click MANAGE YOUR PRODUCTS
8. Click ADD NEW PRODUCT.
9. Complete the Product Information form.
- Give your product a name and ID.
- Select Device with Alexa built-in for product type.
- Select No for companion app.
- Select Other for Product Category and enter your value in the text field.
- Enter your Brief product description.
- Select Hands-free for “How will end users interact with your product?”
- Uploading an image is optional.
- Select No for commercial distribution, Alexa for Business, AWS IoT Core, and children’s product.
- Click Next.
Next, you’ll be prompted to set up your AVS Security profile.
10. Click CREATE NEW PROFILE
11. Enter your profile name and description.
12. Click Next
13. Click Other devices and Platforms in the Platform Information area
14. Enter a Client ID name of your choosing.
15. Click GENERATE ID
16. Click Download and a config.json file will download to your Pi.
17. Check the box for terms and conditions and click Next.
18. Click OK. You’ll be taken back to the product page. You should see the product you just created.
19. On the top right corner of your Raspberry Pi desktop, right click on the speaker icon and select AV Jack.
20. Left click on the same speaker icon and set the volume to 100%.
21. Open your file manager and navigate to your Downloads folder.
22. Move your config.json file from Downloads to pi.
23. Open a Terminal on your Raspberry Pi desktop.
24. Run updates:
udo apt-get update && sudo apt-get upgrade
25. Next, enter the following as one command.
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
26. Next, run the install script
sudo bash setup.sh config.json [-s 1234]
27. Type AGREE and hit Enter (if you agree with AVS Terms and conditions). This step can take 30 minutes to over an hour depending on your Raspberry Pi model and internet speed.
28. During the install process you’ll be prompted to review the license agreement. Press Enter to view the agreement. Press the spacebar to page down through the agreement.
29. If you accept the license agreement, type yes when prompted.
Your build is complete when you see **** Completed Configuration/Build ***
- In some cases, your Raspberry Pi may freeze and/or over heat during installation. If this happens to you, unplug your Raspberry Pi and allow it to cool for at least 5 minutes. Once your Pi has cooled, plug it back in and restart your terminal command sudo bash setup.sh config.json [-s 1234]
- If you get a fatal error: curl/curl.h: No such file or directory that means you need to install curl. In your Terminal enter:
sudo apt-get install libcurl4-openssl-devsudo apt-get install libcurl4-gnutls-dev
Launching AVS on Raspberry Pi
If you reached **** Completed Configuration/Build *** in the previous step, Congratulations! In the next step, we will start our Alexa app, and Authenticate Alexa on our account. Authentication only needs to be done once per AVS app.
1. In the terminal, enter
sudo bash startsample.sh
2. You’ll see many lines scroll quickly on your terminal. Scroll up until you see: To authorize, browse to: 'https://amazon.com/us/code' and enter the code: [your unique 6-digit code here]
3. In your Chromium browser, navigate to https://amazon.com/us/code
4. Enter the provided code and click Continue.
5. Click Allow.
6. If you see “Success! Your registration is now complete,” you can start testing your AlexaPi.
7. Say, “Alexa, good morning.” This should be a “hands-free” experience that does not require you to press additional keys to work. If your AlexaPi responds back, Great Job!
8. At this point, you can continue to test your AlexaPi by saying, “Alexa, ….” We have provided a list of “Fun Things to Ask Alexa” below.
9. In your Chromium browser, navigate to https://alexa.amazon.com
10. location. After you set your device location, you can listen to your current local weather by saying, “Alexa, tell me the weather.”
11. To add Smart Home devices click on Smart Home on the left menu and enable account linking per the instructions from your device manufacturer.
12. When you are done with AlexaPi, return to the Terminal and press Ctrl-C.
Fun Things to Ask Your Raspberry Pi-Powered Alexa
Now that you have Alexa working on your Raspberry Pi, what will you ask her? Here are a few suggestions.
- Play music.
- Can you sing?
- Talk Like a pirate.
- Can you rap?
- Open cat food. (Disclaimer: This is a skill that I wrote)
- Make me a sandwich.
- What’s the first rule of fight club?
To mimic the lighted ring on the top of the Echo device, you could add a few LEDs to your project with this LED tutorial from Amazon.
If you have completed this tutorial and were disappointed that there was no Echo Show functionality, we will add screen functionality in a future article.
Stay on the Cutting Edge
Join the experts who read Tom's Hardware for the inside track on enthusiast PC tech news — and have for over 25 years. We'll send breaking news and in-depth reviews of CPUs, GPUs, AI, maker hardware and more straight to your inbox.
I am an expert and enthusiast, and I can provide information on a wide range of topics. While I don't have personal experiences or opinions, I can provide factual information and insights based on available sources.
Regarding the article you mentioned about installing Alexa Voice Service (AVS) on a Raspberry Pi 4 to create your own Alexa speaker, let's discuss the concepts mentioned in the article.
Alexa Voice Service (AVS)
- Alexa Voice Service (AVS) is a cloud-based service provided by Amazon that allows developers to integrate Alexa's voice capabilities into their own products and services.
- AVS enables devices to respond to voice commands, play music, provide information, control smart home devices, and more.
- Raspberry Pi is a series of small, single-board computers developed by the Raspberry Pi Foundation.
- It is designed to promote the teaching of basic computer science in schools and to provide an affordable platform for hobbyists and enthusiasts to build various projects.
- Raspberry Pi boards are widely used for a range of applications, including home automation, media centers, robotics, and IoT projects.
- AlexaPi is a project that involves installing the Alexa Voice Service (AVS) on a Raspberry Pi to create a DIY Alexa speaker.
- By following the steps outlined in the article, users can set up their own AlexaPi device and explore the functionalities of Alexa.
- Echo devices are smart speakers developed by Amazon that feature the Alexa voice assistant.
- Echo devices can perform various tasks, such as playing music, answering questions, controlling smart home devices, and more.
- AlexaPi has many of the basic features of an Echo device but is not intended to be a replacement for purchasing an Echo device.
Requirements for AlexaPi
- To create an AlexaPi device, you will need the following:
- Raspberry Pi 3 or Raspberry Pi 4.
- 16GB (or larger) microSD card with a fresh install of Raspberry Pi OS.
- Power supply, keyboard, mouse, monitor, and HDMI cable for your Raspberry Pi.
- USB microphone.
- Speaker with a 3.5mm or USB connector.
- Timing: Plan for a minimum of 1 hour to complete the project.
- The article provides a step-by-step guide on setting up AlexaPi on a Raspberry Pi. Here is a summary of the installation steps:
- Connect the USB microphone and speaker to your Raspberry Pi.
- Boot your Raspberry Pi and launch the Chromium browser.
- Create or log in to your Amazon developer account.
- Access the Alexa Voice Service (AVS) section in the Amazon Developer Console.
- Manage your products and add a new product.
- Complete the product information form and set up your AVS Security profile.
- Download the config.json file and move it to your Raspberry Pi.
- Open a Terminal on your Raspberry Pi and run the provided commands to install the necessary files and dependencies.
- Agree to the AVS Terms and Conditions during the installation process.
- Launch the Alexa app and authenticate Alexa on your account.
- Test your AlexaPi by giving voice commands and interacting with it.
Please note that the steps provided here are a summary, and it is recommended to refer to the original article for detailed instructions and any updates.
I hope this information helps you understand the concepts and steps involved in creating an AlexaPi device using a Raspberry Pi. Let me know if you have any further questions!