An Amazon Echo LED demo project.
JavaScript Arduino
Latest commit c5fe8d0 Jul 10, 2016 @aaroneiche Clarifying updates to readme.
Signed-off-by: Aaron Eiche <aaron@aaroneiche.com>

readme.MD

Echo LED Control Demo

This project is a simple demo of controlling an WS2811 RGB LED strand with an Amazon Echo.

Components

secure.js is the application. It runs a webserver, listens for requests coming from an Amazon Echo, carries out the request (a color change) and generates/sends a response. Because of the SSL requirement of Echo interactions, the web server is HTTPS only. You will need to provide certificates (Key, Certificate, and CA) In this file you must configure which serial port to use, and the certificates. You'll need to turn on port forwarding on your router at home to get requests to your computer (or Raspberry Pi or whatever you run this on.)

arduino.ino is Arduino firmware. It receives serial data (through whatever port you define) and writes out the RGB data to the WS2811 strand. It depends on Adafruit's NeoPixel library.

Setting up an Echo

In order to make all this work, you're going to need to setup your Amazon Echo with a skill to interact with your server. Here are some settings information

Skill Type: Custom Interaction Model

Name: Whatever you want to call it.

Invocation Name: I used Oberon because it was unique phonically, and I enjoyed commanding a magical King. I'd prefer you not use Oberon or if you do, don't publish a skill using it.

Interaction Model

This is where all the important info for the skill goes

Intent Schema
{
    "intents": [
     {
         "intent":  "SetColor",
         "slots": [
           {
             "name":"color",
             "type":"LIST_OF_COLORS"
           }
         ]
     },
     {
          "intent": "Lights",
          "slots": [
              {
                "name":"channel",
                "type":"CHANNEL_VAL"
              },
              {
                "name":"to",
                "type":"ON_OFF"
              }              
          ]
     }
  ]
}
Custom Slot Types
CHANNEL_VAL 1 | 2 | 3
LIST_OF_COLORS  blue | red | green | yellow | orange | purple | white
ON_OFF  ON | OFF
Sample Utterances
SetColor change color
SetColor change the color
SetColor change color to {color}
SetColor change the color to {color}
SetColor set color to {color}
SetColor set the color to {color}

Lights turn {to} the lights
Lights turn {to} light {channel}

Configuration

You'll need to use an HTTPS endpoint (because you can't plug your Arduino into a Lamba function) I have a domain I point back home - you should be able to use a dynamic DNS domain.

SSL certificate

As mentioned above, you'll need an SSL cert. Amazon didn't seem to respect Let's Encrypt certificates when I built this, it may have changed since then. You can use a Self signed certificate though because you're only running this at home and not publishing the skill.

Everything else in the config is there for published skills. Once you get it setup, you can test commands against your server.

This project is detailed at this blog post, and a video demonstrating the project can be found at Youtube.