# Modbus Master basic info

#### 1.1 Communication Parameters

<table id="bkmrk-parameter-rtu-tcp-wh" style="border-collapse: collapse; width: 100%;"><thead><tr><th>Parameter</th><th>RTU</th><th>TCP</th><th>Where you get it</th></tr></thead><tbody><tr><td>Slave / Unit ID</td><td>Required</td><td>Device dependent; keep the device's required unit identifier</td><td>Slave manual / configuration</td></tr><tr><td>IP address</td><td>Not used</td><td>Required</td><td>Network configuration</td></tr><tr><td>TCP port</td><td>Not used</td><td>Usually 502</td><td>Slave manual / network configuration</td></tr><tr><td>Serial port</td><td>Required</td><td>Not used</td><td>AG-702 device interface</td></tr><tr><td>Baudrate</td><td>Required</td><td>Not used</td><td>Slave communication settings</td></tr><tr><td>Data bits</td><td>Required</td><td>Not used</td><td>Slave communication settings</td></tr><tr><td>Parity</td><td>Required</td><td>Not used</td><td>Slave communication settings</td></tr><tr><td>Stop bits</td><td>Required</td><td>Not used</td><td>Slave communication settings</td></tr><tr><td>Function code</td><td>Required per query</td><td>Required per query</td><td>Slave Modbus map</td></tr><tr><td>Start address</td><td>Required per query</td><td>Required per query</td><td>Slave Modbus map</td></tr><tr><td>Quantity</td><td>Required per query</td><td>Required per query</td><td>Slave Modbus map</td></tr><tr><td>Datatype / byte order</td><td>Required for decoded values</td><td>Required for decoded values</td><td>Slave Modbus map</td></tr></tbody></table>

#### 1.2 Modbus Function Codes Used by This Application

<table id="bkmrk-function-code-standa" style="border-collapse: collapse; width: 100%;"><thead><tr><th>Function code</th><th>Standard meaning</th><th>How it appears in this UI</th></tr></thead><tbody><tr><td>`01`</td><td>Read Coils</td><td>01 — Read/Write Coils</td></tr><tr><td>`02`</td><td>Read Discrete Inputs</td><td>02 — Read Discrete Inputs</td></tr><tr><td>`03`</td><td>Read Holding Registers</td><td>03 — Read/Write Holding Register</td></tr><tr><td>`04`</td><td>Read Input Registers</td><td>04 — Read Input Register</td></tr></tbody></table>

<p class="callout info">The application UI exposes these four query options. The Modbus specification defines 01/02/03/04 as read operations; write functions use other standard function codes. This guide does not add write configuration that the current UI does not expose.</p>

---

### 2. Supported Hardware &amp; Devices

This section separates OpenWrt gateways that can host Modbus software from field devices that can act as Modbus slaves and provide data to the gateway.

#### 2.1 OpenWrt Modbus Gateways

The following Atreyo gateway models have public product information explicitly listing OpenWrt and Modbus support. This is a platform capability table; the exact Modbus Master UI in the supported-device section is **verified in this guide only on AG-702**.

<table id="bkmrk-gateway-openwrt-modb" style="border-collapse: collapse; width: 100%;"><thead><tr><th style="width: 12.6311%;">Gateway</th><th style="width: 15.6146%;">OpenWrt</th><th style="width: 31.8115%;">Modbus capability</th><th style="width: 20.0191%;">Interfaces</th><th style="width: 20.0191%;">Application status</th></tr></thead><tbody><tr><td style="width: 12.6311%;">**AG-702**</td><td style="width: 15.6146%;">OpenWrt 23.05</td><td style="width: 31.8115%;">TCP slave, TCP master, RTU master, RTU gateway</td><td style="width: 20.0191%;">2× Ethernet, RS-485, RS-232</td><td style="width: 20.0191%;">**Verified in this guide**</td></tr><tr><td style="width: 12.6311%;">**AG-221**</td><td style="width: 15.6146%;">OpenWrt 23.05</td><td style="width: 31.8115%;">TCP slave, TCP master, RTU master, RTU gateway</td><td style="width: 20.0191%;">2× Ethernet, RS-485</td><td style="width: 20.0191%;">**Validate firmware/package**</td></tr><tr><td style="width: 12.6311%;">**AG-207**</td><td style="width: 15.6146%;">OpenWrt 23.05</td><td style="width: 31.8115%;">TCP slave, TCP master, RTU master, RTU gateway</td><td style="width: 20.0191%;">1x Ethernet, 1x isolated RS-485</td><td style="width: 20.0191%;">**Validate firmware/package**</td></tr><tr><td style="width: 12.6311%;">**AG-205**</td><td style="width: 15.6146%;">OpenWrt 23.05</td><td style="width: 31.8115%;">TCP slave, TCP master, RTU master, RTU gateway</td><td style="width: 20.0191%;">2× Ethernet, Wi-Fi</td><td style="width: 20.0191%;">**Validate firmware/package**</td></tr><tr><td style="width: 12.6311%;">**AG-707**</td><td style="width: 15.6146%;">OpenWrt 23.05</td><td style="width: 31.8115%;">TCP slave, TCP master, RTU master, RTU gateway</td><td style="width: 20.0191%;">2× Ethernet, 2× isolated RS-485</td><td style="width: 20.0191%;">**Validate firmware/package**</td></tr><tr><td style="width: 12.6311%;">**AG-743**</td><td style="width: 15.6146%;">OpenWrt</td><td style="width: 31.8115%;">TCP slave, TCP master, RTU master, RTU gateway</td><td style="width: 20.0191%;">4× Ethernet, RS-485</td><td style="width: 20.0191%;">**Validate firmware/package**</td></tr><tr><td style="width: 12.6311%;">**AG-104**</td><td style="width: 15.6146%;">OpenWrt</td><td style="width: 31.8115%;">TCP slave, TCP master, RTU master, RTU gateway</td><td style="width: 20.0191%;">1x Ethernet, 1x isolated RS-485</td><td style="width: 20.0191%;">**Validate firmware/package**</td></tr></tbody></table>

#### 2.2 Atreyo Products That Can Act as Modbus RTU Slaves

These products can be placed on the Gateway RS-485 bus as field devices. The Gateway acts as Modbus Master and reads the data exposed by each device according to its own Modbus documentation.

<table id="bkmrk-product-interface-ro" style="border-collapse: collapse; width: 100%;"><thead><tr><th style="width: 18.4744%;">Product</th><th style="width: 10.1303%;">Interface</th><th style="width: 46.4848%;">Role / protocol</th><th style="width: 25.0298%;">Example data for AG-702</th></tr></thead><tbody><tr><td style="width: 18.4744%;">**Thermolog V3-T**</td><td style="width: 10.1303%;">RS-485</td><td style="width: 46.4848%;">Modbus RTU slave</td><td style="width: 25.0298%;">Temperature registers</td></tr><tr><td style="width: 18.4744%;">**Thermolog V3-TH**</td><td style="width: 10.1303%;">RS-485</td><td style="width: 46.4848%;">Modbus RTU slave</td><td style="width: 25.0298%;">Temperature / humidity registers</td></tr><tr><td style="width: 18.4744%;">**AMB-4I-4O**</td><td style="width: 10.1303%;">RS-485</td><td style="width: 46.4848%;">Modbus RTU I/O module; all Modbus masters</td><td style="width: 25.0298%;">Input status and relay control</td></tr><tr><td style="width: 18.4744%;">**AMB-8I-4O**</td><td style="width: 10.1303%;">RS-485</td><td style="width: 46.4848%;">Modbus RTU / IEC-60870-5-101</td><td style="width: 25.0298%;">Input status and relay control</td></tr><tr><td style="width: 18.4744%;">**AMB-12I-4O**</td><td style="width: 10.1303%;">RS-485</td><td style="width: 46.4848%;">Modbus RTU I/O module; all Modbus masters</td><td style="width: 25.0298%;">Input status and relay control</td></tr><tr><td style="width: 18.4744%;">**AMB-8I-AC**</td><td style="width: 10.1303%;">RS-485</td><td style="width: 46.4848%;">Modbus RTU I/O module; all Modbus masters</td><td style="width: 25.0298%;">Input status</td></tr><tr><td style="width: 18.4744%;">**AMB-16I-AC**</td><td style="width: 10.1303%;">RS-485</td><td style="width: 46.4848%;">Modbus RTU I/O module; all Modbus masters</td><td style="width: 25.0298%;">Input status</td></tr><tr><td style="width: 18.4744%;">**ADI-524**</td><td style="width: 10.1303%;">RS-485</td><td style="width: 46.4848%;">Modbus RTU</td><td style="width: 25.0298%;">Input status</td></tr></tbody></table>

<p class="callout success">**Physical connection:** These RTU slave devices connect to the Gateway RS-485 port and share the RS-485 bus. They do not connect to the Gateway Ethernet/TCP port.</p>

---

### 3. Deployment Scenarios

These diagrams show how the AG-702 can collect data from multiple RS-485 Modbus RTU slaves and multiple Modbus TCP/IP slave devices.

#### 3.1 AG-702 Mixed TCP/IP &amp; RS-485 Deployment

[![modbus-tcp-ip-ethernet.png](https://docs.atreyo.in/uploads/images/gallery/2026-10/scaled-1680-/modbus-tcp-ip-ethernet.png)](https://docs.atreyo.in/uploads/images/gallery/2026-10/modbus-tcp-ip-ethernet.png)

In this example the AG-702 is the central Modbus Master. Five RTU slaves share one RS-485 daisy-chain connected directly to the AG-702 RS-485 port: three slaves are shown on the left and two on the right. Four separate TCP/IP slaves connect through the Ethernet network on the AG-702 LAN side.

<table id="bkmrk-rs-485-side-%E2%80%94-five-r" style="border-collapse: collapse; width: 100%;"><tbody><tr><td style="width: 28%;">**RS-485 side — five RTU slaves**</td><td>- All five devices connect to the **AG-702 RS-485 port**.
- Three slaves are shown on the left and two on the right.
- All five share one RS-485 daisy-chain.
- Each slave has a unique Slave ID.

</td></tr><tr><td style="width: 28%;">**Ethernet side — four TCP/IP slaves**</td><td>- TCP/IP Slave A, B, C and D are **slave devices**.
- They connect to the AG-702 LAN through the same Ethernet network.
- Each slave has its own reachable IP address.
- They are **not gateways** in this example.

</td></tr></tbody></table>

<table id="bkmrk-device-group-physica" style="border-collapse: collapse; width: 100%;"><thead><tr><th>Device group</th><th>Physical connection</th><th>Protocol</th><th>Addressing</th></tr></thead><tbody><tr><td>RTU Slave 1–5</td><td>AG-702 RS-485 → shared A/B bus</td><td>Modbus RTU</td><td>Slave IDs 1–5</td></tr><tr><td>TCP/IP Slave A–D</td><td>AG-702 LAN → Ethernet network → slave</td><td>Modbus TCP</td><td>IP address + device/unit identifier as required</td></tr></tbody></table>

<p class="callout info">**Important:** RTU slaves are connected to the AG-702 RS-485 port. TCP/IP slaves are connected through the AG-702 Ethernet/LAN port. These are two separate physical communication paths.</p>

#### 3.2 RS-485 Daisy-Chain Wiring — Multi-Slave Field Example

A single AG-702 RS-485 port can serve multiple Modbus RTU slave devices on one shared two-wire bus. Connect **A (D+)** to **A (D+)** and **B (D−)** to **B (D−)** throughout the chain, assign a unique Slave ID to every device, and install a **120 Ω termination resistor between A and B** only at the two physical ends of the bus.

[![RS485-daisy-chain-wiring.png](https://docs.atreyo.in/uploads/images/gallery/2026-10/scaled-1680-/rs485-daisy-chain-wiring.png)](https://docs.atreyo.in/uploads/images/gallery/2026-10/rs485-daisy-chain-wiring.png)

<p class="callout success">**Important:** RS-485 is a shared two-wire bus. Keep the topology physically ordered as a daisy-chain, keep drop cables short, connect A to A and B to B consistently, and place 120 Ω termination resistors only at the two physical ends of the bus.</p>

---