Introduction: How to Interact Alexa With Dragonboard-410c

With this tutorial you will learn how to embed Alexa in Dragonboard-410c. Before start, let's introduce some stuffs that you need:

  • Alexa Voice Service (AVS) - Makes possible to talk with your devices, you will be able to access cloud based alexa that provide AVS Apis. Saying the wake word "Alexa" you can talk with devices and instantly receive a voice responses.
  • Alexa Skills - You can interact with a personalized experience, alexa skills means different capabilities that you can build or use with Alexa Skill Kit (ASK).
  • AWS Lambda - Allows to execute your code without having to manage the server, the only think you need to do is write your code and lambda will take control of everything.

Step 1: Configuring AVS on Dragonboard

  1. Create an account in Amazon Developer.
  2. Register your product following this tutorial.
  3. In your terminal:

Clone this repository:

$ git clone https://github.com/iccqtt/CoffeeMachine-alexa.git

Go to:

$ cd CoffeeMachine-alexa/DragonBoard410c/CoffeeMachine/scripts

And execute:

# ./setup.sh

On the script execution you need to answer some questions:

  • Note: If you're an advanced user, you can install the init script manually and edit it to reflect your install path, but we don't provide any guarantees. Interrupt? (Y/n)? n
  • Which operating system are you using?
    Your OS [debian]: debian
  • Which operating system are you using?
    Your device [raspberrypi]: other
  • Would you like to also install Airplay support (Y/n)? n

The next questions you need to answer about your device information previously registered.

4. Open folder:

$ cd CoffeeMachine-alexa/DragonBoard410c/CoffeeMachine

5. Edit file ClientAWS.py:

Set your information according to your AWS account and the certificate creation:

host = host address from your AWS IOT account endpoint.
rootCAPath = the path to the rootCA certification downloaded. 
certificatePath = the path to the certificate downloaded.
privateKeyPath = the path to private key downloaded.
clientID = an identification for your mqtt client.

For more information for how to create the certificates, please check this link.

Step 2: Creating Alexa Skills

To create Alexa skills some keywords are necessary to understand the process:

  • Invocation name - Name of your device. It will be necessary to ask device to do something.

    Example: "Alexa, ask coffee machine to turn on".

  • Slot types - Variables that can change defined states.

    Example: "Alexa, ask coffee machine make long coffee" or "Alexa, ask coffee machine make short coffee"

  • Intents - Action to satisfy the user's phrase spoken.
  • Sample Utterances - Phrases that you will say for Alexa to do something. It contains the invocation name and slot types.

    Example: "TurnCoffeMachine {CoffeeState} the coffee machine" means "on/off the coffe machine".

  1. With your amazon developer account logged, go to skills.
  2. Follow this tutorial to create a custom skill.
  3. Now you need to define an invocation name like coffee machine.
  4. For this example, let's create 2 slot types.
    1. COFFEE_STATE add values:
      • on
      • off
    2. COFFEE_TYPE add values:
      • short
      • long
  5. Finally let's create 2 intents. Intents are the phrases that you will say for Alexa to do something.
    1. TurnCoffeeMachine
      • Follow the images attached that contains details about Utterances.

    2. MakeCoffee

      • Follow the images attached that contains details about Utterances.

Step 3: Setup AWS Lambda

The AWS Lambda provides code executing without the necessity of provisioning or managing servers. It runs a code only when needed, generally these functions are invoked from Alexa Skills and executed when the user speak different types of commands.

Let's create a lambda function necessary to the coffee machine's functionality. These functions are invoked by the custom skills created on this instructable.

Requirements:

  • An active AWS account.
  1. To start the creation of the lambda function sign in to the console.
  2. Open Lambda service and go to functions.
  3. Select create function, define a name and set runtime to Python 2.7
    • After you create your role, you need to add some policies.
      1. Go to IAM and select your role defined when the lambda function was created.
      2. Attach policy AWSIoTFullAccess. (Allow lambda to publish information)
  4. Open your Lambda function and add a trigger Alexa Skills (step 2 reference).
  5. Set the attached code for your lambda function code.

Step 4: Run Your Application

  1. Connect the microphone on Dragonboard-410c
  2. Execute the application:
$ cd CoffeeMachine-alexa/DragonBoard410c/CoffeeMachine
$ python main.py

3. Say "Alexa" and wait for a voice answer.

Step 5: Conclusion

By doing these steps your Dragonbord-410c is ready to provide a communication with Alexa, and you will be able to create any type of iot device controlled by Alexa.

Complement Instructables: