Building a voice-controlled home assistant using a Raspberry Pi

Alexa Pi header 2

While my Raspberry Pi 3 Model B made a decent home theatre PC, I wanted to test the capabilities of the hardware by turning the credit card-sized computer into a home assistant.

Luckily, Amazon has made its Alexa Voice Service available to developers to use on multiple devices.

Alexa is an always-on virtual assistant that allows you to access services and applications using voice commands preceded by the word “Alexa”.

Using Alexa on a Raspberry Pi was previously quite impractical, as the platform did not support the wake word.

The wake word is now supported by the device, making the Pi an ideal candidate for a home assistant – due to its open hardware platform and low price.

Hardware and Pricing

The hardware I needed to create my Alexa-powered assistant was a standard Raspberry Pi 3 Model B board, power supply, microSD card, a speaker, and a microphone.

The code to connect a Raspberry Pi to the Alexa Voice Service has several quirks and requires a specific hardware configuration.

You will need a speaker which connects to the board using a 3.5mm audio connector, and a USB microphone that connects via one of the USB ports.

The pricing for the hardware required for a “cheap” build is:

  • Raspberry Pi 3 Model B Starter Kit – R940
  • Speaker with 3.5mm audio connection – R210
  • USB microphone – R250

The prices are guidelines for new hardware for the build, and I saved a fair amount by using a battery-powered speaker and a USB microphone which I own.

Assembling the hardware is straightforward and consists of connecting the microphone and speaker to the Raspberry Pi, along with any peripherals required to set up the device.

alexa pi 2

Set-up

Setting up the device requires a fair amount of software installation and compatibility checks, beginning with the installation of the Raspbian Jessie OS.

After I installed the OS and booted up the system, I connected a wireless keyboard and mouse, and an HDMI monitor to the Pi.

Before installing anything Alexa-related, I made sure to update my Pi’s operating system and drivers – as these can cause issues if not updated.

It is recommended that a simple USB microphone is used for this project, as devices requiring drivers to function may not be supported by the Pi.

Alexa Pi header

Installation

I installed Alexa Voice Services on my Pi by following the Alexa AVS Sample App guide on Github. This involved the downloading of many files and a fairly long wait for the pre-built installer to set up the applications.

While the software was installing, I set up an Amazon developer account in order to connect my home-made Alexa device to Amazon’s voice services.

This step is necessary for the device to function and provides you with security information you will need for setting up Alexa on your Pi.

Finally, after following the installation guide and linking my Amazon account, I was ready to start Alexa.

Firing up the virtual assistant is not as elegant as simply pressing a button, and it requires you to open three terminal windows and sign in to your Amazon account.

However, thanks to the newly-introduced wake word support, I was able to disconnect the keyboard and monitor from the Pi once I had it set up.

alexa pi 1

Features

I expected the Raspberry Pi Alexa to be extremely limited in terms of functionality, but I was presently surprised by the support for Alexa skills and built-in functionality.

Right off the bat, my Pi was able to set an alarm and timer, stream online radio, search the Internet, find restaurants and other places near me, and answer questions about its functionality.

As I expanded its functionality by enabling skills, it impressed me even more – allowing me to order an Uber from my home in Johannesburg by saying: “Alexa, call me an Uber”.

In my brief time experimenting with my home-made assistant, I found that although it could not natively play my music library on Google Play (it works with Amazon Music), it could play music from paired Bluetooth devices and read me the top news headlines on commands.

For most purposes, my Raspberry Pi with Alexa functioned similarly to an Amazon Echo and could theoretically control other smart devices on my home network – if I had any.

Alexa isn’t the only option for DIY home assistants, though, with open source program Jasper a popular choice for Raspberry Pi users.

This article first appeared on MyBroadband and is republished with permission.

Now read: I built a home theatre PC using a Raspberry Pi

Forum discussion
Authors
Partners
asus

Join the conversation

FREE NEWSLETTER
Building a voice-controlled home assistant using a Raspberry Pi

Related posts

Top