Jump to content

Modbus TCP Master MQTT Gateway: Difference between revisions

m
MQTT subscriber response explanation flespi
m (changed images, see also new link, modbus parameters reference)
m (MQTT subscriber response explanation flespi)
Line 147: Line 147:
#Select '''''<nowiki/>'Publisher''''''
#Select '''''<nowiki/>'Publisher''''''
#In the topic field enter '''''<nowiki/>'request''''''
#In the topic field enter '''''<nowiki/>'request''''''
#In the message field enter message, for this example 'Getting uptime' is used
#In the message field enter message, for this example '''''<nowiki/>'Getting uptime'''''' is used
#Press '''''<nowiki/>'Publish'''''' button
#Press '''''<nowiki/>'Publish'''''' button


Line 155: Line 155:
Check the response in the '''''<nowiki/>'Subscriber'''''' tab, you should receive a message similar to the one below.
Check the response in the '''''<nowiki/>'Subscriber'''''' tab, you should receive a message similar to the one below.


[[File:Networking MQTT Modbus flespi Response v1.png]]
 
[[File:Networking MQTT Modbus flespi Response v2.png|931x931px]]
 
When the value climbs over 65535 the counter resets and the value held by the first register increases by '''1'''. So one way to interpret the results would be to multiply the value in the first register by '''2<sup>16</sup>''' and add it to the value of the second register. In this example: '''9 * 65536 + 3502 = 593326s''' or '''6 days 20 hours 48 minutes and 46 seconds.'''


''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.''
Line 163: Line 166:
[[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 173: Line 176:
#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 184: Line 187:
#Select '''Enable'''
#Select '''Enable'''
#Check '''Enable Remote Access'''
#Check '''Enable Remote Access'''
# Press '''Save & Apply'''
#Press '''Save & Apply'''


[[File:Networking MQTT Modbus MQTT Broker RUTos config v1.png|border|class=tlt-border|1079x1079px]]
[[File:Networking MQTT Modbus MQTT Broker RUTos config v1.png|border|class=tlt-border|1079x1079px]]
Line 207: Line 210:
[[File:Networking MQTT Modbus Subscriber response ubuntu v1.png]]
[[File:Networking MQTT Modbus Subscriber response ubuntu v1.png]]


==See Also==
==See Also ==
*[[Modbus Master RutOS configuration example]]
*[[Modbus Master RutOS configuration example]]
*[[RUT955 Monitoring via Modbus#Get Parameters]]
*[[RUT955 Monitoring via Modbus#Get Parameters]]