Introduction
Digital Input and output are widely used in industrial field. This article will guide you how to trigger the state of DO. About DI/DO wiring, please refer to How to Wire DI/DO of Milesight UC Series Controller?
Requirement
- Milesight LoRaWAN Controller: UC11xx, UC11-N1, UC50x Series
- Milesight IoT Cloud
- Toolbox
Configuration
1. Trigger DO through Direct Downlinks
Milesight LoRaWAN controller supports Do activation via downlinks directly. Before sending, ensure the controller has joined the network. Here are the downlink command (HEX):
DO control | UC11XX series | UC11-N1 and UC50x series |
Set DO1 high | 09 01 00 ff | 03 01 00 ff |
Set DO1 low | 09 00 00 ff | 03 00 00 ff |
Set DO2 high | 0a 01 00 ff | 04 01 00 ff |
Set DO2 low | 0a 00 00 ff | 04 00 00 ff |
Default downlink port is 85 by default and you can change it via ToolBox.
Take Milesight gateway embedded network server as example, go Network Sever > Packet to send downlink command with port 85.
After the instruction is issued, the content of the ACK received indicates that the status of the DO has changed successfully.
Besides, Milesight gateway also supports DO activation via below methods:
How to Connect LoRaWAN Gateway to MQTT Broker?
How to Use Gateway Built-in Node Red to Control DO
2. Trigger Do via Milesight IoT Cloud
Connect the gateway and UC to Milesight IoT Cloud, then you can control the DO easily by pressing the button. About how to connect the gateway and sensor to Milesight IoT Cloud please refer to this article: How to Connect Milesight Gateway to Milesight IoT Cloud
Go My Devices> Device > UC controller to click the button for changing the state of DO.
3. Control DO port through IF&THEN Command
UC11xx series supports IF & THEN Command settings, which provides many trigger conditions. Here are two examples.
3.1 Control DO via the device restarts
Open the command page and try to edit the configuration. You can select the IF condition to trigger DO, and set the DO triggering state, delay and duration the ‘Then’ control. There is 3 states of DO setting activate, de-activate or change state. For example, we set the ‘the device restarts’ as the trigger event.
After the configuration is complete, click Save the command to Device to save the IF&THEN program.
After restarting the device, it can be seen from the status page that the DO status has changed to 'High'
3.2 Control DO via ‘Received a message’
Set IF Event as ‘Received a message’, you can customize the downlink command to trigger the DO. In this example fill in Containing with ‘test’.
Go Network Sever > Packet to send downlink command from the gateway:
Send the command FF120474657374
FF12 //Fixed
04 //Length of this command
74657374 //Your customized contents: test
We can see the ACK reply of the UC controller, this means that the device has received the command and is about to execute the command.
After 10s delay, DO triggers as IF&THEN settings.
----END----