Application Note Modbus RTU Gateway Master...Modbus RTU Gateway Master 2 Chapter 1 Introduction 1.1...
Transcript of Application Note Modbus RTU Gateway Master...Modbus RTU Gateway Master 2 Chapter 1 Introduction 1.1...
Modbus RTU Gateway Master
Application Note
Version: v.1.0.1
Date: 2017-04-01
Status: Confidential
Doc ID: Modbus RTU Gateway Master
Author: Sunny Guo
www.robustel.com
Modbus RTU Gateway Master
1
Contents
Chapter 1 Introduction ........................................................................................................................................ 2
1.1 Overview ............................................................................................................................................. 2
1.2 Assumptions ....................................................................................................................................... 2
1.3 Rectifications ...................................................................................................................................... 3
1.4 Version ................................................................................................................................................ 3
Chapter 2 Topology ............................................................................................................................................. 4
Chapter 3 Configuration ...................................................................................................................................... 5
3.1 Install Modbus Poll ............................................................................................................................. 6
3.2 Install Modbus Slave ........................................................................................................................... 9
3.3 R3000_ROS Configuration ................................................................................................................ 11
3.3.1. Configure Link Manager ................................................................................................................... 11
3.3.2. Configure Cellular WAN .................................................................................................................... 13
3.3.3. Configure Serial ................................................................................................................................ 15
Chapter 4 Testing ............................................................................................................................................... 18
4.1 Network Status ................................................................................................................................. 18
4.2 Run Modbus Slave ............................................................................................................................ 19
4.3 Run Modbus Poll ............................................................................................................................... 21
4.4 Communication process ................................................................................................................... 24
4.5 Serial Port Status............................................................................................................................... 26
Modbus RTU Gateway Master
2
Chapter 1 Introduction
1.1 Overview
RobustOS (hereinafter referred to as “the ROS”) is a new operating system for Robustel's IoT gateway released in
2015. It is a modular and open software platform which could support third party development based on SDK/API.
Meanwhile, it supports different routing and VPN protocols for different application scenarios. This newer platform
provides a different web configuration interface than the existing platform.
R3000 supports Modbus RTU to Modbus TCP protocol transformation. It can be set as TCP client if it gets a public IP
address, and then Modbus Poll site acting as TCP Client can connect to Server via TCP connection and poll the
Modbus TCP data to R3000.
This application note has been written for customer with a good understanding of Robustel products and a basic
experience of VPN.
1.2 Assumptions
This application note has been written by technically competent engineer who is familiar with the Robustel products
and the application requirements.
This application note is based on:
Product model: Robustel GoRugged R3000, an industrial cellular VPN router
Firmware version: R3000_ROS_V2.0.3
Configuration: This application note assumes the Robustel products are set to factory default. Most of
configuration steps are only shown if they are different from the factory default settings.
Modbus RTU Gateway Master
3
1.3 Rectifications
Requests for corrections or rectifications to this application note will be appreciated, and if there are any request for
new application notes please email to: [email protected].
1.4 Version
Updates between document versions are cumulative. Therefore, the latest document version contains all updates
made to previous versions.
Release Date Firmware Version Change Description
2017-02-08 v.1.0.0 Initial Release
2017-04-01 v.1.0.1 1. The File Name change:
Modbus Master -> Modbus RTU Gateway Master
2. The Cover change
3. Firmware version change:
R3000_ROS_V2.0.3.fs-> R3000_ROS_V2.0.3
Modbus RTU Gateway Master
4
Chapter 2 Topology
1. Modbus Mater device acts as TCP Client, connects to Server and polls data to Modbus Slave device through
R3000.
2. The R3000 gets a public IP address and acts as TCP Client.
3. The R3000 works under “Modbus RTU Gateway” mode, receives Modbus TCP data, transforms to Modbus RTU
protocol, and then sends to Modbus Slave device via serial interface (RS-232 or RS-485).
4. After Modbus Slave device responding correctly, it will send data back to R3000 with Modbus RTU protocol, then
R3000 will transform data from Modbus RTU to Modbus TCP protocol and pass to Modbus master device via TCP
connection.
5. Modbus Master device receives data from Modbus Slave device and displays correctly.
6. In this Application Note, Modbus Poll software is simulated as Modbus Master device and Modbus Slave
software is simulated as Modbus Slave device. Modbus Slave connects to R3000 via the RS-232.
Modbus RTU Gateway Master
5
Chapter 3 Configuration
Download Modbus Poll and Modbus Slave from http://www.Modbustools.com/download.asp.
Modbus RTU Gateway Master
6
3.1 Install Modbus Poll
1. Run ModbusPollSetup.exe.
2. Choose “I accept the terms in the License Agreement” and click “Next”.
Modbus RTU Gateway Master
7
3. Browse and specify a destination folder, then click “Next”.
4. Click “Install”.
Modbus RTU Gateway Master
8
5. Click “Next” to finish the installation.
Modbus RTU Gateway Master
9
3.2 Install Modbus Slave
1. Run ModbusSlaveSetup-431.exe.
2. Choose “I accept the terms in the License Agreement” and click “Next”.
Modbus RTU Gateway Master
10
3. Browse and specify a destination folder, then click “Next”.
4. Click “Install”.
Modbus RTU Gateway Master
11
5. Click “Next” to finish the installation.
3.3 R3000_ROS Configuration
3.3.1. Configure Link Manager
1. Follow these steps before configuring the router:
Attach the external antenna to the router’s connector and twist tightly
Insert the SIM card into the router
Connect the power supply correctly
Log in the Web GUI of the router
Modbus RTU Gateway Master
12
You need to know the following factory settings before you have logged in the Web GUI.
Item Description
Username Admin
Password Admin
Eth0 192.168.0.1/255.255.255.0, LAN Mode
Eth1 192.168.0.1/255.255.255.0, LAN Mode
DHCP Server Enabled
2. Browse to Interface > Link Manager.
Click the drop-down list of “Primary Link” and select “WWAN1”.
Click “Submit”.
Click “Save & Apply”.
Item Description Setting
Primary Link Select “WWAN1”, “WWAN2” or “WAN” as the primary
connecting interface.
WWAN1
Modbus RTU Gateway Master
13
3.3.2. Configure Cellular WAN
Browse to Interface > Link Manager > Link Settings.
Click the edit button of “WWAN1”.
Enter the related parameters in the “WWAN Settings” window.
Enter the related parameters in the “Ping Detection Settings” window.
Click “Submit”.
Click “Save & Apply”.
The window is displayed as below when enabling the “Automatic APN Selection” option.
Item Description Setting
Dialup Number Set the dialup number for cellular dial-up connection, provided
by local ISP.
*99***1#
Data Allowance Set the monthly data traffic limitation. 0
Billing Day Specify the monthly billing day, and the data traffic statistics will
be recalculated from this day.
1
Modbus RTU Gateway Master
14
The window is displayed as below when disabling the “Automatic APN Selection” option.
Item Description Setting
APN Enter the Access Point Name for cellular dial-up connection,
provided by local ISP.
internet
Username Enter the username for cellular dial-up connection, provided by
local ISP.
Null
Password Enter the password for cellular dial-up connection, provided by
local ISP.
Null
Item Description Setting
Primary Server Router will ping this primary address/domain name to check if
the current connectivity is active.
8.8.8.8
Secondary Server Router will ping this secondary address/domain name to check if
the current connectivity is active.
Null
Interval Set the ping interval. 10
Modbus RTU Gateway Master
15
Retry Interval Set the ping retry interval. 3
Timeout Set the ping timeout. 1
Max Ping Tries Switch to another link or take emergency action if max
continuous ping tries reached.
1
3.3.3. Configure Serial
1. Browse to Interface > Serial Port.
Click the edit button of “COM1”.
Modbus RTU Gateway Master
16
Configure the related parameters as the following diagram and click “Submit”.
Item Description Setting
Application Mode Select from “Modbus RTU Gateway” or “Transparent” Enter accordingly
Protocol Select from “TCP Client”, “TCP Server”, “UDP” or “Robustlink” Enter accordingly
Server Address Enter the IP address of the server. Enter accordingly
Server Port Enter the port of the server. Enter accordingly
Modbus RTU Gateway Master
17
Click “Save & Apply”.
Modbus RTU Gateway Master
18
Chapter 4 Testing
4.1 Network Status
1. Click “Status” bar.
2. Check whether the ROS has obtained the assigned static IP address.
3. Check whether the ROS has used SIM card to register to network, dial up to get IP address and access the
Internet.
Modbus RTU Gateway Master
19
4.2 Run Modbus Slave
1. Run Modbus Slave.
2. Go to tab “Setup > Slave Definition” to set the Modbus Slave ID. Its default value is 1.
Modbus RTU Gateway Master
20
3. Go to tab “Connect”.
4. Select “TCP/IP” in the “Connection” item, and enter its port number. Now Modbus Poll is a TCP Client. It is the
same with the port number which has been set at section 3.3.3, then click “OK”.
Modbus RTU Gateway Master
21
5. Go to “Alias” and change the value of different address. For example, change value to “1, 2, 3….”.
Note: Setting change is used to check if Modbus Poll site’s correspondent address would change to the same
value as Modbus Slave.
4.3 Run Modbus Poll
1. Run Modbus Poll.
2. Go to tab “Setup > Slave Definition” to set the Modbus Slave ID which must be the same with the “Slave ID” that
is set in Modbus Slave. Its default value is 1.
Modbus RTU Gateway Master
22
3. Click “Connection > Connect”.
Modbus RTU Gateway Master
23
4. Choose “Serial Port” as the connection, connect to R3000’s serial port and set the same settings of R3000’s
serial settings. Choose “RTU” as the mode and click “OK”.
Note: “RTU” mode means that Modbus Slave sending data out with Modbus RTU mode.
5. After step 4, if the TCP connection has been set up between PC and R3000, it will show us the following figure.
TX number is improving, which means the Modbus Poll has already sent data out based on the connection. The
test is successful.
Note: If wrong port number input, we cannot establish the TCP connection. By contrast, it will show us the
following figure:
Modbus RTU Gateway Master
24
4.4 Communication process
We can also click “Display > Communication” in both Modbus Slave and Modbus Poll to check whether the source
data is correct. Data displaying is based on Modbus RTU or Modbus TCP protocol.
1. In Modbus Slave site, go to tab “Display > Communication”.
Modbus RTU Gateway Master
25
2. In Modbus Poll site, go to tab “Display > Communication”.
Modbus RTU Gateway Master
26
4.5 Serial Port Status