Difference between revisions of "Template:Networking manual Modbus serial RutOS"
(4 intermediate revisions by 3 users not shown) | |||
Line 10: | Line 10: | ||
Modbus enables communication among many devices connected to the same network, for example, a system that measures temperature and humidity and communicates the results to a computer. Modbus is often used to connect a supervisory computer with a remote terminal unit (RTU) in supervisory control and data acquisition (SCADA) systems. Many of the data types are named from its use in driving relays: a single-bit physical output is called a coil, and a single-bit physical input is called a discrete input or a contact. | Modbus enables communication among many devices connected to the same network, for example, a system that measures temperature and humidity and communicates the results to a computer. Modbus is often used to connect a supervisory computer with a remote terminal unit (RTU) in supervisory control and data acquisition (SCADA) systems. Many of the data types are named from its use in driving relays: a single-bit physical output is called a coil, and a single-bit physical input is called a discrete input or a contact. | ||
− | This article provides a brief example on how to use Modbus serial to monitor a slave device, send data to server and how to configure slave alarms. To find more information about this feature visit [[RUT955 Modbus]] | + | This article provides a brief example on how to use Modbus serial to monitor a slave device, send data to server and how to configure slave alarms. To find more information about this feature visit [[RUT955 Modbus]] page. |
==Prerequisites== | ==Prerequisites== | ||
− | *One device with RS232 | + | *One device with RS232 Serial port; |
− | *Windows 10 computer | + | *Windows 10/11 OS computer; |
− | *Hercules and | + | *Hercules and ModRSsim applications; |
− | *RS232 to USB cable | + | *RS232 to USB cable. |
==Topology== | ==Topology== | ||
− | [[File:Networking_rut955_configuration_modbus_serial_topology_2_v1.png|border|class=tlt-border|700x700px]] | + | [[File:Networking_rut955_configuration_modbus_serial_topology_2_v1.png|border|center|class=tlt-border|700x700px]] |
+ | {{Template:Networking install Modbus serial RutOS}} | ||
==Configuring Modbus serial slave device== | ==Configuring Modbus serial slave device== | ||
Line 92: | Line 93: | ||
---- | ---- | ||
− | In order to setup your router to send Modbus data to server you will need to navigate to '''Services > Data to Server''' and press '''ADD''' to add a new instance. | + | In order to setup your router to send Modbus data to server you will need to navigate to '''Services > Data to Server''' , create a '''"NEW COLLECTION NAME"''' and press '''ADD''' to add a new instance. |
− | [[File:Modbus serial | + | [[File:Modbus serial 1.png|border|class=tlt-border|1100x700px]] |
− | [[File:Modbus serial | + | [[File:Modbus serial 1-4.png|border|class=tlt-border|1100x700px]] |
− | + | [[File:Modbus serial 5.png|border|class=tlt-border|1100x700px]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | [[File:Modbus serial | + | [[File:Modbus serial 6-8.png|border|class=tlt-border|1100x700px]] |
+ | |||
+ | #Select '''Type: Modbus''' | ||
+ | #Select '''Format Type: Custom''' | ||
+ | #Enter desired '''format string''' | ||
+ | #Click '''"NEXT: COLLECTION EDIT"''' | ||
+ | #In this configuration window, you can leave the settings as default and click '''"NEXT: SERVER CONFIGURATION"''' | ||
+ | #Select '''Type: HTTP''' | ||
+ | #Enter '''Server address''' | ||
+ | #Click '''"SAVE & APPLY"''' | ||
===Receiving data=== | ===Receiving data=== |
Latest revision as of 12:11, 20 August 2024
Summary
Modbus is a serial communications protocol originally published by Modicon (now Schneider Electric) in 1979 for use with its programmable logic controllers (PLCs). Modbus has become a de facto standard communication protocol and is now a commonly available means of connecting industrial electronic devices. The main reasons for the use of Modbus in the industrial environment are:
- developed with industrial applications in mind;
- openly published and royalty-free;
- easy to deploy and maintain;
- moves raw bits or words without placing many restrictions on vendors.
Modbus enables communication among many devices connected to the same network, for example, a system that measures temperature and humidity and communicates the results to a computer. Modbus is often used to connect a supervisory computer with a remote terminal unit (RTU) in supervisory control and data acquisition (SCADA) systems. Many of the data types are named from its use in driving relays: a single-bit physical output is called a coil, and a single-bit physical input is called a discrete input or a contact.
This article provides a brief example on how to use Modbus serial to monitor a slave device, send data to server and how to configure slave alarms. To find more information about this feature visit RUT955 Modbus page.
Prerequisites
- One device with RS232 Serial port;
- Windows 10/11 OS computer;
- Hercules and ModRSsim applications;
- RS232 to USB cable.
Topology
Installation
From FW version of RUT9_R_00.07.05 and newer Modbus Serial Client package is installed by default. To install it on older FW versions open device's WebUI, navigate to Services → Package manager → Packages and search for Modbus Serial Master and press + icon to install. After installation you should see a status Installed on this package.
Configuring Modbus serial slave device
In this example we are going to be using our Windows 10 computer as a slave. To do so you will need to install modRSsim application, which you can download here.
When you are done with that, open the app and apply the following configuration.
- Select Protocol (MODBUS RS-232).
- Click Setup the communication Serial or TCP/IP port.
- Select the Port which you connected RS232 cable to (to find which port you are using go to Windows search bar and write Device Manager then select Ports and see which one you are using).
- Select Parity (Even).
- Click OK.
Configuring Modbus serial master
Open router’s WebUI, navigate to Services > Modbus > Modbus Serial Master and apply the following configuration.
- Press Enable.
- Select Baud rate (9600, it must match slave‘s baud rate).
- Select Parity (Even).
- Press Save.
Now create RS232 slave by writing a name, pressing Add button. It should appear like in the example and then press Edit.
Then apply the following configuration.
- Check Enable.
- Type in desired Name.
- Type in Slave ID (any number from 1 to 255).
- Write a name for a new request.
- Add new request by clicking ADD.
- Select data type.
- Select Function (Read holding registers (3)).
- Write First register (1) and Write Register count (10).
- Enable the request and you can test it through request configuration testing.
- Press Save.
Modbus data to server
Creating server
In order to test the functionality, you will need to set up a server (you can run a server on the same computer you use as a slave simulator).
There are many ways how you can create a server to which Modbus will send data to. In this example we are going to be using Windows 10 computer and Hercules app, which you can download here, to create a test server. Download, install the app and apply the configuration below:
- Select TCP Server tab.
- Enter Port (In this example default 80 is used).
- Click Listen
And that is it, now you will be able to see the data coming from Modbus in the Received data section.
RUT Modbus data to server configuration
In order to setup your router to send Modbus data to server you will need to navigate to Services > Data to Server , create a "NEW COLLECTION NAME" and press ADD to add a new instance.
- Select Type: Modbus
- Select Format Type: Custom
- Enter desired format string
- Click "NEXT: COLLECTION EDIT"
- In this configuration window, you can leave the settings as default and click "NEXT: SERVER CONFIGURATION"
- Select Type: HTTP
- Enter Server address
- Click "SAVE & APPLY"
Receiving data
Open Hercules again, press Listen and you should start receiving Modbus Data messages.
Try to change some data in the Modbus Slave simulator.
Received data should change.
Slave alarms
In order to setup the following configuration SIM card is required.
Go back to Services > Modbus > Modbus Serial Master' and press edit the same Slave configuration or create a new one. There will be section called Alarms Configuration. Create a name, then press Add button. When it appears like in the example, press Edit.
Then apply the following configuration:
- Enable instance.
- Select Function (Read Holding Registers).
- Write Register (1).
- Select Condition (More than).
- Write Value (10).
- Select Action frequency (First trigger)
- Select Action (SMS).
- Create Message (type anything you want to receive).
- Write Phone number (the number you want to receive the messages to).
- Press Save.
Now go back to Modbus slave simulator and edit this window:
Change the value to anything below 10, you should not receive messages. Then change the value to anything above 10, you should start receiving messages.