Description

Milesight Router UR32/UR35/UR75 supports 1 digital output. This article describes the principle of DO and how to control DO. The hardware design of DO on these models is the same. In this article UR32 is taken as example.

The PIN definition on UR32 is as below. For other models please refer to corresponding quick guides.

PINRS232RS485*DIDODescription
1---------OUTDigital Input
2------IN---Digital Output
3GND---------Ground
4------COMCOMCommon Ground
5RXDB------Receive Data
6TXDA------Transmit Data



1. Principle of DO

DO is Optocoupler output. When DO outputs low level, the circuit turns on. When DO outputs high level, the circuit turns off. So you need to add power in external circuit to control device. DO port can accept 30V DC (max) input. Output current is 0.3A and output power is 0.3W. Because of the low output power, it’s not used to drive external device. In real case when DO port is connected with high voltage input, you need to add a resistance in series to make sure the circuit works correctly.


 

2. Ways to control DO

Note: do not use more than one trigger ways at the same time.


Requirement

  • Milesight Router UR32/UR35/UR75
  • Battery(12VDC) and buzzer LED


Configuration

Make connection according to the below drawing:

COM -- Battery(-) -- Battery (+) -- LED --DO

When DO outputs low level, the circuit turns on, and LED is on.

When DO outputs high level, the circuit turns off, and LED is off.


Simple Test

Here’s simple test to check if DO is working correctly:

  1. Enable DI setting on Industrial -> I/O -> DI and set Action as DO; 
  2. Enable DO settingon Industrial -> I/O -> DO, then change DO mode and click Save and Apply button. DO mode means when DI triggers, DO will change to this mode. When it’s set “High Level”, DO status is low level DI triggers, LED is on. When it’s set “Low Level”, DO status is high level without DI triggers, LED is off.


 Trouble Shooting:

  1. During test LED is always off.

A. Check if LED can be on when connecting with the battery.

B. Check if Modbus Slave mode is already dis

C. Check if you click Save and Apply button to make settings take effect.

D. Check if you connect to the correct PINsof DO.

  1. During test LED is always on.

A. Check if there is short circuit in wiring.

B. Check if COM port and OUT port connected oppositely.

C. Check if Modbus Slave mode is already disabled.


 

Trigger by DI

  • Go to Industrial -> I/O -> DI to configure DI Setting.
  1. Click Save. Then go to Industrial -> I/O -> DO to enable DO and configure mode.Click Save and Apply button.

In this example, when DI changes to low level (make PIN1-IN and PIN2-GND short connected), DO will be triggered as high level for 1 second.


 

Trigger by SMS

  1. Go to Network -> Interface -> Cellular to configure SMS Centernumber. SMS center number is different based on different Telecom operators.
  1. Go to System -> Phone & SMS -> Phone to add Phone Number List and Phone Group List.Click Save and Apply button.
  1. Go to Industrial -> I/O -> DO to configure Mode as Custom. Select the initial status and phone group.Click Save and Apply button.
  1. SMS content to control DO is as below.

set do1 low, 20   // set DO to output low level, 20 means duration of outputting low level is 20s.

set do1 high, 0   // set DO to output high level, 0 means continuously outputting high level.

do information   // query the current DO status.


After receiving the SMS, router will send response as below.


 


Trigger by CLI Commands

You can control DO by CLI commands as below.

ROUTER> en

ROUTER# conf t

ROUTER(config)# industrial-io-output 1

ROUTER(config-output_io)# mode-out low

ROUTER(config-output_io)# no shutdown               //set DO to output low level.

ROUTER(config-output_io)# mode-out high

ROUTER(config-output_io)# no shutdown             //set DO to output high level.


 

Trigger by Modbus TCP

  1. Enable Modbus TCP on Industrial -> Modbus Slave -> Modbus TCP. Configure port and DO address. The DO address can’t be 1.Click Save and Apply button.
  1. Run Modbus Poll software. Connect to the router by Modbus TCP/IP and configure IP and port. In this example, UR32 is connected to PC via LAN port. So IP is LAN IP 192.168.1.1.Select function as “01 Read Coil (0x)”.Then you can read current DO status on Modbus Poll.


  1. Double click the value of the register, you can control DO status by changing the value.

off/0 means low level, LED turns on.

on/1 meas high level, LED turns off.


 


Trigger by Modbus RTU

  1. Connect the router to PC via USB to RS232/RS485 cable. Take RS232 as an example.
  2. Enable Modbus Slave mode on Industrial -> Serial Port -> Serial RS232 type.Click Save & Apply button.
  1. Enable the corresponding serial port on Industrial -> Modbus Slave -> Modbus RTU. Configure Slave ID and DO address. DO address can’t be 1.Click Save and Apply button.
  1. Run Modbus Poll software. Connect to the router by Serial Port mode.Then you can control DO by changing the value of the register.



Trigger by Modbus RTU over TCP

  1. Run Netassist software as TCP server. Make sure the TCP server is reachable from the router.

In this example, router is connected to the PC via LAN port. And PC IP is 192.168.1.100.


  1. Go to Industrial -> Modbus Slave -> Modbus RTU over TCP and enable it.

Device ID: user-defined

DO address can’t be 1.

Configure the server IP and port which is set on Netassist software.

Click Save and Apply button. And the router will be connected after a while.

  1. Then you can send command from TCP server to control DO status.

Control command varies according to the Slave ID and DO address.

In this example, Slave ID is 1 And DO address is 0.

Control frame:

Slave IDFunction CodeStart(DO Address)Value
CRC Parity
0x010x050x00 0x00
0xFF 0x00

(high level)

0x8C 0x3A
0x010x050x00 0x00x00 0x00
(low level)
0xCD 0xCA

If DO is controlled successfully, the router will send the same frame as response.