Revision as of 09:43, 30 May 2024 by Wikisysop(talk | contribs)(Created page with "=== 1. Summary === * In this guide, Modbus TCP to MQTT function will be configured using third-party MQTT broker services (in this example <nowiki>https://www.hivemq.com/</nowiki>). * The Router will be used as TCP Master and MODSIM (application) will be used as TCP slave. * PC will act as MQTT Publisher and Subscriber. === 2. Prerequisites: === * Connecting board to device: <br/>Connect your router to your device via * Ethernet cable: <br/>Directly connect router por...")
In this guide, Modbus TCP to MQTT function will be configured using third-party MQTT broker services (in this example https://www.hivemq.com/).
The Router will be used as TCP Master and MODSIM (application) will be used as TCP slave.
PC will act as MQTT Publisher and Subscriber.
2. Prerequisites:
Connecting board to device: Connect your router to your device via
Ethernet cable: Directly connect router port with RJ45 wire to your device.
Wireless network connection: Connect router to your device using Wi-Fi, check device name and password on the device’s label. For Example: SSID: APClient_37B11241001 PWD: 12345678
3. Login to device:
To enter the router’s Web interface (web IU), type 192.168.100.1 (wireless LAN IP) into the URL field of your internet browser.
Use the following login information when prompted for authentication. Username: admin
Login to device
4. Configure Modbus TCP Slave (MODSIM): Download and Open MODSIM:
Click on File
New
Address: Start bit address
Length: No of registers to be read
Select based on parameters to read
Device Id: Set Slave ID
Connect to Modbus TCP service port
TCP port : 502
Click ok
*Modbus TCP Slave (MODSIM) has been configured*
5. Configure Modbus TCP Master (Router):
After login, go to configuration=> Modbus configuration,
1. Click on Add Device
Configure Modbus TCP Master
2. Parameters Configuration:
*Refer the table below for input details*
Field
Value
Description
Device Name
Invendis
Any name of your choice.
Port no
1.) RS485 Port-1
2.) RS232 Port-2
Depending on the port that is available on your router.
Meter ID
Default = 1
Can change as per your device.
Meter Model
abcd
Any name of your choice.
Function code
Read coils (1)
Read input coils (2)
Read holding registers (3)
Read input registers (4)
Specifies the type of register being addressed by Modbus request.
Slave Address
1
According to the device connected to poll data, slave ID is mentioned.
click on start, wait until the sign turns to stop Testing MQTT Publisher and Subscriber on hivemq.com-click on start, wait until the sign turns to stopOpen Hivemq.com and data should start publishing, this means that MQTT Gateway on Modbus TCP Master router is working correctly, and Modbus TCP Slave receives requestHive Mq