to set up Amazon voice services on a Raspberry Pi 3 exactly like I did in my
l33 7 video you will need a raspberry pi 3 a fast mini SD card and a USB adapter
to plug it into your PC a 5 volt micro USB power supply that outputs at least
one amp a USB microphone a powered HDMI or 3.5 millimeter Jack speaker for
testing a download of the latest raspy and stretch OS for the Raspberry Pi
you'll also need the ability to write that operating system to your SD card
you can use any third-party programs you'd like but for me I'm using an SD
card formatter and etcher finally you'll need the ability to login to your PI to
run some commands you can do that with SSH via putty or putty but for the
purposes of this video I'm going to login to the desktop with a VNC viewer
with the SD card plugged into your machine format with the SD card
formatter open up at your edshare is going to write the operating system to
your SD card click select image and browse to the raspbian stretch zip
folder click select Drive browse to your SD card and then hit flash this process
will go through two stages flashing and validating in total this process took
about seven minutes on my machine plug the card into the pie with the operating
system installed we need to configure our Wi-Fi settings get the PI's IP
address and enable V and C on the pi before we can login with our VNC viewer
for tutorial purposes the lowest tech way I could find to do this was to plug
a keyboard and mouse into the PI and hook it up to your TV via an HDMI cable
you can also get the IP address via your router if you wish there are a number of
tutorials on how to do that on YouTube when you power on the PI attached to
your TV you'll be greeted with the raspbian desktop to enable the Wi-Fi go
to the top right corner find your Wi-Fi network and enter your password next we
want to enable VNC so we can log on to the raspbian desktop with our PC desktop
open up the terminal window and type sudo rasp I config all terminal commands
that will be used in this video will be available in text format in the
description of this video for easy copy and pasting in the rasp I config window
arrow down to interfacing options and hit enter arrow down to VNC and hit
enter again and then hit enter one more time to enable the
and see hit right twice to go to finish and hit enter which will bring you back
to the terminal window the last thing that we need to do here is get the IP
address of the PI type if config vertical line grep inet and hit enter
the terminal will return something that looks like this and you're looking for
this number right here 192 168 something something something this is your IP
address for the PI and we'll need this to login to the VNC viewer now we just
need to test our connection to make sure we can control the PI remotely from the
PC so open up the VNC viewer in the search bar here type the IP address from
just before the 192 168 something something something a window will pop up
asking you for your login information the default login for Raspberry Pi is
username PI and password raspberry all lowercase hit enter and you should see
the same raspbian desktop from before cool now we're all done setting up the
PI side of things now we just need to set up an Amazon product and we'll be
ready to install Alexa head on over to developer amazon.com and sign in with
your usual Amazon credentials if I remember correctly the first time you
log in to the developer console you're gonna have to go through a registration
process so do that if you need to and when you return click on the developer
console at the top on the next page click on the Alexa voice services tab to
bring up a list of your Amazon products as you can see I already have my l33
product made this is the one from the last video let's pretend I don't have
that and go on ahead and create a new product just going through the
information here product name isn't super important you can name it anything
you'd like for Product ID it doesn't really matter what you choose but
remember what you put here because you'll be needing it later my
recommendation is to make this something simple and easy to remember this is an
Alexa enabled device there is no companion app product category here is
smart home a brief product description that should work it is hands-free I'm
not putting a picture up it's not commercial and it's not for children
cool next up is the security profile you definitely want to pay attention here
create the new security profile again the name doesn't really matter
and also the description doesn't really matter either click Next now this bid is
really important under platform information click on other devices and
platforms you'll need to enter a client ID name here I'm just putting raspberry
pi but you can put whatever you want then you want to hit generate ID this
generates a unique client ID which you will most definitely need to install
Alexa on the PI if at any point during the installation process you are asked
for a client ID this is the one that you want to use there's a few listed on this
developer console but they don't all apply to the raspberry pi SDK so be sure
that you're using this one under other devices and platforms agree to the terms
and hit finish
your product has been created awesome let's install Alexa onto the pie
make sure your microphone and speaker are plugged into their ports and log
back in with a VNC viewer now it's a great time to introduce the real hero of
this video my good friend Henry the Alexa SDK installation is a whole bunch
of tiny little steps but Henry wrote some scripts to automate that process
down to a few simple commands he put all of this on his github which is linked in
the description to this video a big THANK YOU to Henry for all your help on
this okay let's start the installation we're going to start by cloning Henry's
get this process takes about five minutes and we'll create a folder called
L 3-3 seven alexa underscore patch bots in your home PI directory when that is
done cloning CD into that directory and run the setup scripts you will be
prompted for your product ID this is the thing I told you to make very simple so
you would remember it later next you will be asked for your client ID once
again be sure to use the one from the other devices in platform section lastly
you'll be asked for a serial number this number will not come from the developer
amazon.com section you can just make up a number here this installation takes
about twenty minutes it finishes with a really nice 0 to 100% progress indicator
after 100% you'll see the command prompt again and then you'll know it's done
before we can run Alexa for the first time there's a couple housekeeping items
that we need to take care of open a clean terminal window and run alsa mixer
this is your soundboard and we'll need to adjust some levels before we continue
you can see here by default your speaker volume is at 40 I generally up that to
about 85 you'll see there is a red level I usually keep my levels one click below
that hit f6 to bring up your devices scroll down to the USB PNP sound device
this is your microphone if you hit f4 to go to the capture settings you can see
the microphone capture volume is 0 by default I like to raise this to 1 click
below the red as well right around 80 if you're using a 3.5 millimeter Jack
speaker like me there is one more step we should do in the terminal enter sudo
rasp I config again this time arrow down to Advanced Options then audio and then
force 3.5 millimeter this will put all your sound through the audio jack all
right game time time to run Alexa for the first time before we run this open
up a separate browser window and go to amazon.com slash us slash code
login with your Amazon credentials and keep this window open during this
process back in the terminal window CD into the l3 directory and run the script
it will spit out a bunch of text in the first time you run it you should see at
the bottom checking for authorization when you see
this scroll up to find the authorization code it is a six digit alphanumeric code
just copy and paste that into the same amazon.com slash us slash code browser
window it will ask for permission which you will grant and you will be
authorized the SDK will spit out a little more code and at the end you will
see Alexa is currently idle and now you can test l3 what what time is it
the time is 12:01 p.m. like I said in the beginning of this video this is the
exact setup for my l3 video so the Wake word here is actually l3 we will be
going through the steps to change that soon so if you aren't making in l3
feared not while we're in this terminal with l3 running we can also change the
language hit C on your keyboard and then hit 1 then you can choose your language
from this list I'm going to choose the British accent as I did before
as you heard during the test the script automatically installs
the what response from the previous video this is actually just a dot wave
file that plays when the wake word is triggered if we browse into the l3 37
folder and open up our sounds folder you will see a response dot wav file this is
our what if you want you can overwrite this file with any dot WAV file you like
just keep the name the same you'll notice another file in this folder l3
that p.m. DL this is the Wake word file generated from the snowboy website the
one installed with the script is made from my own voice so even if you're
keeping l3 as a Wake word you may consider going through the following
steps to create your own custom Wake word file to do that open up a browser
and head over to snowboy kitteh I you'll see at the bottom of the page there is a
bargain of a hacker's price to create your own Wake word file login or create
an account and then click on create hot word they will have you record your hot
word three times L 3 L 3 L 3 and then they're going to give you a test the
test is to setup and tweak the sensitivity of the hot word the first
time I did this I kept it at the default point five and it was a little too
sensitive I was getting a lot of false positives and L three was responding to
almost anything at about 0.25 I stopped getting 100% success so I moved it back
up to 0.28 just to be sure and use that file after you download your PMD L file
place it in the sounds folder with the old one be sure to use a file name
without any spaces or it will not work unlike the response dot wave you can
simply overwrite the PMD file and have it work you'll need to run a command to
overwrite this setting in the SDK and then recompile the code open up a
terminal window CD into the Alexa directory and run the following command
you'll then need to run the L 337 rebuild script to recompile the code
you'll have to wait the 20 minutes again while it recompiles and you'll have to
do this any time you adjust anything in the SDK next up is the GPIO pin outs
installed with this script currently I have pin 17 of the Raspberry Pi going
high when the Wake word is triggered and remaining high while L 3 is thinking and
speaking you can easily modify this by opening up the UI manager dot CPP file
located in the l3 folder then source AVS device SDK sample app then source again
and using that file in conjunction with the developer amazon.com tutorial
found here lastly our good friend Henry also wrote a startup script so Alexa
will run automatically when you boot up your PI this way you don't have to login
to start her up each time you power on run this script
and it will start on boot just keep in mind the auto start takes a few minutes
after you boot up so just be patient that's gonna do it for this tutorial if
you run into any issues please post them in the comments I will answer any
questions there so they benefit others who run into the same issue if there are
any frequently run into problems I will edit to the description of the video to
address them so check there first if you run into anything if you found this
video helpful please subscribe to the channel for more updates on this project
and my other projects and I will see you next time