Difference between revisions of "Modbus TCP"

From Larnitech wiki page
Jump to navigation Jump to search
(Created page with "<p>MODBUS TCP allows integration with devices that have this interface. </p> <H2>Adding MODBUS TCP</H2> <ol> <li>Authorize yourself in the Web Toolbar of the Smart Home system...")
 
Line 1: Line 1:
<p>MODBUS TCP allows integration with devices that have this interface. </p>
+
==ModBus TCP Plugin installation & configuration==
<H2>Adding MODBUS TCP</H2>
 
 
<ol>
 
<ol>
<li>Authorize yourself in the Web Toolbar of the Smart Home system administration ('''LT Setup''') and select the '''Updates''' page in the menu.
+
<li>Make sure you have ModBus TCP licenses
<br>[[File:modbustcp1.png|300px]]<br></li>
+
<br>[[file:newmodbus1.png|700px|link=]]<br>
<li>In the list of updates, find '''Modbus TCP''' and click the '''Update''' button (if the plug-in is not installed, there will be the '''Install''' button – click it).
+
</li>
<br>[[File:modbustcp2.png|800px]]<br></li>
+
 
<li>Read the warning, tick the box next to '''“I agree”''' inscription and click the '''Start update''' button.
+
<li>Make sure you have the latest versions of LT Setup, LT Server, ModBus TCP plugin installed
<br>[[File:modbustcp3.png|500px]]<br></li>
+
<br>[[file:newmodbus2.png|700px|link=]]<br>
<li>When the update is complete, select the '''Plugins''' page in the left menu.
+
</li>
<br>[[File:modbustcp4.png|300px]]<br></li>
+
 
<li>Find the '''Modbus TCP''' item in the list and look whether the '''Enable''' inscription is located next to this item in the '''License''' column. If yes, then click on the '''Enable''' button, and then click OK in the window that appears.
+
<li>Configure plugin before enabling.
<br>[[File:modbustcp5.png|500px]]<br>  
+
<br>[[file:newmodbus3.png|700px|link=]]<br>
<br>[[File:modbustcp6.png|500px]]<br>  
+
<br>[[file:newmodbus4.png|700px|link=]]<br>
<br>[[File:modbustcp7.png|300px]]<br></li>
+
<br>[[file:newmodbus5.png|700px|link=]]<br>
<li>To configure the plug-in, click the '''Configure''' button.
+
'''IP''' - IP address of a ModBus TCP device, make sure that you can ping this device
<br>[[File:modbustcp8.png|800px]]<br></li>
+
'''Port''' - 502 it is default port in most cases, but check documentation of your ModBus TCP device
<li>In the window that appears, click the '''Add''' button.
+
'''Master/Slave''' - this option means that you add a Master device or Slave device
<br>[[File:modbustcp9.png|300px]]<br> </li>
+
</li>
<li>The window will appear with settings of the device with Modbus TCP. Enter the IP address and port of the device in the appropriate fields, and also select the''' Master/Slave '''type of the connected device (most often the connected device is '''Slave'''). After that, click '''Save''' and confirm your selection by clicking on '''OK''' in the next window.
+
 
<br>[[File:modbustcp10.png|800px]]<br>  
+
<li>Enable plugin.
<br>[[File:modbustcp11.png|300px]]<br></li>
+
<br>[[file:newmodbus6.png|700px|link=]]<br>
<li>After adding a device, it will appear in the list on the '''Plugins/MODBUS TCP''' page. To edit it, click on '''Edit''' (button 1 in the screenshot); to delete it, click on '''Delete''' (button 2 in the screenshot). You can change the status with the '''Master''' (or '''Slave''' depending on its status, button 3 in the screenshot) button.
+
</li>
<br>[[File:modbustcp12.png|800px]]<br> </li></ol>
+
</ol>
After successful addition, '''Com-port''' will appear in the logic. You can check its availability by going to the '''Structure''' menu and clicking on '''Edit logic'''.
+
 
<br>[[File:modbustcp13.png|800px]]<br>
+
 
 +
==Examples==
 +
<ol>
 +
<li>
 +
<li>Go to Scripts page and create Blockly script
 +
<br>[[file:newmodbus7.png|700px|link=]]<br>
 +
</li>
 +
 
 +
<li>Add ModBus block from Other tab
 +
<br>[[file:newmodbus8.png|700px|link=]]<br>
 +
</li>
 +
 
 +
<li>Choose ModBus TCP com-port from dropdown list and fill other fields. Save script and try it.
 +
<br>[[file:newmodbus9.png|700px|link=]]<br>
 +
</li>
 +
</ol>
 +
 
 +
==Logs==
 +
Starting Service of MODBUS TCP plugin for Larnitech system...
 +
Started Service of MODBUS TCP plugin for Larnitech system.
 +
Compiled: Jul  7 2021 13:59:57
 +
INF: Settings:
 +
INF: debug yes '''- Debug mode is enabled'''
 +
INF: modbus-devices 192.168.1.110:502:0
 +
INF: Modbus 192.168.1.110:502:0 thread created
 +
INF: Modbus 192.168.1.110:502:0 thread started
 +
DEBUG: Modbus client: connected to 192.168.1.110:502:0''' - Plugin connected to device'''
 +
DEBUG: Modbus client: waiting for messages for 192.168.1.110:502:0
 +
DEBUG: Add message 01050011FF00 to 192.168.1.110:502:0 queue
 +
DEBUG: Modbus thread unlocked for 192.168.1.110:502:0
 +
DEBUG: Modbus client: send packet to 192.168.1.110:502:0 0x01050011FF00''' - Send ‘ON’ to first coil'''
 +
DEBUG: Modbus client: confirmation from 192.168.1.110:502:0 0x01050011FF00 '''- Right feedback from device'''
 +
DEBUG: Modbus client: waiting for messages for 192.168.1.110:502:0
 +
DEBUG: Add message 010500110000 to 192.168.1.110:502:0 queue
 +
DEBUG: Modbus thread unlocked for 192.168.1.110:502:0
 +
DEBUG: Modbus client: send packet to 192.168.1.110:502:0 0x010500110000''' - Send ‘OFF’ to first coil'''
 +
DEBUG: Modbus client: confirmation from 192.168.1.110:502:0 0x010500110000''' - Right feedback from device'''
 +
DEBUG: Modbus client: waiting for messages for 192.168.1.110:502:0

Revision as of 14:12, 18 November 2021

ModBus TCP Plugin installation & configuration

  1. Make sure you have ModBus TCP licenses
    Newmodbus1.png
  2. Make sure you have the latest versions of LT Setup, LT Server, ModBus TCP plugin installed
    Newmodbus2.png
  3. Configure plugin before enabling.
    Newmodbus3.png

    Newmodbus4.png

    Newmodbus5.png
    IP - IP address of a ModBus TCP device, make sure that you can ping this device Port - 502 it is default port in most cases, but check documentation of your ModBus TCP device Master/Slave - this option means that you add a Master device or Slave device
  4. Enable plugin.
    Newmodbus6.png


Examples

  1. Go to Scripts page and create Blockly script
    Newmodbus7.png
  2. Add ModBus block from Other tab
    Newmodbus8.png
  3. Choose ModBus TCP com-port from dropdown list and fill other fields. Save script and try it.
    Newmodbus9.png

Logs

Starting Service of MODBUS TCP plugin for Larnitech system...
Started Service of MODBUS TCP plugin for Larnitech system.
Compiled: Jul  7 2021 13:59:57
INF: Settings:
INF: debug yes - Debug mode is enabled
INF: modbus-devices 192.168.1.110:502:0
INF: Modbus 192.168.1.110:502:0 thread created
INF: Modbus 192.168.1.110:502:0 thread started
DEBUG: Modbus client: connected to 192.168.1.110:502:0 - Plugin connected to device
DEBUG: Modbus client: waiting for messages for 192.168.1.110:502:0
DEBUG: Add message 01050011FF00 to 192.168.1.110:502:0 queue
DEBUG: Modbus thread unlocked for 192.168.1.110:502:0
DEBUG: Modbus client: send packet to 192.168.1.110:502:0 0x01050011FF00 - Send ‘ON’ to first coil
DEBUG: Modbus client: confirmation from 192.168.1.110:502:0 0x01050011FF00 - Right feedback from device
DEBUG: Modbus client: waiting for messages for 192.168.1.110:502:0
DEBUG: Add message 010500110000 to 192.168.1.110:502:0 queue
DEBUG: Modbus thread unlocked for 192.168.1.110:502:0
DEBUG: Modbus client: send packet to 192.168.1.110:502:0 0x010500110000 - Send ‘OFF’ to first coil
DEBUG: Modbus client: confirmation from 192.168.1.110:502:0 0x010500110000 - Right feedback from device
DEBUG: Modbus client: waiting for messages for 192.168.1.110:502:0