Modbus TCP Interface

Keywords: Modbus, monnit gateways, interface, Ethernet gateway, settings, tcp, modbus tcp


Summary:

Setting up the Modbus TCP Interface on iMonnit.



Modbus TCP (Transmission Control Protocol) is the Modbus RTU protocol with a TCP interface that runs on Ethernet. This allows blocks of binary data to be exchanged between computers. TCP is responsible for making sure all data is correctly received. IP (Internet Protocol) is responsible for making sure data is correctly addressed and routed. Monnit® provides the Modbus TCP interface for you to pull gateway and sensor data. You can continue to use Modbus without the server interface active. The data will not be sent to a server, but you can continue to poll for the data as it is received by the gateway.

Activating the Modbus Interface

Follow these steps to set up your Modbus TCP Interface:

A. Open your iMonnit app.
B. Select Gateways from the primary menu.


C. Choose one of your registered gateways.
D. Select the Edit Tab.

  1. Locate the Settings section, and select Interface Activation.

  2. Find the Activate Modbus Interface option.

  3. Toggle the switch to turn the Interface into the “On” position.

  4. Click the Save button.


















The interface should be active now. Modbus Interface will be added to your Settings options. Select to see your TCP Timeout Minutes (default:5) and Port number (default: 502).

You can have multiple interfaces active at the same time, but they each require a Static IP address on the Gateway. The Modbus TCP Interface is no exception. For more on this topic, please visit the article titled Setting Up a Static IP. 

Modbus TCP Configuration

 

Another way of adjusting your Modbus TCP settings is through the offline local interface. The local interface is only accessible offline and on a desktop computer. If this is your first time setting up a gateway to access the local interface please review the article Gateway Local Interface Setup.

 

  • Open a web browser and enter "192.168.100." 

    • Lights on your gateway will turn solid green when this connection has been established

  • Select the tab for Data Interfaces.

  • Here you can check to make the Interface Active and adjust the following settings:

    • Data Expiration – This is the number of minutes that data can be received on the gateway. Once the expiration has reached this threshold, it cannot be retrieved.

    • Socket Timeout – The amount of time in seconds the gateway waits for communication from the server before your connection is refused.

    • Listening Port - This is the number for where specifically in the server data from the gateway is received. 

  • Choose the “Save Changes” button.

 

  • Navigate up to the top right corner of the page and select the “Reboot” button.

  • Your gateway will reboot. Your Modbus TCP changes will now be active. 


Registers

Monnit gateways are Modbus Slaves. The following information refers to setting up the Modbus Master to communicate with Monnit gateways. The Modbus TCP Interface will store all data values in 16-bit registers. A register is a numerical value referring to 16-bit data transfers, and in some cases must be concatenated. Each one of these registers will have unique sensor data. 

There are eight data fields, but not all are used for each sensor and depends on the number of fields in an export. Any fields not utilized will be 0. All eight data fields are rarely used.  A data decoding table is available at the Sensor Application Definitions guide.

The registers and their data fields are mapped below:

 

Field

Description

Register

Data Address

GATEWAY

Gateway ID_High

The first 16 bytes of a 32 byte serial  ID number

40001

0

REGISTERS

Gateway ID_Low

The last 16 bytes of a 32 bytes serial ID number

40002

1

 

Gateway Version

The version of gateway firmware on the device

40003

2

 

Gateway Device Count

The number of devices (sensors & gateways in its network)

40004

3

SENSOR

Sensor ID_High

The first 16 bytes of a 32-byte serial number

40101

100

REGISTERS

Sensor ID_Low

The last 16 bytes of a 32 bytes serial ID number

40102

101

 

Device Type

The unique type identifier for the sensor profile

40103

102

 

 

Data Age

The number of seconds that have elapsed since the last data was retrieved

40104

103

 

Is Device Active

0 indicates no data for this slot

40105

104

 

Is Aware

Becomes aware when a sensor threshold has been breached

40106

105

 

Voltage

Battery voltage

40107

106

 

RSSI

Signal Strength indicator…0-100%

40108

107

 

Data 1

Sensor Data Field 1

40109

108

 

Data 2

Sensor Data Field 2

40110

109

 

Data 3

Sensor Data Field 3

40111

110

 

Data 4

Sensor Data Field 4

40112

111

 

Data 5

Sensor Data Field 5

40113

112

 

Data 6

Sensor Data Field 6

40114

113

 

Data 7

Sensor Data Field 7

40115

114

 

Data 8

Sensor Data Field 8

40116

115

 

The Gateway repeats sensor registers in groups of 16 in the same repeating pattern.  So 40117 - 40132 is the next set of 16 for the sensor in position 2, the sensor in position 3 has it’s data in registers 40133 – 40148.  And so on for the number of sensors registered in the gateway.


If you haven’t done so already,  you can build your wireless network in the iMonnit portal. For step by step instructions on setting up your sensor(s) and gateway(s) please visit this article: Getting Started Registering Devices 

Alternatively, you can add sensors offline on the local interface. Visit the article titled Adding Sensors on the Local Interface for instructions.

For more on Modbus and connecting a Serial Modbus Gateway, review the Serial Modbus Gateway Quick Start Guide.