--- title: "Modbus Client | Examples | N3uron KB V1.21" slug: "modbus-client-examples" description: "Modbus Client is a N3uron module that allows users to quickly and easily connect N3uron to any Modbus compatible device. Some of the main…" updated: 2022-10-10T09:44:07Z published: 2022-10-10T09:44:07Z canonical: "docs.n3uron.com/modbus-client-examples" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.n3uron.com/llms.txt > Use this file to discover all available pages before exploring further. # Examples ## Connecting to an Inverter using Modbus Client In this example, the **Modbus Client** module is used to connect to an inverter acting as a slave over **TCP**. The inverter has the following memory map: | **Template: PV inverter** | | --- | | **Communication protocol: Modbus TCP** | | **Tag same Modbus** | **Modbus Address** | **Data type** | **Access** | **Units** | **Scaling** | **Description** | | ALARMS/FAN_ERROR | 400108.2 | boolean | R | | 1 | Alarm: Fan diagnostics error | | ALARMS/IGBT_HIGH_TEMP | 400108.3 | boolean | R | | 1 | Alarm: High temperature in drive | | ENERGY_TODAY_VAL | 400101 | Int32 | R | W/h | 0.1 | Energy generated on current day | | ERROR_CODE | 400103 | Int16 | RW | | 1 | Error Code: 0 - No error, 1 - AC error, 2-DC error | | FREQUENCY_VAL | 400104 | Int16 | R | Hz | 0.01 | Grid Frequency | | POWER_SP | 400105 | Int16 | RW | kW | 1 | Active power setpoint | | POWER_VAL | 400106 | Int16 | R | kW | 0.1 | Active power generated | | STATUS_CODE | 400107 | Int16 | R | | 1 | Status code | Follow the below steps to set up the connection correctly: - **Step 1:** After creating a **Modbus Client** module instance, a connection with the device needs to be configured, as depicted in the below image: ![](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2011-%20TCP%20Connection%20configuration.png)Figure 7. TCP connection configuration For this example, the following fields have been configured: - - **Host:**10.101.9.42, which is the device's IP address. - **TCP port:** By default, port 502 is used. - **Step 2:** Once the connection has been set up, the device must be created and configured. In this example, a device has been created named Device01. ![](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2012-%20Create%20and%20configure%20a%20new%20device.png)Figure 8. Creating and configuring a new device The other parameters have been left as their default values. At this point, the connection is ready and we can move on to create new tags according to the memory map shown above. - **Step 3:** In the **Explorer** panel, select **Tags.** In the **Model** panel, create a new group and name it INV01. ![](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2013-%20Create%20a%20new%20group%20of%20tags.png)Figure 9. Creating a new group of tags - **Step 4:** Create a tag inside the group and name it POWER_VAL. ![](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2014-%20Create%20a%20new%20tag(2).png)Figure 10. Create a new tag - **Step 5:** Set the configuration parameters properly: - **Type:** Number. - **Format:** Integer. - **Client Access:** R. - **Details:** - **Description:** Active power generated. - **Scaling:** - **Enabled:** Yes. - **Raw Range:** - **Minimum:** 0. - **Maximum:** 1. - **Source:** - **Enabled:** Yes. - **Module type:** ModbusClient. - **Module name:** ModbusClient. - **Config:** - **Device:** This option must follow the format **Channel_name/Device_name**. In this case, Channel01/Device_01. - **Modbus Address:** The **Modbus Address** for the **POWER_VAL** is 400106, as shown in the memory map table. - **Data type:** Int16. ![](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2015a-Tag%20configured.png)Figure 11a. Tag configuration ![](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2015b-%20Tag%20configured.png)Figure 11b. Tag configuration To create the rest of the tags associated with the inverter, follow the same procedure as described above. Now, go to the **Data/****Real-Time section** in the **Navigation** panel, where you should be able to see the data read from the device. ![](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2016-%20Data%20visualization.png)Figure 12. Data visualization