8.2.3. BIGIOT

BIGIOT is an IoT cloud platform that makes it easier for you to communicate with smart devices. You can chat with your smart device, send instructions, and view real-time data in the form of conversations and remote controls through the Internet, set alarm conditions according to actual needs, and notify users through APP, email, SMS, Weibo, WeChat, etc.

https://www.bigiot.net/Public/upload/UEditor/image/20181024/1540363897144665.jpg

BIGIOT architecture

8.2.3.1. Connect mPython Board to BIGIOT

8.2.3.1.1. Get ready

8.2.3.1.2. Communication between devices

simple bigiot communication examples:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from mpython import *
import bigiot

my_wifi = wifi()
my_wifi.connectWiFi("youruser", "yourpassword")

ID = ""                             # 设备ID
API_KEY = ""                        # 设备APIKEY



def say_cb(msg):                    # 回调函数
    print(msg)
    oled.DispChar("%s,%s" %(msg[0],msg[1]),0,10)    # 显示到oled
    oled.show()
    oled.fill(0)


device = bigiot.Device(ID, API_KEY)         # 构建bigiot 设备

device.say_callback(say_cb)                 # 设置say通讯的回调函数

device.check_in()                           # 登陆

Prior connection to BIGIOT platform, ensure the mPython Board is connected to Internet. While instantiating Device(id,api_key) , use the smart device information of BIGIOT, ID and API KEY . Set the callback function for say communication say_callback(f) . f(msg,id,name)callback function, msg parameter is the received message, id parameter is the sending device ID, name parameter is the device name. check_in() is the online function of the device, you can see the connection status of the device on BIGIOT. In the above example, set the callback function and print out the data received by say communication.

8.2.3.1.3. The client sends a message to the dashboard

BIGIOT supports communication between multiple clients and devices, such as browsers, WeChat mini-program public accounts, and APP (Android).

../../../_images/bigiot_1.gif

Browser

../../../_images/bigiot_2.gif

WeChat Mini Program

8.2.3.1.4. The mPython Board sends to the device or client

8.2.3.1.4.1. Device

You can add multiple smart devices on the Shell IoT platform at the same time. As long as the smart device is online and knows the ID of the device, you can send messages to the smart device.

To ID: 7947 device sends a message:

>>> device.say(device_id = 7947, msg = 'hello I am mPython')

8.2.3.1.4.2. Client

Send messages to clients such as web or WeChat, you can view your user ID on the platform “Personal Information”

>>> device.say(user_id = 5600, msg = 'hello I am mPython')

8.2.3.1.4.3. Group

You can also set up multiple smart devices on the platform to form a group and send messages to the group, so that all members of the group can receive messages, similar to the IP multicast function:

>>> device.say(group_id = 145, msg = 'hello I am mPython')

say(user_id, group_id, device_id, msg) this function is used for device or client conversation. user_idgroup_iddevice_id parameters are user ID, group ID, device ID. Use parameters according to the dialogue object. msg is a conversation message, the type is a string.

8.2.3.1.5. Send data to the interface

To the interface: 9564, send the light data of the mPython Board:

while True:
    val=light.read()
    device.update(9564,str(val))
    sleep(1)

BIGIOT provides an interface for collecting real-time sensor data and drawing charts. update(id, data) is the function of uploading data. id is the interface ID, and the data parameter is the uploaded sensor data. Note that this type is a string. If it is int, it needs to be converted to str. Also, data transmission should not be too fast, at least 1 second interval.

8.2.3.2. Voice Assistant

BIGIOT can also connect with Tmall Genie and Baidu Voice Assistant, and Shell Internet of Things devices as clients. Receive voice commands from the server. Realize the application of voice control for smart home.

8.2.3.2.1. Tmall Genie control method for BIGIOT

Tmall Genie control methodd reference tutorial: https://www.bigiot.net/talk/359.html