Introduction
MQTT is a lightweight publish-subscribe messaging protocol which is widely used in Internet of Things. This article will describe how to connect UC300/UC3x cellular controller to AWS IoT platform via MQTT.
Requirement
- Milesight Controller: UC300 (cellular version), UC3x
- SIM card
- MQTT Broker
- MQTT client software (Take MQTTX as example)
- Toolbox software
Configuration
1. Insert the SIM card to device and ensure it registers to Internet network.
2. Go to Application page to select the application mode as MQTT and configure MQTT broker settings.
3. Open MQTTX software, fill in the MQTT broker info and click Connect at the top right corner. (Client ID and TLS certificates should be unique)
4. After connected to MQTT broker, click +New Subscription to subscribe uplink topics to get data.
Take UC300 as example , you can subscribe topic uc/[Device SN]/ucp/14/+ to get all uplink data.
It’s suggested to change the receive window format as Hex to get uplink data. For payload description, please refer to communication protocol of every model.
5. When sending downlinks, set the format as Hex and fill in the downlink topic and commands to get info or control device. In this example, we send 7e0508001001017e to control UC300 DO1 to open.
Note: for UC300, it’s suggested to subscribe topic uc/[Device SN]/ucp/14/+/update/accepted and uc/[Device SN]/ucp/14/+/update/rejected to know check if downlink command is valid.
If the downlink is invalid, the device will send the reply via topic uc/[Device SN]/ucp/14/+/update/accepted.