How to Control QBoat Sunny via Voice Control

QIoT technology to allow you to explore potential IoT business opportunities.
Smart home/Smart building/Smart City/
Post Reply
Stevenmwshyu
New here
Posts: 4
Joined: Tue Jul 23, 2019 4:39 pm

How to Control QBoat Sunny via Voice Control

Post by Stevenmwshyu » Wed Jul 24, 2019 5:18 pm

Easy-to-read version : https://qiot.qnap.com/blog/2019/07/24/c ... e-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 api.ai).

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
Create the Ubuntu container.
Open Container Station > Create > Search for Ubuntu and Install/Create the LXC container.
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
Open File Station and navigate to /Container/container-station data/lib/lxc/<container-name>/rootfs/home/ubuntu
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
Open QIoT Suite > IoT Applications > Import > select MQTTHome.json

Open the MQTTHome application and click on the Connect a Device icon for speak thing.


Select MQTT > click Next > Download JSON file

Connect LinkIt 7697


Connect the DHT11 to LinkIt 7697.
GND to GND
VCC to 5V
Signal to P3
Download and Install the Arduino IDE here
Open combined.ino in Arduino IDE
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:
1 - QIoT MQTT Username (from JSON)
2 - QIoT MQTT Password (from JSON)
3 - QIoT MQTT ClientID (from JSON)
4 - QIoT IP Address
5 - WiFi SSID
6 - WiFi Password
7 - Port (from JSON) for uploading
8 - Port (from JSON) for downloading*

Upload this file to LinkIt.

Setup Dialogflow
Log into Dialogflow and Create a new agent for this project.
Import the Intents and Entities:
Head into Settings > Export and Import > Restore from ZIP
Upload test-agent.zip to Dialogflow.
Type RESTORE and click on Restore
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
Head back to the QIoT Application (MQTTHome).

Install api.ai 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
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
Test it out:

Finally, inject the Start node and speak away!

Additional Resources:
Original GitHub: https://github.com/blackmesataiwan/qboat_voice_control

Post Reply

Return to “QIoT”