D105: in Modbus Server mode

D105 with RS485 interface in Modbus Server mode.

The universal pulse counter smart-MAIC D105 G4 in the Extended version can receive data from sensors and meters via the Modbus ASCII protocol with the RS485 interface, save data on a cloud server and visualize it on the Dashboard.

You can connect up to 5 sensors with instantaneous values, such as temperature, humidity, pressure, CO2, voltage and others, and up to 2 meters with cumulative values that measure the consumption of any resource, for example, water, gas meters , heat.

To configure sensors, you will need a description of the protocol and data format from the sensor manufacturer.

Activation and configuration of Modbus Server mode

1. The universal meter D105 G4 must have an Extended license type.

You can check it in the device settings on the About page.

To obtain an Extended license, create a Support Ticket and indicate the device number, an extended license for D105 costs 10€.

Image 1902

2. In the Counter Config menu, in the Setting up the RS485 interface section, select Option: Modbus Server

In the Modbus server settings menu, set the UART baud rate (max. 57600 bauds), serial interface configuration 8-N-1.

Opposite the corresponding data value describe the format for receiving data from the sensor, in accordance with the documentation of the sensor manufacturer.

Image 1903

Check the checkbox next to the value (T1 - T5 or Ch1/Ch2) in which you want to save data from the sensor and specify:
- Request to the sensor 6 bytes in HEX format

  • byte 0 – number of the Slave device on the network. Usually indicated on the sensor or in the documentation
  • byte 1 – command. Typically the read register command is 0x03
  • bytes 2-3 – register address. Indicated in the documentation for the sensor
  • bytes 4-5 – size of data to read. Indicated in the documentation for the sensor

- Sensor data format (unsigned/signed/float): uint8 / uint16 / int16 / uint32 / int32 / float32

- Divider / multiplier for processing the fractional part of a value.

All these parameters are indicated in the documentation from the manufacturer of your sensor.

Specifics of data processing from Modbus sensor

There are two main types of measured values and for each it is necessary to take into account their characteristics.

- instantaneous values that define the value/state at the current moment in time, such as temperature, humidity, pressure, voltage, CO2, etc.;

- cumulative values that determine the consumption of a resource over time: water, gas, energy, heat.

1. Instantaneous values T1 - T5

To receive instant data, store and process the Dashboard, values T1 - T5 are used. Instant values on the Dashboard are updated every 5 seconds and saved on the cloud server every minute. Over the period of an hour/day/month, instantaneous values are calculated as arithmetic averages. In the database, values are stored at two decimal places, maximum value +21 474 836.47 / minimum value -21 474 836.47

2. Cumulative values of TCh1 and TCh2

To process cumulative data, use the values TCh1 and TCh2, and you do not need to connect anything to the corresponding pulse input. In the cloud database, TCh1 and TCh2 values are stored in unsigned integer format, so use a multiplier to convert your fractional value to an integer, e.g. multiplier *1000 to convert kW to W / m3 to liters / Gcal to Kcal to save as integer in Ch and TCh.

Let's look at an example, reading data from a water meter to account for water consumption.
The water meter uses the Modbus protocol to output the current accumulated value in cubic meters [m3] with three decimal places in float32 format. But since cumulative data is stored in integers, in order not to lose the fractional part it is necessary to multiply by 1000. We will store this value in the cumulative counter TCh1.

Image 1904

For example, on the water meter we have a value of 5234.557 m3, which we will save in the TCh1 data. But since TCh stores an integer value, let's multiply our counter by 1000 and save it. As a result, the value of 5234557 liters will be stored in the TCh1 data. (for reference, 1m3 = 1000 liters)

Accordingly, on the Dashboard, to obtain [m3], you need to perform the reverse operation in the widget settings /1000.

Description of the logic for processing the Ch1 value.

It is not necessary to use Ch1 to read any data via the Modbus protocol; this value is calculated automatically and stores consumption for the period that you set on the widget (hour/day/month). But if your water meter gives such a parameter as flow rate, then you can link this parameter via Modbus to the Ch1 data. In this case, the widget will display the flow rate in real time, but the corresponding water consumption will be calculated for the period.

As a result we have:

- Ch1 this is resource consumption over a period (hour/day/month/year);
- TCh1 this is a cumulative counter, the value is constantly increasing and does not depend on the period.

Good luck with your integrations!

This article was helpful for 13 people. Is this article helpful for you?