How to Configure Modbus IP Data Source in Mango OS

Configuring Modbus IP Data Source in Mango

🔍 Overview

The Modbus IP data source in Mango OS is used to gather data from Modbus-compatible devices over an IP network. These devices can reside on a local network, an intranet, or even the public internet. The data source operates by polling the devices at regular intervals to read values.


🛠️ Step-by-Step Configuration

1. Navigate to the Data Source Setup

  • From the Data integration menu, go to Data Sources.

  • Click New to create a new data source.


2. Basic Configuration

  • Data Source Type: Select Modbus IP from the dropdown.

  • Name: Enter a descriptive name (e.g., Boiler Room Modbus).

  • Enabled: Check this box to activate the data source.

  • Update Period: Set the frequency for polling data (e.g., 10 seconds).

  • Quantize: Optional – Check this to align polling to rounded time intervals (e.g., exactly on the 10th, 20th second, etc.).


3. Timeout & Retry Settings

These settings define how the system handles communication failures:

  • Timeout (ms): Time to wait for a device response (e.g., 5000 ms).

  • Retries: Number of retry attempts before declaring failure (e.g., 3).


4. Advanced Modbus Settings

  • Use multiple write commands only: Check if your device does not support single-value write commands.

  • Contiguous batches only: Check if the device requires requests to reference contiguous register spaces.

  • Create device monitor points: Check to auto-create a binary point that tracks device availability (useful for alerts).


5. Transport Settings

  • Transport Type:

    • TCP: Opens a new connection per poll (ideal for infrequent polling).

    • TCP with keep-alive: Maintains a persistent connection (recommended for most setups).

    • UDP: Efficient but may require strict network configuration.

    • Encapsulated: Uses Modbus RTU over IP—ideal for serial-to-Ethernet converters.


  • Linger (seconds): Determines socket close behavior:

    • Negative value disables the linger feature.

    • Zero closes the socket forcefully.

    • Positive number causes graceful close with timeout.


6. Network Configuration

  • Host: Enter the IP address or domain name of the Modbus device.

  • Port: Common Modbus ports are 502, 47808, or 47809.



7. Data Handling Options

  • Max read bit count / Max read register count / Max write register count: Set based on device capabilities (default values typically work).

  • Discard data delay (ms): Time before buffered data is discarded (set to 0 to never discard).

  • Log IO: Enable to log raw hex communication for troubleshooting.

D


🔁 Back-off Strategy (on Connection Failures)

If devices become unreachable:

  • Scale Factor: Determines how quickly retry delays grow (e.g., 1.5).

  • Max back-off on connection failure: Maximum wait time between retries (e.g., 5 minutes).

This strategy helps prevent network overloads and improves system stability.



🧭 Device Scanning (Optional)

You can scan your network to detect available Modbus nodes and inspect specific register values.

Steps:

  1. Open the configured Modbus IP Data Source.

  2. Click Modbus Tools (located within the data source).

  3. In the Device ID field, enter the ID of the device you want to scan.

    • Typical range is from 1 to 240.

  4. Set the Register Range to choose which type of Modbus register to scan:

    • Coil Status (0x01): Read/write single bits (e.g., outputs).

    • Input Status (0x02): Read-only single bits (e.g., inputs).

    • Holding Register (0x03): Read/write 16-bit data registers.

    • Input Register (0x04): Read-only 16-bit registers (e.g., sensor values).

  5. Offset:

    • This is the starting address of the register you want to read.

    • For example, an offset of 0 targets the first register in the selected range.

  6. Number of Registers:

    • Specifies how many consecutive registers to read, starting from the offset.

    • Use this to pull multiple values in one scan.

  7. Modbus Data Type:

    • Defines how Mango should interpret the raw register data.

    • Examples:

      • Two byte integer – standard 16-bit value.

      • Four byte float – used for temperature, pressure, etc.

      • BCD, String, and other types depending on device implementation.

  8. Bit (Optional):

    • If you're scanning a register that contains multiple status bits, this lets you extract a specific bit.

    • Useful for discrete alarms or boolean flags.

  9. Hex Offset:

    • Check this box if the offset is specified in hexadecimal format.

    • For example, 0x10 = decimal 16.

  1. Click Start Scan to initiate the read.

  2. After the scan completes, click Read Data to view the values.

  3. If you want to import the result as a data point:

    • Click +Add Data Point to automatically create and add that point to your data source.

✅ Devices that successfully respond to the scan will be listed and available for further interaction or point creation.


✅ Final Step: Save the Configuration

  • Review all settings and click Save.

  • You can now begin adding data points to collect values from Modbus registers.


    • Related Articles

    • Configuring BACnet/IP data source and BACnet publisher in Mango

      ? Overview This guide outlines the steps to configure BACnet/IP communication in Mango OS, including setting up a BACnet Local Device, creating a BACnet/IP Data Source, and publishing points via a BACnet Publisher. These steps allow Mango to ...
    • Mango v5.4.x - Windows Installation

      ? Overview Installing Mango Automation on a Windows computer is straightforward. This guide walks you through: Setting up Java JDK 17 (Azul Zulu OpenJDK) Downloading and installing Mango Running Mango from the command line Configuring Mango as a ...
    • Installing Mango Automation via Docker on Ubuntu

      ? Overview This guide explains how to install and run Mango Automation as a Docker container on an Ubuntu host. It covers: Installing Docker Pulling and running the Mango image Editing mango.properties inside the container Viewing Mango log files ...
    • Installing and Configuring PostgreSQL for Mango

      ? Installing and Configuring PostgreSQL for Mango This guide provides detailed steps to install and configure PostgreSQL for use with Mango OS. You will install PostgreSQL, create a dedicated Mango database and user, and validate Mango’s connection ...
    • Understanding Events, Event Detectors, and Event Handlers in Mango

      Summary This article explains the core concepts behind Mango’s event system: events, event detectors, and event handlers. Read this first before configuring any alarms or notifications. 1. What is an event? In Mango, an event represents “something ...