Voice assistants have definitely become a trend, with options like Google Assistant, Amazon Alexa, and Apple’s Siri. What really differs them from each other is their ecosystems, and this is where Amazon Alexa shines the most.
Amazon provides the API for using its voice service, Alexa. Integrating custom devices with it allows you to bring the full Amazon Echo functionality to those devices and open a wide range of opportunities both for DIY/PoC and enterprise solutions.
DataArt developed an open solution that allows turning any Linux-based device into an Amazon Echo device. Since Raspberry Pi is the most popular board for IoT projects, we decided to use it in our setup. But basically, any Linux system can run the demo.
Below you’ll find the latest version of an Amazon Alexa virtual device project (version 1.1). This project aims to provide the ability to bring Alexa to any Linux device, including embedded systems like Raspberry Pi boards.
At the end, you will be able to build a voice-activated, digital home assistant, which will answer a multitude of questions, read books, play music, tell jokes, provide weather, and even more.
The binary release is packed into a snap package, which is a perfect way to deliver this project.How to Add Alexa to a Raspberry Pi:
- You need to create your own Alexa Device on the Amazon developer portal. Follow this manual to create your own device and security profile. Add http://alexa.local:3000/authresponse to the Allowed Return URLs and http://alexa.local:3000 to the Allowed-Origins.
- Connect an audio device: a microphone and speakers to your device. It could be a USB headset for example.
- Install the PulseAudio snap:
sudo snap install --devmode pulseaudio
- Install the Alexa snap from the store:
sudo snap install --channel beta alexa
- Open http://alexa.local:3000 in a web browser on a local device or a device on the same network. Note: the app provides an mDNS advertisement of the local domain alexa.local. This is very helpful for using with monitorless devices.
- Fill in the device credentials that were created during step 1, click ‘log in’. Note: the voice detection threshold is a float value for adjusting voice detection. The smaller the value, the easier it is to trigger. You may need to adjust it for your mic and voice.
- Fill in your Amazon credentials.
- Now you can speak with Alexa. The app uses voice activation, so say ‘Alexa’ and the phrase that you want to say to her. The app will make a beep via the speakers when it hears the ‘Alexa’ keyword and starts recording.
- Enjoy Alexa without the need to buy special hardware