Demonstration

System Architecture

How System Works

When an user says to Amazon Echo Dot: "Alexa, ask Cocktail Machine to give me cocktail_name", the following works will be done:

Amazon Echo streams this sentence to Alexa Service

Alexa Service process this sentence based on configuration of Cocktail Custom Skill and then send " cocktail_name" to AWS Lambda function via endpoint of the Lambda function (URL or Amazon Resource Names (ARNs)). This Endpoint has been configure in Custom Skill configuration

Lambda function publish a message which contains cocktail_name to a topic in MQTT broker.

PHPoC (a IoT Hardware platform, which already subscribed the topic) receives this message, It get cocktail_name and control the step motor to make cocktail based on the recipe.

I have an article (Amazon Echo – Control DIY IoT devices) which explains in detail and shows step by step how to use Amazon Echo to control DIY IoT devices.

Every step of this project is almost the same, there are only some difference on interaction model configuration and source code. You can do step by step on that link. I only show the differences in this article.

Alexa Service - Custom Skill Configuration

Skill Information

Interaction Model

Intent Schema

{ "intents": [ { "slots": [ { "name": "drinkName", "type": "DRINK_TYPE" } ], "intent": "cocktail" } ] }

Custom Slot Types : DRINK_TYPE

summer rain screw driver black Russian black Russian two sweet Martini Martini

Sample Utterances

cocktail give me {drinkName} cocktail make {drinkName} for me

Lambda Source Code.

This is Node.JS code and will be run when Alexa Service make the request to Lambda.

Each lambda code function have and Endpoint, called Amazon Resource Names (ARNs) (like URL). We provide this endpoint to Alexa Service Skill when we configure the Skill.

For example, When an user says to Amazon Echo Dot: "Alexa, ask Cocktail Machine to give me black russian 2", Alexa Service will send a message which contains "black russian 2" to the Lambda function via the endpoint.

Lambda function retrieves the "black russian 2", convert it to "BLACK_RUSSIAN_2" and then publish this content to a MQTT topic.

In this example, I published cocktail name to topic: alexa/phpoc/cocktail in MQTT broker of iot.eclipse.org. It's free.

PHPoC Code (device code)

This code subscribes a MQTT topic.

When receiving and MQTT message, for example, message with content: "BLACK_RUSSIAN_2", based on the recipe, it will control two step motors to get VODKA two times and KAHLUA one time.

For detail how to wiring among PHPoC, Step motor controller and Step motor, refer to this manual.

I have another projects which controls the cocktail machine via web here