The demo´s purpose is to know more about how a personal assistant solution (like Amazon Alexa Voice) works. To do so I had used some common components to IoT, like NodeMCU and Raspberry PI.

Items list:

  • relay module;
  • NodeMCU;
  • Raspberry PI;
  • microphone;
  • speaker;
  • fan;

topologia alexa voice

The system is about Amazon Alexa Voice service that is installed in Raspberry. From a script, Raspberry sends an authorization request to Amazon (via OAuth 2.0 protocol) in order to run the related service onboard.
After that, Raspberry must run a web service on Node.js that will communicate with AVS (Alexa Voice Service) which one is hosted in Amazon cloud service. The web service gets data from a java client that also runs on Raspberry having a microphone as an input .

At the same time, NodeMCU acts as a MQTT subscriber and have a relay in one of its output channels. The Publisher is an Adafruit cloud service and the communication happens through NodeMCU built-in wi-fi.

IFTTT service works as a link among services and ties them together. In this case, IFTTT connects AVS and Adafruit, so Adafruit can send an instruction via MQTT that will reach NodeMCU and will be interpreted by its programming code. The so called link that is made by IFTTT follows the conditional expression If This Then That (just like its acronym suggests). So, we can have an If case like: If instruction for the word “hot” on Amazon voice command as a “trigger” Then the instruction “on” is sent to the Adafruit service known as a “feed”. In other words, the voice command (trigger) is the This part and the on command (feed) is the That part which is also the MQTT topic. This condition expression in IFTTT is called Applet. It´s necessary also the dual one for the demo to work. That would lead to: If cold then “off” instruction which will turn off the fan attached to the relay.

 

The system can work also from other combinations like web server on Windows or Mac, client running on Python and orchestration made by a board/hardware other than Raspberry.
It can be very usefull as people may need a hands free way for doing tasks or just want to use voice commands to control a device remotely by Internet.