Difference between revisions of "Modbus TCP Master MQTT Gateway"

From Teltonika Networks Wiki
m (test)
m (test)
Line 5: Line 5:
  
 
==Configuring RUT955 Modbus TCP Slave==
 
==Configuring RUT955 Modbus TCP Slave==
Go to Services > Modbus > Modbus TCP Slave:
+
Go to '''Services > Modbus > Modbus TCP Slave''':
  
 
# Check '''Enable'''
 
# Check '''Enable'''
 
# Enter port that will be used, in this example 502 will be used
 
# Enter port that will be used, in this example 502 will be used
 
# Enter device ID
 
# Enter device ID
# Press Save & Apply
+
# Press '''Save & Apply'''
  
[[File:Networking MQTT MODBUS flespi configuration slave1 v1.png|border|center|1171x1171px]]
+
[[File:Networking MQTT MODBUS flespi configuration slave1 v1.png|border|center|1171x1171px|*In this config LAN port is used so “Allow Remote Access” is not needed Modbus TCP Slave RUT955 is now configured.
 +
]]
 +
''*In this config LAN port is used so “Allow Remote Access” is not needed''
 +
 
 +
''Modbus TCP Slave RUT955 is now configured''.
 +
 
 +
==Configuring RUT955 Modbus TCP Master==
 +
Go to '''Services > Modbus > Modbus TCP Master'''
 +
 
 +
#Press '''Add'''
 +
#Check '''Enable'''
 +
#Enter name for slave device
 +
#Slave ID must match with previously configured Slave device ID
 +
#Enter IP address of Modbus TCP Slave device
 +
#Chose same Port as in Slave device - 502
 +
#Enter Period in seconds, how often requests will be sent to Slave device
 +
#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.
 +
#Press Test button in Request Configuration Testing to see if Slave device respond to requests, response similar to image below should be shown.
 +
#Press Save & Apply
 +
[[File:Networking MQTT MODBUS flespi configuration master add v1.png|border|center|1197x1197px]]
 +
[[File:Networking MQTT MODBUS flespi configuration master afteradd step 234567 v1.png|border|left|757x757px]]
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
[[File:Networking MQTT MODBUS flespi configuration master req config8up v1.png|border|center|1151x1151px|
 +
 
 +
 
 +
 
 +
]]
 +
[[File:Networking MQTT MODBUS flespi configuration master req testing v1.png|center|1154x1154px]]

Revision as of 11:56, 11 July 2022

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.

Networking Topology MQTT MODBUS flespi configuration v1.png

Configuring RUT955 Modbus TCP Slave

Go to Services > Modbus > Modbus TCP Slave:

  1. Check Enable
  2. Enter port that will be used, in this example 502 will be used
  3. Enter device ID
  4. Press Save & Apply
*In this config LAN port is used so “Allow Remote Access” is not needed Modbus TCP Slave RUT955 is now configured.

*In this config LAN port is used so “Allow Remote Access” is not needed

Modbus TCP Slave RUT955 is now configured.

Configuring RUT955 Modbus TCP Master

Go to Services > Modbus > Modbus TCP Master

  1. Press Add
  2. Check Enable
  3. Enter name for slave device
  4. Slave ID must match with previously configured Slave device ID
  5. Enter IP address of Modbus TCP Slave device
  6. Chose same Port as in Slave device - 502
  7. Enter Period in seconds, how often requests will be sent to Slave device
  8. Enter new request name and press Add in Requests configurations
  9. 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.
  10. Press Test button in Request Configuration Testing to see if Slave device respond to requests, response similar to image below should be shown.
  11. Press Save & Apply
Networking MQTT MODBUS flespi configuration master add v1.png
Networking MQTT MODBUS flespi configuration master afteradd step 234567 v1.png







Networking MQTT MODBUS flespi configuration master req config8up v1.png
Networking MQTT MODBUS flespi configuration master req testing v1.png