Changes

m
Added Configuration overview and prerequisities
Line 3: Line 3:  
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 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.
   −
==Using flespi.io as Broker==
+
==Configuration overview & prerequisites==
 +
*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)
 +
*RUT240 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)
 +
 
 +
==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|frameless|800x800px]]
   −
===Configuring RUT955 Modbus TCP Slave ===
+
===Configuring RUT955 Modbus TCP Slave===
 
----
 
----
 
Go to '''Services > Modbus > Modbus TCP Slave''':
 
Go to '''Services > Modbus > Modbus TCP Slave''':
Line 16: Line 22:  
[[File:Networking_MQTT_MODBUS_flespi_configuration_slave1_v1.png|border|class=tlt-border|1044x1044px]]
 
[[File:Networking_MQTT_MODBUS_flespi_configuration_slave1_v1.png|border|class=tlt-border|1044x1044px]]
   −
''*In this config LAN port is used so “Allow Remote Access” is not needed''
+
''*In this configuration LAN port is used hence “Allow Remote Access” is not needed''
    
''Modbus TCP Slave RUT955 is now configured''.
 
''Modbus TCP Slave RUT955 is now configured''.
   −
===Configuring RUT955 Modbus TCP Master ===
+
===Configuring RUT955 Modbus TCP Master===
 
----
 
----
 
Go to '''Services > Modbus > Modbus TCP Master'''
 
Go to '''Services > Modbus > Modbus TCP Master'''
    
#Press '''Add'''
 
#Press '''Add'''
#Check '''Enable'''
+
# Check '''Enable'''
#Enter name for slave device
+
# Enter name for slave device
#Slave ID must match with previously configured Slave device ID
+
# Slave ID must match with previously configured Slave device ID
 
#Enter IP address of Modbus TCP Slave device
 
#Enter IP address of 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 Slave device
+
#Enter Period in seconds, how often requests will be sent to Slave device
 
#Enter new request name and press '''Add''' in Requests configurations
 
#Enter new request name and press '''Add''' in Requests configurations
 
#Choose Data type and Function, enter First register/coil/input to be read or written and Register count. You can name each individual configuration, and then select enable on configurations that you want to use. In this example, register to get WAN IP address of the slave device is used.
 
#Choose Data type and Function, enter First register/coil/input to be read or written and Register count. You can name each individual configuration, and then select enable on configurations that you want to use. In this example, register to get WAN IP address of the slave device is used.
Line 45: Line 51:  
Once logged in:
 
Once logged in:
   −
# Navigate to MQTT Board on the left side of the screen and press it.                                              [[File:Networking MQTT Modbus flespi board.png|301x301px]]
+
#Navigate to MQTT Board on the left side of the screen and press it.                                              [[File:Networking MQTT Modbus flespi board.png|301x301px]]
 
#On the right hand panel, top right corner, next to the name of the MQTT board, press the cogwheel looking icon to open ''Connection Settings''
 
#On the right hand panel, top right corner, next to the name of the MQTT board, press the cogwheel looking icon to open ''Connection Settings''
 
#In the opened window, press "Get flespi token" to generate an username
 
#In the opened window, press "Get flespi token" to generate an username
 
#Enter Client name
 
#Enter Client name
 
#Copy Host address
 
#Copy Host address
#Copy Username
+
# Copy Username
 
#Create a password
 
#Create a password
 
#Press Save
 
#Press Save
Line 60: Line 66:     
#Select Enable
 
#Select Enable
#Enter Host (copied from flespi connection settings without 'wss://' and port)
+
# Enter Host (copied from flespi connection settings without 'wss://' and port)
 
#Enter Username (Copied from flespi Connection settings generated token)
 
#Enter Username (Copied from flespi Connection settings generated token)
# Enter Password
+
#Enter Password
    
[[File:Networking MQTT Modbus Rut configuration Mqtt gateway v1.png|border|class=tlt-border|1058x1058px]]
 
[[File:Networking MQTT Modbus Rut configuration Mqtt gateway v1.png|border|class=tlt-border|1058x1058px]]
Line 72: Line 78:  
Format is in text - heavier and slower, but less difficult to edit.
 
Format is in text - heavier and slower, but less difficult to edit.
 
{| class="wikitable"
 
{| class="wikitable"
|1.  Format version
+
| 1.  Format version
 
|'''0'''
 
|'''0'''
 
|-
 
|-
Line 85: Line 91:  
|-
 
|-
 
|5. Port
 
|5. Port
| Port number (for example: '''502''')
+
|Port number (for example: '''502''')
 
|-
 
|-
 
|6. Timeout in seconds (time to wait for response)
 
|6. Timeout in seconds (time to wait for response)
| from '''1''' to '''999'''
+
|from '''1''' to '''999'''
 
|-
 
|-
| 7. Slave ID - Indicates to which slave request is sent
+
|7. Slave ID - Indicates to which slave request is sent
| from '''1''' to '''255'''
+
|from '''1''' to '''255'''
 
|-
 
|-
 
|8. Function
 
|8. Function
Line 97: Line 103:  
|-
 
|-
 
|9. Number of first register from which information will be read or written
 
|9. Number of first register from which information will be read or written
| from '''1''' to '''65535'''
+
|from '''1''' to '''65535'''
 
|-
 
|-
 
|10. Registry value
 
|10. Registry value
Line 117: Line 123:  
|}
 
|}
   −
=== 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
 
Login and navigate to MQTT Board on https://flespi.io
Line 124: Line 130:     
#Press '''''<nowiki/>'+'''''' button on the top right corner
 
#Press '''''<nowiki/>'+'''''' button on the top right corner
#Select '''''<nowiki/>'Subscriber''''''
+
# Select '''''<nowiki/>'Subscriber''''''
 
#In the topic field enter '''''<nowiki/>'response''''''
 
#In the topic field enter '''''<nowiki/>'response''''''
 
#Press '''''<nowiki/>'Subscribe'''''' button
 
#Press '''''<nowiki/>'Subscribe'''''' button
Line 147: Line 153:  
''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.''
   −
==Using RUT240 router as broker==
+
==Configuration using RUT240 router as MQTT Broker==
    
[[File:Networking Topology MQTT MODBUS RUTbroker configuration v1.png|987x987px]]
 
[[File:Networking Topology MQTT MODBUS RUTbroker configuration v1.png|987x987px]]
   −
===Configuring Modbus TCP Master, MQTT Gateway MQTT Broker on RUT240 and MQTT Publisher/Subscriber on PC===
+
===Configuring Modbus TCP Master, MQTT Gateway MQTT Broker on RUT240 and MQTT Publisher/Subscriber on PC ===
 
----
 
----
 
''Same configuration will be used for Modbus TCP Master and Slave RUT955 routers as in previous example, only settings in Modbus TCP Master router RUT955 will be changed to match MQTT Broker on RUT240 router''
 
''Same configuration will be used for Modbus TCP Master and Slave RUT955 routers as in previous example, only settings in Modbus TCP Master router RUT955 will be changed to match MQTT Broker on RUT240 router''
Line 161: Line 167:  
#Username: '''N/A'''
 
#Username: '''N/A'''
 
#Password: '''N/A'''
 
#Password: '''N/A'''
# Press '''Save & Apply'''
+
#Press '''Save & Apply'''
    
[[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]]
Line 170: Line 176:  
Navigate to '''Services > MQTT > Broker'''
 
Navigate to '''Services > MQTT > Broker'''
   −
# Select '''Enable'''
+
#Select '''Enable'''
 
#Check '''Enable Remote Access'''
 
#Check '''Enable Remote Access'''
 
#Press '''Save & Apply'''
 
#Press '''Save & Apply'''

Navigation menu