How to Control QBoat Sunny via Voice Control

In this tutorial, we will be using voice control to call upon the data generated by DHT11, with the help of QIoT Suite, an Ubuntu Container and Dialogflow (formerly

What You’ll Need:

  • QBoat Sunny
  • Microphone
  • Speakers
  • MediaTek LinkIt 7697
  • DHT11 Temperature and Humidity Sensor
  • Container Station
  • Files used: Download Here

Create Container and Install Dependencies

  1. Create the Ubuntu container.
  • Open Container Station > Create > Search for Ubuntu and Install/Create the LXCcontainer.
  1. Install the dependencies.
  • SSH to the NAS. Instructions can be found here.
  • Enter the following lines:
    • $ lxc-container -n <container name>
    • $ sudo apt update
    • $ sudo apt install python-pip
  • Install dependencies:
    • $ pip install SpeechRecognition
    • $ sudo apt-get install espeak
    • $ sudo apt-get install python-pyaudio python3-pyaudio
    • $ pip install paho-mqtt

Import Files into Ubuntu Container

  1. Open File Station and navigate to /Container/container-station data/lib/lxc/<container-name>/rootfs/home/ubuntu
  2. Drag the speak folder into File Station
    Note: for English speech recognition, change the following numbers to:

    • Line 33: commandspeak = 'espeak -s 200 -v en+f3 \"' + text +'\"'
    • Line 39: audioin, key=None, language="en-US", showall=False)*

Mount Sound Device to Container

Instructions found here.

Create and Setup the QIoT Suite Application

  1. Open QIoT Suite > IoT Applications > Import > select MQTTHome.json
  2. Open the MQTTHome application and click on the Connect a Device icon for speak thing.
  3. Select MQTT > click Next > Download JSON file

Connect LinkIt 7697

  1. Connect the DHT11 to LinkIt 7697.
    • GND to GND
    • VCC to 5V
    • Signal to P3
  2. Download and Install the Arduino IDE here
  3. Open combined.ino in Arduino IDE
  4. Change the following lines in according to the JSON file downloaded from QIoT’s MQTT JSON file.*
    Lines that need change are have ALL-CAP comments beside them, you probably won’t miss them! Here’s a list just in case:

    - QIoT MQTT Username (from JSON)
    - QIoT MQTT Password (from JSON)
    - QIoT MQTT ClientID (from JSON)
    - QIoT IP Address
    - WiFi SSID
    - WiFi Password
    - Port (from JSON) for uploading
    - Port (from JSON) for downloading*
  5. Upload this file to LinkIt.

Setup Dialogflow

  1. Log into Dialogflow and Create a new agent for this project.
  2. Import the Intents and Entities:
    • Head into Settings  > Export and Import > Restore from ZIP
    • Upload to Dialogflow.
    • Type RESTORE and click on Restore
  3. Get access token:
    – In the settings page and under the General tab, scroll down until you find API KEYS 
    – Copy the Client access token to your clipboard.

Putting it All Together

  1. Head back to the QIoT Application (MQTTHome).
  2. Install module to Node-RED
    • Click on the Rule tab, then open Manage palette
    • Under Install tab, search for node-red-contrib-apiai and install it
  3. Connect Dialogflow to QIoT
    • Inside the speak flow, double-click on apiai-text node and edit the QIoT Agent
    • Paste the Client access token copied from before into Access Token then click Update > Done
  4. Test it out:
    • Finally, inject the Start node and speak away!

Additional Resources:

Related posts

Leave a Reply