Disclaimer: This is a documentation on a personal project, the source code has not been audit or heavily tested, thus no guarantee on its security, it's NOT production ready, please use it at your own risk.
This documentation is streamlined from an original project that uses Amazon Alexa to accept voice commands to move a robotic arm whose motors are controlled by an Arduino, to play a sliding puzzle. With application specific parts stripped away, this repo focus on a generally referrable and reusable structure/template that achieves: duplex communication between Arduino and Alexa Skill via HTTP API call.
More specifically, an Arduino Webclient will be set up to query states from or update new states to Alexa Skill running on Amazon Lambda function through a defined API in JSON format.
Here is a short video demo
Hardware:
Environment:
Amazon Account:
Get IP Detail
and look at Assignment
field to see whether it's statically assigned IP.ask-sdk
version1 exits, but by the time of writing, there has been a newer release, still, no worry at all, migration using ask-sdk-v1adaptor
is simple! Plus the update of ask-sdk
only affects minimal code in Alexa skill, the rest of the steps, configuration procedure remain unchanged.STEP 0: System Architecture
STEP 1: Alexa Skill built with ASK-SDK
and ASK CLI
STEP 2: Implement Web Server in another Lambda Function
STEP 3: Configuring Amazon API Gateway
STEP 4: Invoking between Lambda Functions
STEP 5: Configuring Amazon CloudFront
cdn
for JSON requestSTEP 6: Implement Arduino WebClient
(Additional) A hacky way to keep Alexa Echo waiting for minutes without ending the session
This write-up doesn't put completeness on top, but instead it give disproportionate emphasis/details on things matter or things I wish I could have read or have as a guide during my development.
If you find this write-up useful and intend to wrap it into a more full-fledged documentation, please feel free to fork this repo or submit any issues. Any Pull Request are welcomed!
Plus, all code and markdown files are all under MIT license.
ASK-SDK v2
&& necessary documentation.