Gateway

Modbus interface

Gateway

Modbus TCP/IP interface
Manual for PLC Applications


Contents

​1​ Overview  3

​2​ Connect to Modbus TCP Slaves  4

​2.1​ IP address  4

​2.3​ Enable Modbus interface  6

​2.4​ Port number  6

​2.6​ Modbus RTU Master device unit ID  7

​3​ Read virtual device data  7

​3.1​ Virtual devices unit ID  9

​3.2​ 3.2Memory map  10


​1​ Overview

This document describes how to connect to IQ Home Gateway Modbus TCP interface. IQ Home Gateway Modbus TCP interface provides a solution to access Modbus Slave devices with IQ Home MB Series (MB-XXX-XX) products and read periodically collected battery powered sensor values as virtual devices.

  1. Architecture of using IQ Home Gateway Modbus TCP/IP interface using PLC applications


​2​ Connect to Modbus TCP Slaves

​2.1​ IP address

IQ Home gateways in PLC applications have to connect on the same local area network (LAN) as shown in Figure 2.

  1. Local access to IQ Home Gateway Modbus TCP interface

The IQ Home gateways use DHCP for IP address configuration as default. The IP address information can be found in Link It at gateway Dashboard page shown on Figure 3 or ask your network administrator for the IP address of the gateway. For more information on how to use LinkIt software please check the video tutorials on the following site: https://www.iqhome.org/linkit

  1. LinkIt Gateway dashboard with IPv4 address


​2.3​ Enable Modbus interface

The Modbus TCP interface is not enabled as default. The remote access for external devices disabled too. You can enable the interface in LinkIt (Figure 4):

  1. Click on the Settings tab
  2. Scroll down on the bottom of the page and enable Modbus TCP interface
  3. Enable Modbus TCP remote access
  4. Click on the save button and confirm configuration upload and service restart

  1. Enable Modbus TCP interface and remote access in LinkIt

​2.4​ Port number

IQ Home gateway Modbus TCP/IP service listening on the default port 502 to access Modbus Slave devices.


​2.6​ Modbus RTU Master device unit ID

IQ Home gateways with Modbus TCP feature handles Modbus TCP Slaves from the wireless network. Wireless Modbus RTU slave devices with IQ Home MB series network node address is the as the Modbus TCP Unit ID. The MB series devices can be placed in the network from address  1 to 239. The network address 240 is reserved for virtual devices.

Unit ID/
Node address

Device type

1-239

MB series device

240

Battery powered sensors as virtual devices

​3​ Read virtual device data

Battery powered IQ Home sensor values can be read from the gateway as virtual Modbus devices. The scheduler in the gateway requests sensor data periodically with $GW/iqhome topic. The responses are stored in the gateway in-memory database. Sensor values can be accessed with register read Modbus commands. The registers are read only registers.

To setup the scheduler for virtual devices use the LinkIt software. After successful connect to the gateway go to the Settings tab (Figure 4 - 1) and click on the Scheduler menu option (Figure 4 - 2).

  1. Setup scheduler for virtual devices - Scheduler menu

Now you can add new scheduler job and remove them (Figure 5).

  1. Setup scheduler for virtual devices - Add add remove scheduler jobs


The following table shows the proper scheduled job configuration for virtual Modbus devices. The values with red color required by virtual Modbus devices.

Scheduled job setting

Value

Descriptions

Cron expression

0 */15 * * * *

Expression for matching moments when the scheduled job should be run. The example means the job runs in every 15 minutes. Further information you can find here.

Message topic

$GW/iqhome

For virtual devices the message topic have to be $GW/iqhome

Message ID

temperature

The Message ID can be any user defined value. The Message ID not affected on virtual devices.

Type

Sensor

This option shows to collect data from sensors

Command

Read

Option

Temperature [°C]

The option can be any of the following:

Temperature [°C]

Relative Humidity [%rH]
CO2 [ppm]

Device Address

All

Device address shows to collect data from all devices

Sleep enable

Enabled

Sleep should be enabled to increase battery lifetime of sensor devices

NOTICE

In case of battery powered sensors and MB-RTU-XX devices used in the same network the request from scheduler and Modbus master are enqueued in the gateway. In the Modbus master consider the queue and RF network response time  when defines timeout values.

​3.1​ Virtual devices unit ID

The Unit ID of the virtual devices is 240 (0xF0).


​3.2​ 3.2Memory map

IQ Home Gateway provides a solution for access battery powered IQ Home sensor values as Modbus slaves. The virtual devices mapped into the gateway in-memory database and can be read from Modbus master. The wireless nodes The table below describes the sensor values memory map.

Contents

Start Address

End Address

Function Code

Register Length

Unit

Format

Timestamp

0x0000

0x00F0

0x03

2

UNIX Epoch timestamp

UINT32

Temperature

0x0100

0x01F0

0x03

2

°C

FLOAT

Relative Humidity

0x0200

0x02F0

0x03

2

%rH

FLOAT

CO2

0x0300

0x03F0

0x03

2

ppm

FLOAT

Format[a][b]

Virtual device data stored in Big Endian (ABCD) format and can be read continuously in the valid ranges.

Format

Description

Example

UINT32

32-bit unsigned integer

0x12345678

= 305419896

FLOAT

32-bit single precision
floating point number

0x41EF9999

= 29.949999

Example:

Request CO2 sensor value from device with network address 2.

​ Request

Transaction ID
[2B]

Protocol ID
[2B]

Data length
[2B]

Unit ID
[1B]

Function code
[ 1B]

Data
[4B]

0x0001

0x0000

0x0004

0x0F

0x03

0x0306

0x0002

CO2 sensor value with network address 2 at 0x0306

CO2 values range start: 0x0300

Number of holding registers: 2

Data address of CO2 sensor value with network address 2 is 0x3000 + 3*2 = 0x0306

​ Response

Transaction ID
[2B]

Protocol ID
[2B]

Data length
[2B]

Unit ID
[1B]

Function code
[ 1B]

Data
[4B]

0x0001

0x0000

0x0004

0x0F

0x03

0x447D

0x0000

In the example the CO2 level converted as floating point number is 1012 ppm.

©2019 IQHome Kft

www.iqhome.org

 /

[a]Ami hiányzik még (későbbrre tartogatva) a státusz regiszter tömb. Legalsó bit a az elem státusz, utána pedig az, hogy melyik adat valid.

[b]Tudok róla, csak gondoltam a jelenlegi állapottal kezdeném, ha belekerült a progiba ezt is updatelem