Changes

m
no edit summary
Line 1: Line 1:  
__TOC__
 
__TOC__
 
==Summary==
 
==Summary==
In this guide Modbus TCP master MQTT Gateway function will be configured with two different types of MQTT Brokers. First using third party MQTT Broker services (in this example ''Flespi.io''). Second using RUT240 router as MQTT Broker. Two RUT955 routers will be used as Modbus TCP Master and Slave, and PC acts as MQTT Publisher and Subscriber.
+
In this guide, Modbus TCP master MQTT Gateway function will be configured with two different types of MQTT Brokers. First using third-party MQTT Broker services (in this example ''Flespi.io''). Second, using another router as MQTT Broker. Two RUT955 routers will be used as Modbus TCP Master and Slave, and the PC acts as MQTT Publisher and Subscriber.
    
==Configuration overview & prerequisites==
 
==Configuration overview & prerequisites==
 
*Two RUT955 routers - one acts as Modbus TCP Master, another as Modbus TCP Slave
 
*Two RUT955 routers - one acts as Modbus TCP Master, another as Modbus TCP Slave
 
*Flespi.io account to act as an MQTT Broker/Publisher/Subscriber (for first configuration example)
 
*Flespi.io account to act as an MQTT Broker/Publisher/Subscriber (for first configuration example)
*RUT240 with a Public IP address to act as MQTT Broker (for second configuration example)
+
*RUT with a Public IP address to act as MQTT Broker (for second configuration example)
 
*An end device (PC, Laptop) to act as MQTT Subscriber/Publisher (for second configuration example)
 
*An end device (PC, Laptop) to act as MQTT Subscriber/Publisher (for second configuration example)
    
==Configuration using flespi.io as MQTT Broker==
 
==Configuration using flespi.io as MQTT Broker==
[[File:Networking Topology MQTT MODBUS flespi configuration v1.png|center|frameless|800x800px]]
+
[[File:Networking Topology MQTT MODBUS flespi configuration v1.png|center|class=tlt-border|800x800px]]
    
===Configuring RUT955 Modbus TCP Slave===
 
===Configuring RUT955 Modbus TCP Slave===
Line 32: Line 32:  
#Press '''Add'''
 
#Press '''Add'''
 
# Check '''Enable'''
 
# Check '''Enable'''
# Enter name for the slave device
+
# Enter the name for the slave device
 
# Slave ID must match with the previously configured Slave device ID
 
# Slave ID must match with the previously configured Slave device ID
#Enter the IP address of Modbus TCP Slave device
+
#Enter the IP address of the Modbus TCP Slave device
 
#Chose same Port as in Slave device - 502
 
#Chose same Port as in Slave device - 502
 
#Enter Period in seconds, how often requests will be sent to the Slave device
 
#Enter Period in seconds, how often requests will be sent to the Slave device
Line 69: Line 69:  
=== Configuring MQTT Gateway on RUT955 Modbus TCP Master===
 
=== Configuring MQTT Gateway on RUT955 Modbus TCP Master===
 
----
 
----
Open routers WebUI and navigate to Services → Modbus → MQTT Gateway
+
Open routers WebUI and navigate to '''Services → Modbus → MQTT Gateway'''
    
#Select Enable
 
#Select Enable
Line 108: Line 108:  
|'''3''' - read registers; '''6''' - write single register; '''16''' - write multiple registers
 
|'''3''' - read registers; '''6''' - write single register; '''16''' - write multiple registers
 
|-
 
|-
|9. Number of first register from which information will be read or written
+
|9. Number of the first register from which information will be read or written
 
|from '''1''' to '''65535'''
 
|from '''1''' to '''65535'''
 
|-
 
|-
Line 131: Line 131:  
===Testing MQTT Publisher and Subscriber on flespi.io===
 
===Testing MQTT Publisher and Subscriber on flespi.io===
 
----
 
----
Login and navigate to MQTT Board on https://flespi.io
+
Log in and navigate to MQTT Board on https://flespi.io
    
Add a Subscriber:
 
Add a Subscriber:
Line 162: Line 162:  
''This Means that MQTT Gateway on Modbus TCP Master router is working correctly and Modbus TCP Slave receives requests.''
 
''This Means that MQTT Gateway on Modbus TCP Master router is working correctly and Modbus TCP Slave receives requests.''
   −
==Configuration using RUT240 router as MQTT Broker==
+
==Configuration using a router as MQTT Broker==
    
[[File:Networking Topology MQTT MODBUS RUTbroker configuration v1.png|987x987px]]
 
[[File:Networking Topology MQTT MODBUS RUTbroker configuration v1.png|987x987px]]
Line 180: Line 180:  
[[File:Networking MQTT Modbus MQTT gateway config v1.png|border|class=tlt-border|1090x1090px]]
 
[[File:Networking MQTT Modbus MQTT gateway config v1.png|border|class=tlt-border|1090x1090px]]
   −
===Configuring RUT240 MQTT Broker===
+
===Configuring RUT MQTT Broker===
 
----
 
----
   Line 200: Line 200:  
*Open first terminal, which will act as '''Subscriber'''. Type in:
 
*Open first terminal, which will act as '''Subscriber'''. Type in:
   −
<blockquote>''mosquito_sub -h [Host_address] -p [Port] -t [Topic]''</blockquote>[[File:Networking MQTT Modbus Subscriber in terminal v1.png|border|class=tlt-border]]
+
<blockquote>''mosquitto_sub -h [Host_address] -p [Port] -t [Topic]''</blockquote>[[File:Networking MQTT Modbus Subscriber in terminal v1.png|border|class=tlt-border]]
    
*Open second terminal, which will act as '''Publisher.''' Type in:
 
*Open second terminal, which will act as '''Publisher.''' Type in:
   −
<blockquote>''mosquito_pub -h [Host] -h [Host_address] -p [Port] -m [‘Message’] -t [Topic]''</blockquote>[[File:Networking MQTT Modbus Publisher testing v1.png|border|class=tlt-border]]
+
<blockquote>''mosquitto_pub -h [Host_address] -p [Port] -m [‘Message’] -t [Topic]''</blockquote>[[File:Networking MQTT Modbus Publisher testing v1.png|border|class=tlt-border]]
    
*On the first window - '''Subscriber''', a response should appear
 
*On the first window - '''Subscriber''', a response should appear

Navigation menu