Overview
Modbus TCP is one of the most common protocols for communicating with industrial equipment. This guide shows how to configure a Modbus TCP data source in Mango by Radix IoT to read and write registers from your devices.
Prerequisites
- A running Mango 4.x or 5.x instance with the Modbus module installed — without it, Modbus I/P does not appear in the data source list
- A Modbus TCP device on the network (PLC, meter, sensor, etc.)
- The device’s IP address and port (default Modbus port is 502)
- A Modbus register map for your device (from the manufacturer)
Step 1: Create the Data Source
- Navigate to Data integration > Data sources
- Click the + button to add a new data source
- Select Modbus I/P from the dropdown
- Fill in the connection details:
| Field | Value | Notes |
|---|---|---|
| Name | Descriptive name | e.g., “Building A Power Meter” |
| Host | Device IP address | e.g., 192.168.1.100 |
| Port | 502 | Default Modbus port |
| Transport type | TCP | Also offers TCP with keep-alive and UDP |
| Update period | 5 seconds | Adjust based on your needs |
| Timeout (ms) | 500 | The default; increase it if the device is slow |
| Retries | 2 | Number of retry attempts |
- Click Save
Step 2: Add Data Points
For each register you want to read:
- Open the data source’s Data points tab and click Add
- Configure the point:
Device id: 1 (device address, usually 1)
Register range: Holding register (or Input register, Coil status, Input status)
Offset (0-based): 0 (register address from device documentation)
Modbus data type: 2 byte unsigned integer (depends on your register map)
Info
Register addressing can be confusing. Some manufacturers use 1-based addressing (register 40001) while Mango uses 0-based offsets. If the documentation says register 40001, enter offset 0 in Mango.
Step 3: Common Data Types
| Modbus data type (as Mango labels it) | When to Use |
|---|---|
| 2 byte unsigned integer | Positive integers 0-65535 (UINT16) |
| 2 byte signed integer | Integers -32768 to 32767 (INT16) |
| 4 byte float | Decimal values such as temperature or voltage (FLOAT32) |
| 4 byte unsigned integer | Large positive integers such as energy totals (UINT32) |
| Binary | On/Off status values from a Coil status or Input status register |
Mango also offers BCD, Mod10k, 1-byte, 8-byte and string types, plus a swapped variant of
most multi-register types — see Step 4.
Step 4: Match the Byte and Word Order
Different devices lay multi-register values out in different orders. In Mango the order is
part of the Modbus data type you choose — there is no separate byte-order setting:
- 4 byte float - registers in the order the Modbus specification describes
- 4 byte float swapped - the two registers exchanged (word swap)
- 4 byte unsigned integer swapped bytes and words - both bytes and words exchanged
Every multi-register numeric type follows the same pattern, so a value read in the wrong order
is corrected by re-selecting the data type, not by changing a separate field.
Tip
If you’re reading a known value (like a firmware version) and it looks garbled, try the swapped variant of the same data type. This is one of the most common Modbus configuration issues.
Step 5: Enable and Verify
- Enable the data source (toggle the switch)
- Check the data points are showing values
- Verify values match what you expect from the device
Troubleshooting
“Illegal Data Address” error
- Check your register offset is correct (0-based vs 1-based)
- Verify the register range (Holding register vs Input register)
- Confirm the Device id matches the device
Connection timeout
- Verify the device IP is reachable (
ping 192.168.1.100) - Check firewall allows port 502
- Ensure no other Modbus master is already connected (some devices allow only one connection)
Values are wrong or garbled
- Check the Modbus data type matches your register map
- For multi-register values, try the swapped variant of the same data type
- Verify if the value needs a Multiplier or Addend (see the Data Point Multiplier guide)