Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT...

29
@k_bankole OpenWhisk.org Voice-controlled Home Automation Using Watson, Raspberry Pi, and Openwhisk

Transcript of Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT...

Page 1: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Voice-controlled HomeAutomation UsingWatson, Raspberry Pi,and Openwhisk

Page 2: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Voice Enabled Assistants (Adoption)

Page 3: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Voice Enabled Assistants (Usage)

Page 4: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Voice Enabled Assistants (Workflow)

• Initialize Voice Recording

• Record Audio

• Apply DSP algorithms

• Transcribe Audio to text

• Interpret text result

• Execute action

Page 5: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Hotword

•Background process that listens for specificspeech pattern

– “Ok, google”

– “Alexa”

– “Hey Siri”

•Able to run on devices with limited resources(Arduino, Raspberry Pi)

Page 6: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Hotword

Page 7: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

Microphone Array

•Consists of multiple microphones

•Able to record all channelssimultaneously

•Separate streams are processed toincrease transcription confidence

Page 8: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

Watson Speech to Text

Input audio via HTTP or Websocket

curl -X POST -u <username>:<password> --header "Content-Type: audio/flac” --data-binary @<path>audio-file.flac

"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?continuous=true"

{

"confidence": 0.891,

"transcript": "Turn on the light in the living room"

}

Page 9: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

Conversation

• Intent – Action userwants to trigger

•Entity – Context foraction

•Dialog – Determinesresponse, next step

Page 10: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

{

...

”input": [

{

”text": “turn on

the fan” }]

}

{

...

”entities": [

{

”confidence": 0.8745,

”value": “fan”

}],

”intents": [

{

”confidence": 0.9348,

”intent": “turnon”

}]

}

Conversation Service

Page 11: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

Conversation

Page 12: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Demo Architecture

Page 13: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

OpenWhisk provides an elegant solution

OpenWhisk is a cloud platform

that executes code

in response to events

Page 14: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Why “Serverless”?

• Focus on code, not maintenance

• Less overhead

• Reusability

• Scales on demand

• Usage based pricing

Page 15: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Respond to events

Database changes

Sensor value

Cognitive trends

Scheduled tasks

Data from Mobile devices

Page 16: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Triggers, actions, rules (and packages)

o Services define theevents they emit astriggers.

o

o Developers associateactions to handle theevents via rules.

o Packages are used tobundle and distributesets of actions

Page 17: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Triggers

A class of events that can happenT

Social events

Data changes

Device readings Location updates

User input

Page 18: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Actions

Code that runs in response to an event(that is, an event-handler)

A

Page 19: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Actions

Can be written in a variety of languages, such asJavaScript, Python, Java, and Swift

A

function main(msg) {return { message: 'Hello, ' + msg.name + ' from ' + msg.place };

};

Page 20: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Actions

Can be composed to create sequences thatincrease flexibility and foster reuse

A

AA:= A1

+ A2+ A3

AB := A2+ A1

+ A3

AC:= A3

+ A1+ A2

Page 21: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Rules

An association of a trigger to an action in a manyto many mapping.

R

R := T A

Page 22: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

Packages

A shared collection of triggers and actionsP

A

A read

write

T changes A translate A forecast

A post

T topic

OpenSource A myAction

T myFeed

Yours

T commit

ThirdParty

Page 23: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

OpenWhisk enables event driven applications

EventProviders

Cloudant

GitHub

Weather

Which triggers execution ofassociated OpenWhisk action

2

Slack

JS Swift Docker …

An event occurs, for example• Commit pushed to GitHub repository• Data entered in Cloudant

1 OpenWhisk

Page 24: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

OpenWhisk awaits events, fetches mapped code, runs it ina container

Pool of actions

Swift DockerJS

Trigger

1

Runningaction

Runningaction

Runningaction

3

OpenWhiskEngine

2

Page 25: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

Watson IoT Platform (MQTT)

• Platform enables apps toshare and consume datacollected by authenticateddevices, sensors..

• Provides real-time andREST APIs to communicatewith your devices andconsume the data

Page 26: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

CitizenM

Page 27: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

@k_bankoleOpenWhisk.org

WiFi vs RF Outlet

Page 28: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

RF Outlet (Schematic)

Page 29: Voice-controlled Home Automation Using Watson, Raspberry Pi, … · 2017. 9. 13. · Watson IoT Platform (MQTT) • Platform enables apps to share and consume data collected by authenticated

IR Outlet (Schematic)