6. Slave Configuration

Modbus Slave Overview

The Edge One™ Modbus Slave mode is typically used to bridge an IoT platform and new generation devices and sensors with a Supervisory Control and Data Acquisition (SCADA) or Building Management System (BMS).

The Slave receives data from the CloudPlugs IoT platform or from a supported IoT cloud service. The Slave registers are mapped into channels or topics of the IoT platform. The channels contain data in JSON format and the key/value pairs are mapped into register names and values, respectively. When the Slave or a Master writes a new value into a register, its corresponding field in the IoT platform channel is updated with the new value.

A SCADA or BMS system which acts as the Slave’s Modbus Master can read or write into the Slave’s registers thereby establishing bi-directional communications with the IoT platform and any devices connected to it.

The Edge One™ Modbus Slave is, therefore, used as a gateway between an IoT platform and its devices and sensors and SCADA and BMS systems.

The image below displays such scenario for an Oil-Gas plant.

Manual settings

This guide describes how to configure and use Edge One™ as a Modbus TCP Slave. Currently, this is the only mode supported for Slave operations.

Modbus TCP combines a versatile, scaleable, and ubiquitous physical network (Ethernet) with a universal networking standard (TCP/IP) and a vendor-neutral data representation, providing a truly open, accessible network for exchange of process data. It is simple to implement for any device that supports TCP/IP sockets. In addition, since TCP/IP and Ethernet layers already provide checksum protection, Modbus TCP does not require a checksum calculation.

Since TCP is a connection-based protocol, it must establish a connection before transferring data. The Master (or Client in Modbus TCP) establishes a connection with the Slave (or Server). The Server waits for an incoming connection from the Client. Once a connection is established, the Server then responds to the queries from the Client until the client closes the connection.

Modbus TCP uses a big-endian representation for addresses and data items. This means that when a numerical quantity larger than a single byte is transmitted, the MOST significant byte is sent first.

By default, the Edge One™ Modbus Slave uses Port 502 as the local port, but any valid TCP port number can be used.

Modbus TCP/IP has become ubiquitous because of its openness, simplicity, low-cost development, and minimum hardware required to support it.

IMPORTANT!

Modbus Slaves (servers) are data producers. The Edge One™ Modbus module in Slave mode, must subscribe to a local or cloud IoT channel/topic and write the channel data into its registers. Therefore, the data source for the slave project must be configured in a Message Router Project.

If a Master writes one or more registers of the Slave, the corresponding channel/topic data at the local or cloud IoT source will also be updated.

The following sections describe how to configure the Edge One™ Modbus module in Slave mode.

  1. Requirements for installation of Modbus TCP.
  2. Configuring the Modbus TCP Slave describes how to add and configure the TCP Slave also called a Group.
  3. Configuring registers indicates how to configure the registers in a Slave or Group.
  4. Configuring a single register indicates on how to add and configure a single register.
  5. Editing a register describes how to edit a single register.
  6. Deleting a register shows how to delete a register.
  7. Adding multiple registers provides instructions on how to add and configure multiple registers with a single command.
  8. Importing registers describes how to import registers from a Tab Delimited Text file.
  9. Exporting registers describes how to export registers in a Tab Delimited Text file.

For instructions on configuring a Modbus TCP Master, please refer to its documentation.

Once the project is configured and Saved you must create a Message Router project and configure the cloud access parameters to retrieve data from CloudPlugs or a supported IoT cloud service.

Back to Top

Requirements

The following are the requirements to configure a Modbus TCP Slave on the Edge One™.

  1. The Edge One™ and the Edge One™ Modbus module need to be installed on the gateway or virtual machine acting as the Modbus Master.
  2. Ethernet communications between Edge One™ and the Modbus Master(s).
  3. Modbus TCP requires that you know or define:
  • The slave ID (unit number, unit ID). While not required by the Modbus protocol since the IP address is the Slave’s address, Edge One™ requires this number to be set to identify the Slave inside an IoT channel/topic structure.
  • The IP address of the Slave.
  • The TCP port of the Slave.

A mis-match in any of these will result in no communication.

  1. Configuration of a Message Router project and route for the Slave to read data from CloudPlugs IoT channels.

Back to Top

Configuring a Modbus TCP Slave

  1. In the Project tab:
  • Enter a name for the project.
  • Select Slave from the Mode dropdown menu.
  • Set the log level.
  • Silent - No logs will be printed on the console.
  • Error - Reports only important and blocking errors that can cause malfunctions.
  • Warning - All warnings for abnormal, non-blocking events as well as Errors will be reported in the logs.
  • Info - All messages relevant to the current system status as well as Warnings and Errors will be reported in the logs.
  • Debug - Full verbose mode. All errors, warnings, and information will be reported on the log console.
  • Select whether or not the project will be started automatically when the Modbus module container is started. To start the project manually using the web interface, set the Manual mode switch to ON.
  • Click on Next to open the Slave Configuration tab.
Configure slave map
  1. In the Slave Configuration tab:
  • Enter a Slave ID.. A Slave ID is a unique unit address from 1 to 247. As stated in Requirements, Edge One™ requires a Slave ID to build the channel/topic names to communicate with local or cloud IoT servers, from which it gets data that gets written into its registers.
  • Enter the IP address of the Slave. An IP Address of 0.0.0.0 makes the Slave visible on all network interfaces enabled on the host running the Edge One™ Platform. For example, if the host has 2 network interfaces with different IP addresses, the Slave will be visible on both interfaces using the IP addresses configured by the host for those interfaces.
  • Enter the Slave’s TCP Port. The most commonly used Modbus server (Slave) TCP port is 502.
  • Configure the Response and Byte Timeouts, if required.
Configure slave map
  1. Click Next or Save. Next will place you on the Groups tab so you can configure Groups and your registers within each Group. By default, a group called My group with Group ID 1 is created. You can edit or delete this group and add new groups.
Group list

The next section describes how to configure one or multiple groups.

Back to Top

Configure Group(s)

After configuring the Slave parameters, the system wil automatically create a Group called My group with a default Object Type of Input Register. In this section, we will edit the default Group and will add another Group.

Please note that a Slave can have multiple Groups with each Group having a specific Object Type for all its registers.

  1. In the Groups tab edit the default Group by clicking on the edit icon.
Groups Tab

The default Group configuration opens as shown below.

Default Group Config
  1. Modify the Group’s parameters as required by your application and click Next to configure the Group’s registers or to add another Group.
  • Enter a Name for the Group.
  • Enter a Group ID, which is a number to identify this Group in the Edge One™ topic that will be used to read the Modbus data.
  • Select the Object Type for the registers of this Group.

The following types of registers are supported:

Object Type Access Size
Coil Read-write 1 bit
Discrete Input Read-only 1 bit
Input register Read-only 16 bits
Holding register Read-write 16 bits

In the example below, we changed the Group Name to TempRegs and the Object Type to Discrete Input since we will be reading temperature values and the register will be Read Only.

Groups Tab
  1. Clicking Next returns to the Groups tab and displays the edited Group.
Groups Manage registers
  1. You can add another Group with Group and configure its parameters as shown above, or you can click on Manage registers under Actions to add registers to your Group.

The next section describes how to add and configure registers.

Back to Top

Configure Register(s)

The registers for Slave Mode need to match the data set that will be read from the data source channel or topic. The source channel/topic holds data in JSON objects with key/value pairs.

  1. There are multiple ways to configure registers:
  • Register allows to configure a single register.
  • Multiple Registers allows to configure multiple registers at a time.
  • Import TXT allows to import a Tab Delimited Text register configuration file.
  • Export TXT allows to export the Slave’s registers in a Tab Delimited Text file format so it may be imported into another Slave/Group or another Modbus application.

The sections below describe each one of the register configuration methods.

  1. Once the registers are configured and the Project is Saved, please configure the IoT cloud communications parameters by creating or configuring a Message Router project.

To learn how to delete or edit a register, please refer to the Deleting a Register and Editing a Register sections, respectively.

Back to Top

Configuring a Single Register

To Add a single Register, its Label, Register Address, Object Type, Data Type, Size and Options need to be configured or left with default values. To set up the register with your values:

  1. Open the Groups tab and click on Manage registers.
Groups Tab
  1. Click on the [ Register ] button.
Single Register
  1. Enter a Label to name your register.

  2. Enter a valid 16-bit register address (0 - 65,535).

  3. Configure the Data Parameters.

Select and configure the parameters that apply to your data set.

Please note that Data Type and Byte order parameters apply only to Input and Holding registers. Coils and Discrete Inputs are only one bit long and, therefore, these parameters do not apply to them. Size applies to all Object types.

  1. Select a Data type:
Data Type Description
Bitfield16 (unpacked) Unpacked data structure with a sequence of 16-bits. Allows to add a label to every one of the 16 bits.
Bitfield16 Packed data structure that holds a sequence of 16-bits. A single value represents the 16-bits.
Bitfield32 (unpacked) Unpacked data structure with a sequence of 32-bits. Allows to add a label to every one of the 32 bits.
Bitfield32 - Packed Packed data structure that holds a sequence of 32-bits. A single value represents the 32-bits.
Byte [<n>] An array of raw values with no defined meaning.
Double64 Double precision floating point values.
Float32 32-bit floating point values.
Int16 16-bit integer.
Int32 32-bit integer.
Int64 64-bit integer.
String[<n>] Array of character values.
Uint32 Unsigned 32-bit integer.
Uint64 Unsigned 64-bit integer.
Data Type
  1. Configure the byte order parameters.
  • To use Big Endian and send the most significant byte first, turn on the Big Endian switch. The default is Little Endian.
  • To reverse the byte order, turn on the Reverse Byte order switch. The default is normal order.
Byte order
  1. Configure the Register size.
  • Register sizes are expressed in number of words. Words are 2 bytes, or 16 bits long. The register will start at the address specified, and will have the size set by this parameter.
  • Please note that the size must be multiple of the data type selected. For example, for Double64, the minimum size is 4 and any size set must be a multiple of 4. For Int32 the minimum size is 2, and any size set must be a multiple fo 2. For Bitfield16, the minimum size is 1, and the size is any multiple of 1.
Register Size
  1. Optionally, enter a starting value for the register. This parameter can be very useful if you want to use the register
Register Size
  1. A sample configuration is shown below.
Register Configuration
  1. Once you have finished configuring the register, you have two options:
  1. Click Next to continue with the configuration of your device and view your register in the Registers tab, or
  1. Click Delete to delete the register you just created.
Connection Params
  1. When you are back in the Registers tab, you have several options:
  1. Add additional single registers or multiple registers.
  1. Click Save to save your work.
  1. Click Save and Restart to save your configuration and run the Modbus module. If the module was previously configured and running, it will be stopped and restarted with the new configuration.
  1. Configure the IoT cloud communications parameters by creating or configuring a Message Router project that will specify the data source for the Slave.

Back to Top

Editing a Register

To edit a register:

  1. Open the Registers tab.
Register Tab
  1. Select the register to edit and click on the Edit ( ) icon.
Edit a register
  1. Configure the register as indicated in the Configuring a Single Register section.

  2. Press the Save button to save the changes, or the Save and Restart button to save and run the Modbus module. If the module was previously configured and running, it will be stopped and restarted with the new register configuration.

Back to Top

Deleting a Register

There are two ways to delete a register:

  1. Deleting it from the Register list.
  1. Open the Registers tab.
Register Tab
  1. Select the register.
  2. Click on the Delete ( ) icon.
Delete register from list
  1. Opening the register and deleting it.
  1. Open the Registers tab.
Register Tab
  1. Select the register.
  2. Click on the Edit ( ) icon.
  3. Click on the Delete button on the lower left hand side of the register configuration panel.
Delete register from list

Back to Top

Adding Multiple Registers

The Modbus module allows to configure multiple registers with similar characteristics with one set of parameters. Multiple registers can be added to your existing registers.

When adding multiple registers, their Labels, Number of Registers, starting Register Address, Object Type, Data Type, Size, Object Type and Options need to be configured or left with default values, if applicable.

Once the registers are added, they can be individually edited by selecting them from their Map’s register list and clicking on the Edit icon ( ) to configure specific parameters, if desired.

To add multiple registers:

  1. Open the Registers tab.
Register Tab
  1. Click on the [ Multiple Registers ] button.
Add Multiple Registers
  1. Enter a Label to name your registers. The register labels will have labels of the format Label#, where # is replaced by the register number.
  2. Enter the number of registers to be created.
  3. Enter a valid 16-bit starting address (0 - 65,535). The new registers will have addresses including and following the starting address.
No. of Registers
  1. Configure the Object Type. The following types of registers are supported:
Object Type Access Size
Coil Read-write 1 bit
Discrete Input Read-only 1 bit
Input register Read-only 16 bits
Holding register Read-write 16 bits
Multi Reg Object Type
  1. Configure the Data Parameters.

Select and configure the parameters that apply to your data set.

Please note that Data Type and Byte order parameters apply only to Input and Holding registers. Coils and Discrete Inputs are only one bit long and, therefore, these parameters do not apply to them. Size applies to all Object types.

  1. Select a Data type:
Data Type Description
Bitfield16 (unpacked) Unpacked data structure with a sequence of 16-bits. Allows to add a label to every one of the 16 bits.
Bitfield16 Packed data structure that holds a sequence of 16-bits. A single value represents the 16-bits.
Bitfield32 (unpacked) Unpacked data structure with a sequence of 32-bits. Allows to add a label to every one of the 32 bits.
Bitfield32 - Packed Packed data structure that holds a sequence of 32-bits. A single value represents the 32-bits.
Byte [<n>] An array of raw values with no defined meaning.
Double64 Double precision floating point values.
Float32 32-bit floating point values.
Int16 16-bit integer.
Int32 32-bit integer.
Int64 64-bit integer.
String[<n>] Array of character values.
Uint32 Unsigned 32-bit integer.
Uint64 Unsigned 64-bit integer.
Data Type
  1. Configure the byte order parameters.
  • To use Big Endian turn on the Big Endian switch. The default is Little Endian.
  • To reverse the byte order, turn on the Reverse Byte order switch. The default is normal order.
Byte order
  1. Configure the Register size.
  • Register sizes are expressed in number of words. Words are 2 bytes, or 16 bits long. The register will start at the address specified, and will have the size set by this parameter.
  • Please note that the size must be multiple of the data type selected. For example, for Double64, the minimum size is 4 and any size set must be a multiple of 4. For Int32 the minimum size is 2, and any size set must be a multiple fo 2. For Bitfield16, the minimum size is 1, and the size is any multiple of 1.
  1. Configure the Connection Parameters.

The following connection parameters can be configured.

  1. Retry Attempts. Number of times the master will retry to poll the register when there are errors.
  1. Response Timeout. Time interval in microseconds to wait for the response from a Modbus slave.
  1. Byte Timeout. Time interval in microseconds to wait for a byte from a Modbus slave.
  1. Click Add Registers to create the registers and view them in the Register tab.

  2. Confirm that the registers were created successfully in the Registers tab.. In the example below, there was an existing register called Register1 and the 10 additional registers were added below it.

Multi register view
  1. Save to save your Project, or

  2. Save and Restart to Save your configuration and Run your Modbus Project. If the Modbus Project was previously configured and running, it will be stopped and restarted with the new configuration.

  3. Configure the IoT cloud communications parameters by creating or configuring a Message Router project.

Back to Top

Importing Slave/Group Registers

You can import register configurations from a Tab Delimited Text file.

WARNING!

Any existing registers will be deleted and replaced by the imported registers.

To preserve existing registers, Export them as a CSV file and add the exported data to the file to be imported.

The file must conform to the following data structure and must have a header row whose values are ignored, where <tab> is the tab character.

	Register Label<tab>Register Address<tab>Object Type<tab>Data Type<tab>Enable Big Endian<tab>Reverse Byte Order<tab>Register Size<tab>Number of Retries<tab>Response Timeout<tab>Byte Timeout

Only tab “\tab” separators are supported, and there can only be one tab between each field. The import function is used for multiple modules and some of the connector variables support support value strings with commas; therefore, only Tab Delimited Text files are supported.

Note that any existing registers in the Group / Slave selected for the import will be replaced by the imported registers.

To import a register configuration file:

  1. Open the Registers tab.
Register Tab
  1. Click on the [ Import ] button to open the Import Registers tab.

  2. Read the Instructions and click on the [ Upload file ] button.

  3. Select a valid Tab Delimited Text file and complete the upload.

Select Tab Delimited Text file

The text file has the tab delimited data shown below, and it was created with a standard text editor.

Text file content
  1. Verify that the registers were imported correctly by opening the Registers tab.
Register Tab
  1. Configure the IoT cloud communications parameters by creating or configuring a Message Router project.

Back to Top

Exporting Slave/Group Registers

You can export register configurations in a Tab Delimited Text file.

The file will conform to the following data structure and will have a header row, where <tab> is the tab character.

	Register Label<tab>Register Address<tab>Object Type<tab>Data Type<tab>Enable Big Endian<tab>Reverse Byte Order<tab>Register Size<tab>Number of Retries<tab>Response Timeout<tab>Byte Timeout

Only tab “\tab” separators are supported, and there will only be one tab between each field.

To export a register configuration file:

  1. Open the Registers tab.
Register Tab
  1. Click on the [ Export ] button to open the Export Registers tab.

  2. Read the Instructions and click on the ( Download file ) button.

  3. Enter a name for the Tab Delimited Text file, or use the default and Click OK to initiate the download.

Select Tab Delimited Text file

The text file has the tab delimited data shown below. It was open with a standard text editor.

Text file content

Back to Top

Still need help? Get in touch!
Last updated on 6th May 2021