Changes

Line 12: Line 12:  
Modbus enables communication among many devices connected to the same network, for example, a system that measures temperature and humidity and communicates the results to a computer. Modbus is often used to connect a supervisory computer with a remote terminal unit (RTU) in supervisory control and data acquisition (SCADA) systems. Many of the data types are named from its use in driving relays: a single-bit physical output is called a coil, and a single-bit physical input is called a discrete input or a contact.
 
Modbus enables communication among many devices connected to the same network, for example, a system that measures temperature and humidity and communicates the results to a computer. Modbus is often used to connect a supervisory computer with a remote terminal unit (RTU) in supervisory control and data acquisition (SCADA) systems. Many of the data types are named from its use in driving relays: a single-bit physical output is called a coil, and a single-bit physical input is called a discrete input or a contact.
   −
This article provides a guide on how to use Modbus TCP to monitor {{{name}}} routers with a PC using a Linux Operating System. However, the same principles apply to RUTXxx family routers, but the holding register information will differ. You can find this information in the links below:
+
This article provides a guide on how to use Modbus TCP to monitor {{{name}}} routers with a PC using a Linux Operating System.
*'''[[RUTXR1 Monitoring via Modbus]]'''
  −
*'''[[RUTX12 Monitoring via Modbus]]'''
  −
*'''[[RUTX11 Monitoring via Modbus]]'''
  −
*'''[[RUTX10 Monitoring via Modbus]]'''
  −
*'''[[RUTX09 Monitoring via Modbus]]'''
  −
*'''[[RUTX08 Monitoring via Modbus]]'''
  −
 
   
==Configuring the router==
 
==Configuring the router==
    
In order to start using Modbus TCP, we must first configure the router. Modbus TCP configuration from the router's side is very simple. All you need to do is log in to the router's WebUI, go to '''Services → Modbus''', '''Enable''' the Modbus TCP service, enter a '''Port''' number through which the Modbus TCP communication will take place and '''Allow remote access''' if you wish to connect to the router remotely (from WAN).
 
In order to start using Modbus TCP, we must first configure the router. Modbus TCP configuration from the router's side is very simple. All you need to do is log in to the router's WebUI, go to '''Services → Modbus''', '''Enable''' the Modbus TCP service, enter a '''Port''' number through which the Modbus TCP communication will take place and '''Allow remote access''' if you wish to connect to the router remotely (from WAN).
   −
[[File:Services modbus v2.PNG]]
+
[[File:Networking_rutos_manual_modbus_modbus_tcp_slave.png|border|class=tlt-border]]
    
==Installing the necessary software==
 
==Installing the necessary software==
Line 35: Line 28:  
==Getting router parameters==
 
==Getting router parameters==
   −
Modbus TCP can be used to both '''get''' and '''set''' certain router parameters. First lets do an overview of how to obtain parameters via Modbus TCP. Please keep in mind that in order to get routers parameters when using '''[https://wiki.teltonika-networks.com/view/RUT955_Modbus#Requests_configuration Request Configuration]''' you need to use '''Register Number''' instead of '''Register Address'''.
+
Modbus TCP can be used to both '''get''' and '''set''' certain router parameters. First lets do an overview of how to obtain parameters via Modbus TCP. Please keep in mind that in order to get routers parameters when using '''[https://wiki.teltonika-networks.com/view/{{{name}}}_Modbus#Requests_configuration Request Configuration]''' you need to use '''Register Number''' instead of '''Register Address'''.{{#ifeq:{{{name}}}|RUTX12| To get data from the second modem, you need to execute this command:
    +
$  modbus write -D {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW328  12589 12590 12800
 +
 +
This command sets it to primary modem:
 +
 +
$ modbus write -D {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW328  13101 12544
 +
 +
}}
 
===List of parameters===
 
===List of parameters===
 
----
 
----
 
Router parameters are held within '''registers'''. Each register contains 2 bytes of information. For simplification the number of registers for storing numerical values is 2, while the number of registers for storing text information is 16. The register addresses and corresponding system values are described in the table below:
 
Router parameters are held within '''registers'''. Each register contains 2 bytes of information. For simplification the number of registers for storing numerical values is 2, while the number of registers for storing text information is 16. The register addresses and corresponding system values are described in the table below:
   −
{{Template: Networking_rut955_manual_modbus_modbus_tcp_get_parameters_table}}
+
{{Template:Networking_rutos_manual_modbus_modbus_tcp_get_parameters_table
 +
|mobile = {{{mobile}}}
 +
|series = {{{series}}}
 +
|name = {{{name}}}
 +
|analog = {{{analog}}}
 +
|gps = {{{gps}}}
 +
|dualsim = {{{dualsim}}}
 +
}}
   −
===modbus read===
+
===Modbus read===
 
----
 
----
 
To obtain parameters from the system, the '''modbus read''' command is used. The syntax for this command is:
 
To obtain parameters from the system, the '''modbus read''' command is used. The syntax for this command is:
Line 61: Line 68:  
For the first example, lets use a modbus read command to attempt to obtain the router's uptime value in seconds. If you look back at the table above, you will see that the uptime value is stored in two registers starting from the first register, therefore:
 
For the first example, lets use a modbus read command to attempt to obtain the router's uptime value in seconds. If you look back at the table above, you will see that the uptime value is stored in two registers starting from the first register, therefore:
   −
  $ modbus read -w -p 12345 192.168.1.1 %MW001 2
+
  $ modbus read -w -p 12345 {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW001 2
    
'''-w''' specifies the data type. In this case, unsigned 16 bit integers.
 
'''-w''' specifies the data type. In this case, unsigned 16 bit integers.
Line 67: Line 74:  
'''-p''' specifies the port number.
 
'''-p''' specifies the port number.
   −
'''192.168.1.1''' - the router's LAN IP address.
+
'''{{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}}''' - the router's LAN IP address.
    
'''%MW001''' specifies the register address.
 
'''%MW001''' specifies the register address.
Line 98: Line 105:  
Lets examine a different, more complex example by issuing a request for the router's '''WAN IP address'''. If you look at the '''[[Monitoring_via_Modbus#List_of_parameters|table]]''' above, you will see that the WAN IP address value is contained within the 139th and 140th registers. Therefore, we should specify the 139th address and read 2 registers from that address:
 
Lets examine a different, more complex example by issuing a request for the router's '''WAN IP address'''. If you look at the '''[[Monitoring_via_Modbus#List_of_parameters|table]]''' above, you will see that the WAN IP address value is contained within the 139th and 140th registers. Therefore, we should specify the 139th address and read 2 registers from that address:
   −
  $ modbus read -w -p 12345 192.168.1.1 %MW139 2
+
  $ modbus read -w -p 12345 {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW139 2
    
[[File:Configuration examples modbus wan ip v2.png]]
 
[[File:Configuration examples modbus wan ip v2.png]]
Line 105: Line 112:       −
[[File:Configuration examples modbus binary ip v2.png]]
+
[[File:Configuration examples modbus binary ip v2.png|border|class=tlt-border]]
      Line 115: Line 122:       −
[[File:Configuration examples modbus ip reconstruction.png]]
+
[[File:Configuration examples modbus ip reconstruction.png|border|class=tlt-border]]
 
+
{{#ifeq:{{{mobile}}}| 1 |
 
===Signal strength===
 
===Signal strength===
 
----
 
----
Line 128: Line 135:       −
[[File:Configuration examples modbus negative binary.png]]
+
[[File:Configuration examples modbus negative binary.png |border|class=tlt-border]]
       
The value we got is '''0000 0000 0011 1011'''. When converted to decimal it becomes '''59''', so the final value is '''- 59'''
 
The value we got is '''0000 0000 0011 1011'''. When converted to decimal it becomes '''59''', so the final value is '''- 59'''
 
+
}}
 
===Text===
 
===Text===
 
----
 
----
 
Some values like Hostname, Router name, Network type are represented as text in their original form, but are stored in registers as numbers. You can interpret these values the same way as all discussed before (by converting them to binary and then to text), but a simpler way would be to get them in '''hexadecimal''' form and then convert them to text. To do so, we'll have to add the '''-D''' parameter to the command. Lets do it by asking for the router's Hostname:
 
Some values like Hostname, Router name, Network type are represented as text in their original form, but are stored in registers as numbers. You can interpret these values the same way as all discussed before (by converting them to binary and then to text), but a simpler way would be to get them in '''hexadecimal''' form and then convert them to text. To do so, we'll have to add the '''-D''' parameter to the command. Lets do it by asking for the router's Hostname:
   −
  $ modbus read -D -w -p 12345 192.168.1.1 %MW007 16
+
  $ modbus read -D -w -p 12345 {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW007 16
    
[[Image:Configuration examples modbus hostname example v2.png]]
 
[[Image:Configuration examples modbus hostname example v2.png]]
Line 143: Line 150:  
Ignore the first 9 segments and the last segments that contain only zeroes (highlighted in red). Copy the response (highlighted in green) and paste it into a hexadecimal to text (ASCII) converter:
 
Ignore the first 9 segments and the last segments that contain only zeroes (highlighted in red). Copy the response (highlighted in green) and paste it into a hexadecimal to text (ASCII) converter:
   −
[[Image:Configuration examples modbus hex to text.png]]
+
[[Image:Configuration examples modbus hex to text.png|border|class=tlt-border]]
    
==Setting router values==
 
==Setting router values==
   −
The Modbus daemon also supports the setting of some system parameters. To accomplish this task the '''modbus write''' command is used. System related parameters and how to use them are described below. The register address specifies from which register to start writing the required values. All commands, except “Change APN”, accepts only one input parameter (more on changing APN can be found below).
+
The Modbus daemon also supports the setting of some system parameters. To accomplish this task the '''modbus write''' command is used. System related parameters and how to use them are described below. The register address specifies from which register to start writing the required values. All commands, except “Change APN”, accepts only one input parameter {{#ifeq:{{{mobile}}}|1|(more on changing APN can be found below)}}.  
 
+
{{Template:Networking_rutos_manual_modbus_modbus_tcp_set_parameters_table
{{Template: Networking_rut955_manual_modbus_modbus_tcp_set_parameters_table}}
+
|wifi={{{wifi}}}
 
+
|mobile={{{mobile}}}
 +
|series={{{series}}}
 +
|name={{{name}}}
 +
}}
 +
{{#ifeq:{{{wifi}}}|1|
 
As you can see most of the values are '''0''' and '''1''', 0 meaning OFF and 1 meaning ON. For example, if you want to turn '''WiFi OFF''', this command should be used:
 
As you can see most of the values are '''0''' and '''1''', 0 meaning OFF and 1 meaning ON. For example, if you want to turn '''WiFi OFF''', this command should be used:
   −
  $ modbus write -w -p 12345 192.168.1.1 %MW203 0
+
  $ modbus write -w -p 12345 {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW203 0
    
If you want to turn '''WiFi ON''', use this command instead:
 
If you want to turn '''WiFi ON''', use this command instead:
   −
  $ modbus write -w -p 12345 192.168.1.1 %MW203 1
+
  $ modbus write -w -p 12345 {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW203 1
 
+
}}
 +
{{#ifeq:{{{mobile}}}|1|
 
As you can see, the only difference is the digit at the end - '''0 for OFF''', '''1 for ON'''. The same is true for all other parameters that accept only two input values.
 
As you can see, the only difference is the digit at the end - '''0 for OFF''', '''1 for ON'''. The same is true for all other parameters that accept only two input values.
    
In the case of '''SIM switch''' there are three values - '''0''', '''1''' and '''2'''. 1 makes the first SIM card slot in use, 2 makes the second SIM card slot in use and 0 initiates a switc from the SIM card in use to the opposite SIM card. For example, to initiate a switch to the second SIM card the command should look like this:
 
In the case of '''SIM switch''' there are three values - '''0''', '''1''' and '''2'''. 1 makes the first SIM card slot in use, 2 makes the second SIM card slot in use and 0 initiates a switc from the SIM card in use to the opposite SIM card. For example, to initiate a switch to the second SIM card the command should look like this:
   −
  $ modbus write -w -p 12345 192.168.1.1 %MW205 2
+
  $ modbus write -w -p 12345 {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW205 2
    
The '''reboot''' function only takes one value: '''1'''. It simply reboots the router. To initiate a reboot, use this command:
 
The '''reboot''' function only takes one value: '''1'''. It simply reboots the router. To initiate a reboot, use this command:
   −
  $ modbus write -w -p 12345 192.168.1.1 %MW206 1
+
  $ modbus write -w -p 12345 {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW206 1
    
===APN===
 
===APN===
Line 175: Line 187:  
As an example lets try to change the router's first SIM card's APN to '''gprs.fix-ip.omnitel1.net''':
 
As an example lets try to change the router's first SIM card's APN to '''gprs.fix-ip.omnitel1.net''':
   −
  $ modbus write -w -D -p 12345 192.168.1.1 %MW207 <span style="color:blue">'''1'''</span> <span style="color:green">'''103 112 114 115 46 102 105 120 45 105 112 46 111 109 110 105 116 101 108 49 46 110 101 116'''</span>
+
  $ modbus write -w -D -p 12345 {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW207 <span style="color:blue">'''1'''</span> <span style="color:green">'''103 112 114 115 46 102 105 120 45 105 112 46 111 109 110 105 116 101 108 49 46 110 101 116'''</span>
    
The value of the first byte is highlighted in <span style="color:blue">'''blue'''</span> and, in this case, it denotes that the APN value should be changed for the first SIM card. The value of the APN string itself is highlighted in <span style="color:green">'''green'''</span>. Use an ASCII to Decimal online converter to convert individual letters to Decimal code.
 
The value of the first byte is highlighted in <span style="color:blue">'''blue'''</span> and, in this case, it denotes that the APN value should be changed for the first SIM card. The value of the APN string itself is highlighted in <span style="color:green">'''green'''</span>. Use an ASCII to Decimal online converter to convert individual letters to Decimal code.
 +
}}
    
==External links==
 
==External links==
Line 184: Line 197:  
**http://www.unit-conversion.info/
 
**http://www.unit-conversion.info/
 
**http://www.binaryhexconverter.com/
 
**http://www.binaryhexconverter.com/
 +
 +
[[Category:{{{name}}} Configuration Examples]]

Navigation menu