Changes

Line 17: Line 17:  
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:Networking_rutos_manual_modbus_modbus_tcp_slave_v2.png]]
+
[[File:Networking_rutos_manual_modbus_modbus_tcp_slave.png|border|class=tlt-border]]
    
==Installing the necessary software==
 
==Installing the necessary software==
Line 28: 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/{{{name}}}_Modbus#Requests_configuration Request Configuration]''' you need to use '''Register Number''' instead of '''Register Address'''.{{#ifeq:RUTX12| RUTX12| To get data from the second modem, you need to execute this command:
+
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
+
  $  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:
 
This command sets it to primary modem:
   −
  $ modbus write -D {{#ifeq:{{{series}}}TRB14X|192.168.2.1|192.168.1.1}} %MW328  13101 12544
+
  $ modbus write -D {{#ifeq:{{{series}}}|TRB14X|192.168.2.1|192.168.1.1}} %MW328  13101 12544
    
}}
 
}}
Line 47: Line 47:  
|analog = {{{analog}}}
 
|analog = {{{analog}}}
 
|gps = {{{gps}}}
 
|gps = {{{gps}}}
 +
|dualsim = {{{dualsim}}}
 
}}
 
}}
   Line 67: 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 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|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 73: Line 74:  
'''-p''' specifies the port number.
 
'''-p''' specifies the port number.
   −
'''{{#ifeq:{{{series}}}TRB14X|192.168.2.1|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 104: 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 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|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 143: Line 144:  
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 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|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 163: Line 164:  
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 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|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 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|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|
 
{{#ifeq:{{{mobile}}}|1|
Line 174: Line 175:  
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 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|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 {{#ifeq:{{{series}}}TRB14X|192.168.2.1|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 196: 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