Now-a-days when somebody talks about IoT, applications that comes to your mind would be smart home or smart city, geo-positioning and smart fitness devices. These may seem quite exciting for the general public, but for a technologist, the question becomes what to explore next and play with?
Integration of voice to IoT is the next hot concept gaining momentum now. This space is getting attention from one of the best organizations, Amazon, Google and Apple to name few. Amazon released Echo in November 2014, Google came up with Google home in November, 2016 and Apple came with HomePod in June 2017.
I’m sure the next thought would be, it’s good to have what we have, but integrating voice with IoT would be a mammoth task. I thought so too, but after I tried Amazon Echo my view changed dramatically. In this blog post, I would be covering a high-level view on how voice can be integrated to any IoT solution.
To start with let’s have a view on a general architecture for any IoT solution. In general, an IoT solution would have below components:
■ End points: A sensor (for sensing data) or an actuator (to perform an action).
■ Gateway: This acts as a central control point for these sensors or actuators.
■ Cloud App: This application works as a backend and connects the gateway to Internet.
To integrate the voice to IoT solution, we can choose a cloud application or gateway as an integration point but let’s take cloud as an integration point for now. There are few more concepts that would be handy while explaining integration.
Alexa: This is a voice service from Amazon, similar to Google assistant or Siri from Apple. AWS has provided an interface for developers to add skills.
Skill: A skill in Alexa is a capability to perform an action. There is comprehensive skill library available e.g. weather forecast or querying Wikipedia or request a cab.
AWS Lambda: Lambda is a cloud service provided by AWS to run custom code written using Java, NodeJS or python without need to any hosted machine.
Integrating voice is a 3-step process:
■ Add a custom skill to Alexa. Alexa provides a special type of skill category for smart homes, “Smart home skill API.” If we need to add a smart home related skill, we need to add skill with skill type as “Smart home skill API”.
■ Configure authorization links which provides token based authentication for your solution.
■ Create a lambda function. This lambda function acts as a bridge between language understood by Alexa and the cloud application. There are two major functions provided by Lambda.
Once the voice integration is done:
■ Provide Alexa with endpoints which support this skill, for home automation it could be a controllable device.
■ Perform action on endpoint based on input from Alexa.
This completes the integration infrastructure. The below flow of events will help visualize the whole flow:
■ Any user looking to use a functionality provided by your solution must log on to Alexa app and customize the skill. User can search for available skills.
■ Alexa will ask for user to validate credentials to your solution using authorization link provided in step 2 above.
■ Alexa issues a discovery command to lambda function and receives array of supported endpoints. Each endpoint along with certain parameters contains a friendly name which is used by Alexa to identify endpoint based on input voice command.
■ User speaks to issue a command, e.g. “switch on Bedroom fan.”
■ Alexa identifies endpoint and command. Bedroom fan as endpoint and switch as command in above example.
■ Alexa calls lambda function with these parameters.
■ Lambda function then translates the call to the format as understood by cloud app, it could be a calling a REST service exposed by cloud app or an entry in database which could be picked up by cloud app to perform the command.
■ Response is sent back to Alexa which is then again converted back to voice, played by echo.
So you see, Amazon has made it quite easy to integrate voice to any of your IoT solution. Integrating voice gives enormous powers to a solution and surely is the next step in the general direction. This opens up an all new world in the world of smart home technological innovation e.g. interacting with robots, voice command based home automation solutions, integration voice with location systems for enhanced mobile marketing via voice notifications among others.