How To Setup Amazon Alexa Voice Control Service - Qualcomm

Loading...

How To Setup Amazon Alexa Voice Control Service On the DragonBoard™ 410c This project demonstrates how to access and test the Alexa Voice Service on a DragonBoard 410c using a Java client and a Node.js server. You will be using the Node.js server to get a Login with Amazon authorization code by visiting a website using your computer's (or DragonBoard 410c in this case) web browser. This guide is based on the Instructions published by Amazon for RaspberryPi here: http://github.com/amzn/alexa-avs-raspberry-pi

Contents 1

Install New Software..............................................................................................................................................2 1.1 1.2 1.3 1.4 1.5

2

Getting started with Alexa Voice Service...............................................................................................................4 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9

Download the sample app code and dependencies on the DragonBoard410c ...........................................4 Register for a free Amazon Developer Account ...........................................................................................4 Register your product and create a security profile. ...................................................................................4 Generate self-signed certificates. ................................................................................................................8 Install the Companion Service dependencies ............................................................................................10 Create Security Profile ...............................................................................................................................10 Updating the config files ............................................................................................................................11 Run the server ............................................................................................................................................13 Start the client ............................................................................................................................................14

2.9.1

Build the app ..........................................................................................................................................14

2.9.2

Run the client app: .................................................................................................................................14

2.10 3

Install VLC media player ...............................................................................................................................2 Install Node.JS ..............................................................................................................................................2 Install Java development kit .........................................................................................................................2 Install Maven ................................................................................................................................................3 Install oppenSSL ...........................................................................................................................................3

Obtain Authorization from Login with Amazon .........................................................................................15

Let’s talk to Alexa .................................................................................................................................................17

1

1 Install New Software Before we install any new software lets update our package list first: Open a new Termial-window: CTRL-ALT-T sudo apt-get update

1.1 Install VLC media player Get VLC media player by typing: sudo apt-get install vlc-nox vlc-data Make sure VLC is installed correctly (This will tell you where VLC is installed.): whereis vlc Set the environment variables for VLC: export LD_LIBRARY_PATH=/usr/lib/vlc export VLC_PLUGIN_PATH=/usr/lib/vlc/plugins Check if the environment variables were set successfully: echo $LD_LIBRARY_PATH > /usr/lib/vlc echo $VLC_PLUGIN_PATH > /usr/lib/vlc/plugins

1.2 Install Node.JS Node JS should come pre-installed on the latest DragonBoard images. To verify if NodeJs is available on your system type: node --version > command not found If this command returns the version information of the Node version installed you can skip this step and proceed to the next step. Otherwise continue with these instructions to install NodeJS: sudo apt-get install nodejs

1.3 Install Java development kit Java should come pre-installed on the latest DragonBoard images and you should be able to skip this step. To verify if Java is available on your system type: java -version javac –version

2

If this command returns the version information of the Java version installed you can skip this step and proceed to the next step. Otherwise continue with these instructions to install Java: sudo apt-get install openjdk-8-jdk

1.4 Install Maven Download Maven Download the file apache-maven-3.3.9-bin.tar.gz from: http://maven.apache.org/download.cgi or http://mirror.metrocast.net/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz Extract the contents of the tarball to the /opt directory: sudo tar zxvf apache-maven-3.3.9-bin.tar.gz -C /opt Tell your shell where to find maven. Edit your ~/.bashrc file and type the following inside it: export M2_HOME=/opt/apache-maven-3.3.9 export PATH=$PATH:$M2_HOME/bin (If you like, you can also edit the system profile settings so it is available to all users by creating a new file /etc/profile.d/maven.sh and adding in the export lines above.) Save the file. Log out and back into the DragonBoard410c so the profile script takes effect. You can test that it is working with the following command: mvn –version

1.5 Install oppenSSL OpenSSL should come pre-installed on the latest DragonBoard images and you should be able to skip this step. To verify if OpenSSL is available on your system type: Verify install whereis openssl > openssl: /usr/bin/openssl /usr/share/man/man1/openssl.lssl.gz If this command returns correctly you can skip this step and proceed to the next step. Otherwise continue with these instructions to install OpenSSL: Install OpenSSL sudo apt-get install openssl Update CA-certificates: sudo update-ca-certificates

3

2 Getting started with Alexa Voice Service 2.1 Download the sample app code and dependencies on the DragonBoard410c Download the sample apps: mkdir ~/Projects mkdir ~/Projects/alexa cd ~/Projects/alexa git clone http://github.com/amzn/alexa-avs-raspberry-pi.git By downloading this package, you agree to the Alexa Voice Service Agreement.

2.2 Register for a free Amazon Developer Account Get a free Amazon developer account if you do not already have one: http://developer.amazon.com/login.html

2.3 Register your product and create a security profile. 1.

Login to Amazon Developer Portal - developer.amazon.com

4

2.

Click on Apps & Services tab -> Alexa -> Alexa Voice Service -> Get Started

3.

In the Register a Product Type menu, select Device

4.

Fill in and save the following values: Device Type Info:  Device Type ID: my_device  Display Name: My Device Then click Next

5

Security Profile 5.

Click on the Security Profile dropdown and choose “Create a new profile” :

6.

General Tab 

Security Profile Name: Alexa Voice Service Sample App Security Profile



Security Profile Description: Alexa Voice Service Sample App Security Profile Description



Click Next

The Client ID and Client Secret will be generated for you.

6

7.

8.

Now click on the Web Settings Tab 

Make sure the security profile you just created is selected in the drop-down menu, then click the "Edit" button.



Allowed Origins: Click "Add Another" and then enter http://localhost:3000 in the text field that appears.



Allowed Return URLs: Click "Add Another" and then enter http://localhost:3000/authresponse in the text field that appears.



Click Next

Device Details 

[Optional] Image: Save the following test image to your computer, then upload it:



Category: Other



Description: Alexa Voice Service sample app test



What is your expected timeline for commercialization?: Longer than 4 months / TBD



How many devices are you planning to commercialize?: 0



Click Next (see screen shot on next page)

7

9.

Amazon Music 

Enable Amazon Music?: No (You may optionally select Yes and fill in the required fields if you want to experiment with Amazon Music. However, Amazon Music is not required for basic use of the Alexa Voice Service.)



Click the Submit button

2.4 Generate self-signed certificates. Change directories to /samples/javaclient. In this instance, the is “/home/linaro/Projects/alexa/alexa-avs-raspberry-pi/”: cd /samples/javaclient - //your sample apps location Step 1: Edit the text file ssl.cnf, which is an SSL configuration file. Fill in appropriate values in place of the placeholder text that starts with YOUR_. [req_distinguished_name] commonName = countryName = stateOrProvinceName = localityName = organizationName = organizationalUnitName =

$ENV::COMMON_NAME US # C= CA # ST= San Diego # L= Qualcomm Technologies, Inc. # O= Qualcomm Developer Network

# CN=

8

Note that countryName must be two characters. If it is not two characters, certificate creation will fail. Here's what the ssl.cnf file would look like, replacing country, state, locality with your respective info. Save the file. Step 2: Make the certificate generation script executable by typing: chmod +x generate.sh Step 3: Run the certificate generation script: ./generate.sh Step 4: You will be prompted for some information: 

When prompted for a product ID, enter my_device



When prompted for a serial number, enter 123456



When prompted for a password, enter any password and remember what you entered o

Password: talktome (you can even leave it blank)

Step 5: Edit the configuration file for the Node.js server The configuration file is located at: /samples/companionService/config.js. Make the following changes: 

Set sslKey to /samples/javaclient/certs/server/node.key



Set sslCert to /samples/javaclient/certs/server/node.crt



Set sslCaCert to /samples/javaclient/certs/ca/ca.crt

IMPORTANT: Do not use ~ to denote the home directory. Use the absolute path instead. So in this case, use /home/linaro/Projects/alexa/alexa-avs-raspberry-pi/samples/… Save the file. Step 6: Edit the configuration file for the Java client The configuration file is located at: /samples/javaclient/config.json. Make the following changes: 

Set companionApp.sslKeyStore to /samples/javaclient/certs/server/jetty.pkcs12



Set companionApp.sslKeyStorePassphrase to the passphrase entered in the certificate generation script in step 4 above.



Set companionService.sslClientKeyStore to /samples/javaclient/certs/client/client.pkcs12

9



Set companionService.sslClientKeyStorePassphrase to the passphrase entered in the certificate generation script in step 4 above.



Set companionService.sslCaCert to /samples/javaclient/certs/ca/ca.crt

2.5 Install the Companion Service dependencies Change directories to /samples/companionService cd /samples/companionService Install the dependencies by typing: npm install

2.6 Create Security Profile 1.

Open a web browser, and visit http://developer.amazon.com/lwa/sp/overview.html.

2.

Near the top of the page, select the security profile you created earlier from the drop down menu and click Confirm.

3.

Enter a privacy policy URL beginning with http:// or http://. For this example, you can enter a fake URL such as http://example.com.

4.

[Optional] You may upload an image as well. The image will be shown on the Login with Amazon consent page to give your users context.

5.

Click Save.

10

6.

Next to the Alexa Voice Service Sample App Security Profile, click Show Client ID and Client Secret. This will display your client ID and client secret. Save these values. You’ll need these.

2.7 Updating the config files Step 1: Update config.js Navigate to the following file and open it in your favorite text editor. /samples/companionService/config.js Edit the following values in this file: 

clientId: Paste in the client ID that you noted in the previous step as a string.



clientSecret: Paste in the client secret that you noted in the previous step as a string.



products: The product's object consists of a key that should be the same as the product type ID that you set up in the developer portal and a value that is an array of unique product identifiers. If you followed the instructions above, the product type ID should be my_device. The unique product identifier can be any alphanumeric string, such as 123456. Example products JSON is: products: {"my_device": ["123456"]}

11

Save the file. Step 2: Update config.json Navigate to the following file, and open it in a text editor. /samples/javaclient/config.json Edit the following values in this file: 

productId: Enter my_device as a string.



dsn: Enter the alphanumeric string that you used for the unique product identifier in the products object in the server's config.js. For example: 123456.



provisioningMethod: Enter companionService.

Save the file. Step 3: Preparing the pom.xml file Navigate to the following file and open it in a text editor. /samples/javaclient/pom.xml 

In the section, change the VLCJ version number to 3.10.1: uk.co.caprica vlcj 3.10.1



Add the following in the section: net.java.dev.jna jna 4.2.2 compile 12

Save the file.

2.8 Run the server Finally we are ready to start the companion service app In your terminal window or from the command prompt, type: cd /samples/companionService npm start

The server is now running on port 3000 and you are ready to start the client.

13

2.9 Start the client Open a new terminal window/tab and change into the java-client directory: cd /samples/javaclient

2.9.1 Build the app Before you build the app, let’s validate to make sure the project is correct and that all necessary information is available. You do that by running: mvn validate Download dependencies and build the app by typing: (you might want to close any unnecessary apps or you might run into an error due to insufficient memory) mvn install When the installation is completed, you will see a “Build Success” message in the terminal:

2.9.2 Run the client app: You are now ready to run the client app by typing: mvn exec:exec

14

2.10 Obtain Authorization from Login with Amazon 1.

When you run the client, a window should pop up with a message that says something similar to:

Please register your device by visiting the following website on any system and following the instructions: http://localhost:3000/provision/d340f629bd685deeff28a917 Hit OK once completed.

Copy the URL from the popup window and paste it into a web browser. In this example, the URL to copy and paste is http://localhost:3000/provision/d340f629bd685deeff28a917.

NOTE: Due to the use of a self-signed certificate, you will see a warning about an insecure website. This is expected. It is safe to ignore the warnings during testing. 2.

You will be taken to a Login with Amazon web page. Enter your Amazon credentials.

15

3.

You will be taken to a Dev Authorization page, confirming that you’d like your device to access the Security Profile created earlier. Click Okay.

4.

You will now be redirected to a URL beginning with http://localhost:3000/authresponse followed by a query string. The body of the web page will say device tokens ready.

5.

Return to the Java application and click the OK button. The client is now ready to accept Alexa requests.

6.

Wait a few seconds for the Token to appear in the Alexa Voice Service window. Click the Start Listening button and wait for the audio cue before beginning to speak. It may take a second or two for the connection to be made before you hear the audio cue.

16

7.

Press the Stop Listening button when you are done speaking.

3 Let’s talk to Alexa Ask for Weather: Click the Start Listening button. You: What's the weather in Seattle? Click the Stop Listening button.Alexa: Current weather report for Seattle Some other fun questions you can ask Alexa Once you hear the audio cue after clicking “Start Listening” button, here are a few things you can try saying 

Request Music Playback: Play Bruce Springsteen



General Knowledge: What's the mass of the sun in grams?



Geek: What are the three laws of robotics?



Fun: Can you rap?



Set a Timer: Set the timer for 2 minutes.



Set Alarm: Set the alarm for 7:30 a.m.

More on Music Playback The "previous", "play/pause", and "next" buttons at the bottom of the Java client UI are to demonstrate the music button events. Music button events allow you to initiate changes in the playback stream without having to speak to Alexa. For example, you can press the "play/pause" button to pause and restart a track of music. To demonstrate the "play/pause" button, you can speak the following command: Play DC101 on iHeartRadio, then press the "play/pause" button. The music will pause in response to the button click. Press the "play/pause" button again to restart the music.

17

Loading...

How To Setup Amazon Alexa Voice Control Service - Qualcomm

How To Setup Amazon Alexa Voice Control Service On the DragonBoard™ 410c This project demonstrates how to access and test the Alexa Voice Service on a...

2MB Sizes 12 Downloads 2 Views

Recommend Documents

How To Setup Amazon Alexa Echo Tap
For any doubts or struggle that you face with setting up your Wi-Fi, you can send your query to us: http Alexa Amzon.com

HOW TO SETUP AMAZON ALEXA ECHO TAP
FOR TECHNICAL ASSISTANCE TO SETUP ECHO TAP /ALEXA SETUP CONTACT US AT TOLLFREE:+1-888-409-8111. OR MAIL:[email protected]

How to download Alexa app for Amazon Echo Dot setup?
If your echo won't connect to wifi Or having any problem to setup Alexa to Wifi then Don't Worry we are here to help you

How to Setup Alexa Show to Wifi
If you don't know that how to set up Amazon Echo show them we are here for resolving Echo Show Setup problem. Here you

Download Alexa App to Setup Echo Alexa
Download the Alexa App for Alexa app download setup, Echo Dot Setup-Download AlexaApp Echo setup, connect echo to wifi,

SETUP ALEXA DOT
FOR TECHNICAL SUPPORT TO SETUP ALEXA DOT CONTACT US AT TOLLFREE:+1-888-409-8111. OR MAI: [email protected] http

Download Alexa App for Echo Plus Setup
If your echo won't connect to wifi Or having any problem to setup Alexa to Wifi then Don't Worry we are here to help you

Register And Setup Alexa Echo Wifi Network
If your echo won't connect to wifi Or having any problem to setup Alexa to Wifi then Don't Worry we are here to help you

How to Download Alexa App On Samrtphone
To Setup Amazon Echo device, one needs to Download Alexa App, have uninterrupted Wifi and a power source for the device.

GL200 GPS Tracker How to Setup - GpsGate.com
Apr 14, 2011 - RE: GL200 GPS Tracker How to Setup. Thu Sep 22, 2011 12:01 am. The SIM card inside the QuecLink GL200 is