How to Make an Alexa Smart Screen with Raspberry Pi

In this guide, we'll install the Alexa Smart Screen SDK on a Raspberry Pi 4 to “create” our version of the Echo Show. This project will be known as “PiShow.” This project is made feasible by the Amazon Alexa Smart Screen SDK as well as the Alexa Voice Service (AVS) SDK, which we detailed in our previous post, How to Build an Alexa Speaker with Raspberry Pi.

PiShow Warnings

  • PiShow is not meant to be a replacement for the Echo Show. Although many of the Echo Show's capabilities are present in this version, significant capabilities, like the ability to play videos natively, were purposefully left out.
  • The vocal wake word trigger “Alexa” is not included in this smart screen version of AlexaPi. While speaking to Alexa, the user will hit the ‘A' key.
  • PiShow cannot launch when VNC is running. On the Raspberry Pi, VNC must be disabled.
  • Music: Using a Pi touch screen, the user may pause music. The music capabilities are identical to those stated on the AlexaPi page.
  • Alexa Skills are accessible on PiShow, and any visual screens inside an Alexa Skill are also visible on PiShow. Moreover, Alexa's skills have touchscreen functionality enabled.
  • If you use a touch screen and tap the screen while Alexa is speaking, she will stop speaking. This is the same behavior as with the Echo Show.

Why Build a PiShow?

In our previous post, we discussed the cost difference between purchasing AlexaPi project components and an Echo Dot. In this article, we fully reveal that it is less costly to purchase an Echo Show than the components for a PiShow.

This can be a fun weekend STEM project if you already have a Raspberry Pi and a touchscreen. The fun is in creating and discovering how voice technology works behind the scenes.

Using Raspberry Pi Turn Your Monitor or TV Into A Smart Screen

What You Need to Make an Alexa Smart Screen with Raspberry Pi

Timing: Prepare for a minimum of 3 hours to accomplish this project. Depending on your Pi model and internet bandwidth, the AVS Device SDK installation step takes around 2 hours.

Prerequisites:

Complete the entire project, as detailed in our previous article, “How to Build an Alexa Speaker with Raspberry Pi,” before starting this tutorial.

The majority of this tutorial is focused on terminal commands. We strongly recommend reviewing 25+ Linux Commands Raspberry Pi Users Need to Know first if they are unfamiliar with terminal commands on your Raspberry Pi.

PiShow Setup and Install

  1. As detailed in our previous article, “How to Build an Alexa Speaker with Raspberry Pi,” complete the AVS installation.
  2. Press Ctrl-C to halt the script if your AlexaPi is currently running. The speaker, microphone, and power should all still be connected.
  3. Attach your screen. The PiShow version now includes a 7″ Raspberry Pi Touchscreen. But, you could use a touch screen from a third party that connects via HDMI or the GPIO ports. You can purchase similar screens on Amazon for as little as $25. You cannot use those functionalities if your screen is not touch-sensitive.

Back view:

Can Raspberry Pi work with Alexa?
  1. Open a Terminal.
  2. We'll start by creating the folders and installing the libraries and applications we'll require for PiShow. Type the following commands:
cd /home/pi

mkdir sdk_folder

cd sdk_folder

mkdir sdk-build sdk-source third-party sdk-install db

sudo apt-get -y install \
git gcc cmake build-essential libsqlite3-dev libcurl4-openssl-dev libfaad-dev \
libssl-dev libsoup2.4-dev libgcrypt20-dev libgstreamer-plugins-bad1.0-dev \
   gstreamer1.0-plugins-good libasound2-dev doxygen

pip install commentjson

Your Pi may already have commentjson installed.

How to setup Alexa in Raspberry Pi?
  1. Next, we will install PortAudio to record microphone data.
cd third-party

wget -c http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz

tar zxf pa_stable_v190600_20161030.tgz

cd portaudio

./configure --without-jack
Can you get Alexa with a screen?
  1. Run ‘make’ in the PortAudio folder. This command took around 1.5 minutes on a Raspberry Pi 4.
make
Can I use Echo Show as a smart hub?
cd $HOME/sdk_folder/sdk-source

git clone --single-branch --branch v1.21.0 git://github.com/alexa/avs-device-sdk.git

cd $HOME/sdk_folder/sdk-build

cmake $HOME/sdk_folder/sdk-source/avs-device-sdk \
-DGSTREAMER_MEDIA_PLAYER=ON \
-DPORTAUDIO=ON \
-DPORTAUDIO_LIB_PATH=$HOME/sdk_folder/third-party/portaudio/lib/.libs/libportaudio.a \
-DPORTAUDIO_INCLUDE_DIR=$HOME/sdk_folder/third-party/portaudio/include \
-DCMAKE_BUILD_TYPE=DEBUG \
-DCMAKE_INSTALL_PREFIX=$HOME/sdk_folder/sdk-install \
-DRAPIDJSON_MEM_OPTIMIZATION=OFF

make install
What is Alexa smart screen?

There shouldn't be any error messages shown on your screen when the installation is complete.

Read More: How to Turn your Raspberry Pi into a Web Server

  1. Copy the config.json file from the AlexaPi project (/home/pi/) to the Install folder and generate the AlexaClientSDKConfig.json file.
cp ~/config.json $HOME/sdk_folder/sdk-source/avs-device-sdk/tools/Install

cd $HOME/sdk_folder/sdk-source/avs-device-sdk/tools/Install

bash genConfig.sh config.json \
your-device-serial-number \
$HOME/sdk_folder/db \
$HOME/sdk_folder/sdk-source/avs-device-sdk \
$HOME/sdk_folder/sdk-build/Integration/AlexaClientSDKConfig.json \
-DSDK_CONFIG_MANUFACTURER_NAME="manufacturer name" \
-DSDK_CONFIG_DEVICE_DESCRIPTION="device description"
raspberry pi alexa
  1. Open File Manager and navigate to /home/pi/sdk_folder/sdk-build/Integration/ folder.
Open File Manager and navigate
  1. Right-click on AlexaClientSDKConfig.json and select Text Editor to open the file for editing.
  2. Add the info for gstreamerMediaPlayer in the first set of brackets.
"gstreamerMediaPlayer":{

 "audioSink":"alsasink"

},
raspberry pi smart display
  1. Save your file.
  2. You can also save a backup copy as AlexaClientSDKConfig_backup.json.
AlexaClientSDKConfig_backup.json
  1. Close your Text Editor.
  2. Create or modify your /.asoundrc file.
cd

sudo nano ~/.asoundrc
  1. Add the following lines to ~/.asoundrc
pcm.!default {
   type asym
   playback.pcm {
     type plug
     slave.pcm "hw:0,0"
   }
   capture.pcm {
     type plug
      slave.pcm "hw:1,0"
   }
 }
raspberry pi echo command
  1. Press Ctrl-X, Y, and Enter to save your ~/.asoundrc file.
  2. Test your progress so far.
cd $HOME/sdk_folder/sdk-build

 PA_ALSA_PLUGHW=1 ./SampleApp/src/SampleApp 
./Integration/AlexaClientSDKConfig.json DEBUG9
  1. Similar to the authentication you completed during the AlexaPi project, in the Terminal, scroll up to find your code, then navigate to https://amazon.com/us/code and enter your code.
AlexaPi project
alexa control raspberry pi gpio
  1. Press Continue and you should see a Success message in your browser.
Press Continue and you should see a Success message in your browser.
  1. Go back to your Terminal and scroll up to search for the “Authorized” message.
Go back to your Terminal and scroll up to search for the “Authorized” message.
  1. You must type ‘t’ followed by the Enter key before speaking to Alexa in this AlexaPi project, which works slightly differently from the original AlexaPi project. Test it right now. “What time is it?” asks the user when they press the ‘t’ key to enter the time.

You have completed installing the AVS Device SDK sample app if Alexa gives you the time. Congratulations!

Read More: How to Make a Raspberry Pi Print Server

  1. Press Ctrl-C to stop the sample app.
  2. Next, we will download and ‘make’ the APL Core Library. The last command in this sequence, ‘make, took approximately 15 minutes to complete.
cd $HOME/sdk_folder

 git clone --single-branch --branch v1.4.1 git://github.com/alexa/apl-core-library.git

cd $HOME/sdk_folder/apl-core-library

mkdir build

cd build

cmake ..

make
raspberry pi alexa alternative
  1. Install Alexa Smart Screen SDK dependencies, Websocket++, AISO, and Node.js
cd $HOME/sdk_folder/third-party

wget https://github.com/zaphoyd/websocketpp/archive/0.8.1.tar.gz -O websocketpp-0.8.1.tar.gz

tar -xvzf websocketpp-0.8.1.tar.gz

cd $HOME/sdk_folder/third-party

sudo apt-get -y install libasio-dev --no-install-recommends  

cd $HOME/sdk_folder/third-party

curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -

sudo apt-get install -y nodejs
alexa smart screen sdk
How to Turn Your Raspberry Pi Into an Amazon Echo/Dot Using Alexa
  1. Download and install the Alexa Smart Screen SDK. The last step, ‘make’ took approximately 25 minutes to complete.
cd $HOME/sdk_folder
    
 git clone git://github.com/alexa/alexa-smart-screen-sdk.git

mkdir ss-build

cd ss-build

cmake -DCMAKE_PREFIX_PATH=$HOME/sdk_folder/sdk-install \
 -DWEBSOCKETPP_INCLUDE_DIR=$HOME/sdk_folder/third-party/websocketpp-0.8.1 \
 -DDISABLE_WEBSOCKET_SSL=ON \
 -DGSTREAMER_MEDIA_PLAYER=ON \
 -DCMAKE_BUILD_TYPE=DEBUG \
 -DPORTAUDIO=ON -DPORTAUDIO_LIB_PATH=$HOME/sdk_folder/third-party/portaudio/lib/.libs/libportaudio.a \
 -DPORTAUDIO_INCLUDE_DIR=$HOME/sdk_folder/third-party/portaudio/include/ \
 -DAPL_CORE=ON \
 -DAPLCORE_INCLUDE_DIR=$HOME/sdk_folder/apl-core-library/aplcore/include \
 -DAPLCORE_LIB_DIR=$HOME/sdk_folder/apl-core-library/build/aplcore \
-DAPLCORE_RAPIDJSON_INCLUDE_DIR=$HOME/sdk_folder/apl-core-library/build/rapidjson-prefix/src/rapidjson/include \
 -DYOGA_INCLUDE_DIR=$HOME/sdk_folder/apl-core-library/build/yoga-prefix/src/yoga \
 -DYOGA_LIB_DIR=$HOME/sdk_folder/apl-core-library/build/lib \
  ../alexa-smart-screen-sdk

make
Amazon Echo Wall Display : 7 Steps
Turn an old monitor into a wall display with a Raspberry Pi
  1. The PiShow app may then be tested. (If you are using VNC, you must stop using it and disable it for the app to launch).

Read More: How to Setup a Raspberry Pi Pico: A Beginner’s Guide

Run PiShow

  1. Open File Manager and navigate to: /home/pi/sdk_folder/ss-build/modules/GUI/index.html
/home/pi/sdk_folder/ss-build/modules/GUI/index.html
  1. Open index.html with your Chromium browser by double-clicking on index.html
Using Raspberry Pi Turn Your Monitor or TV Into A Smart
  1. Go back to your Terminal and enter the following commands to start your PiShow.
cd $HOME/sdk_folder/ss-build
 PA_ALSA_PLUGHW=1 ./modules/Alexa/SampleApp/src/SampleApp -C \
 $HOME/sdk_folder/sdk-build/Integration/AlexaClientSDKConfig.json -C \
 $HOME/sdk_folder/alexa-smart-screen-sdk/modules/GUI/config/SmartScreenSDKConfig.json -L INFO
  1. As in step 21, you may need to authenticate the PiShow sample app. If so, scroll up to find your code in the Terminal, then navigate to https://amazon.com/us/code and enter it.
  2. Go back to your Chromium browser, and you should see the message “Press and Hold “A” then speak”.
amazon alexa
  1. Give it a try! Quick note: index.html in Chromium must be the active window for PiShow to work. Hold down the ‘A’ key while you say, “Tell me the weather.”

Congratulations! You have made your PiShow!

Controlling Raspberry Pi Using Alexa

Always use the same process: With /home/pi/sdk_folder/ss-build/modules/GUI/index.html as the active window, hold down the ‘A’ key while speaking to Alexa. You do not need to say the wake word, “Alexa”.

Read More: How to Setup a Raspberry Pi: A Beginner’s Guide

Things to Try on Your New PiShow

  • “Play Music”: If using the touchscreen, you can pause the music by tapping the pause button on the screen.
  • “Tell me a joke.”
  • “Open Big Sky” is a weather app with great graphics.
  • “What does planet Earth look like?”
  • “Enable Space Station”

Go back to your terminal and press Ctrl-C to end PiShow.

how to make an alexa smart screen with raspberry pi 25

PiShow may be restarted using the Terminal command if you turn off or reboot your Pi.

cd $HOME/sdk_folder/ss-build
 PA_ALSA_PLUGHW=1 ./modules/Alexa/SampleApp/src/SampleApp -C \
 $HOME/sdk_folder/sdk-build/Integration/AlexaClientSDKConfig.json -C \
 $HOME/sdk_folder/alexa-smart-screen-sdk/modules/GUI/config/SmartScreenSDKConfig.json -L INFO

Oh hi there It’s nice to meet you.

Sign up to receive awesome content in your inbox, every month.

We don’t spam! Read our privacy policy for more info.

Leave a Reply

Your email address will not be published. Required fields are marked *

20 Easy Raspberry Pi Projects Toys, Tools, Gadgets

20 projects using the Raspberry Pi, a tiny and affordable computer, for beginners looking to make cool things, Projects are explained with full-color visuals and simple step-by-step instructions.