Get started: Modbus TCP

This tutorial reads live values from a Modbus TCP device — a PLC, an energy meter, an inverter, or a gateway — and shows them on a card. You'll create a shared Modbus connection, a Modbus TCP data source with two named points, a card that shows one of them, and a tap action that writes a new value back to the device.

Modbus has no messages or topics. The app asks the device for its register values on a timer (this is called polling). Each point you add gets a name, and every read gives you one value with a field per point, for example {"temperature": 21.5, "setpoint": 22}.

Before you begin

You need one data section on the home screen. If you already completed Get started: HTTP GET, reuse that section; otherwise create one (Add data section manually on the empty home screen, or from the menu).

You also need:

No device at hand? A Modbus TCP simulator on your computer works too. Run it on the same Wi-Fi network as your iPhone or iPad, allow its port in the computer's firewall, and use the computer's IP address as the host. Some computers need admin rights for port 502, so simulators often listen on another port, such as 5020.

The first time the app connects to a device on your local network, iOS asks whether Routix Dash may do that. Allow it. See Settings and safety.

This tutorial uses the two example registers below. Replace them with the ones from your device manual.

Point Table Address Data type What it is
temperature Holding register 0 Float32 (2 registers) A reading
setpoint Holding register 10 UInt16 A value you can change

1. Create a Modbus connection

Open the menu (top-right) → Modbus connections → Add Modbus connection.

On the New Modbus connection screen:

Leave the Advanced settings at their defaults for now: Timeout (ms) 2000 (200–60000; connecting waits at least 3 seconds), Word order ABCD, Address base 0-based (protocol), and Min gap between requests (ms) 0 (up to 5000). You might change Word order or Address base later if values look wrong — see Troubleshooting.

Tap Test in the top-right (next to the save tick). The app connects with your current settings and reads holding register 0. You don't need to save first.

Tap the save tick in the top-right.

See Data sources (incoming) — shared connections.

2. Add a Modbus TCP data source

Open the menu → Data sources → Add data source, or start from Add card → Data source → Add data source.

On the "New data source" screen:

  1. Set Name to PLC values.
  2. Set Data source type to Modbus TCP.
  3. Set Modbus connection to My PLC.
  4. Leave Unit ID at Connection default.
  5. Tap Points → Add point, and fill in the first point:
    • Name — temperature
    • Table — Holding register
    • Address — 0
    • Data type — Float32
  6. Add a second point: Name setpoint, Table Holding register, Address 10, Data type UInt16.

A point name uses letters, digits, and _, and does not start with a digit. It becomes the field name in value, so transformers read it as value.temperature.

Leave Word order at Connection default. If the manual says a register holds tenths (235 means 23.5), set Scale to 0.1. Offset is added after the scale.

Tap Read now. The app reads the points once and shows each value with its raw registers. Check that the numbers look right before you go on. A huge or tiny number such as 3.4e+38 or 1.2e-41 usually means the word order is wrong — see Troubleshooting.

Leave Trigger at Auto (periodic) and Poll interval (ms) at 1000. The next read starts after the previous one ends, so a slow device never gets a pile of requests.

Tap the save tick in the top-right.

3. Show it in a card

On an empty section, tap Add card manually or Ask AI assistant to add card. Or turn on Edit layout, tap Add at the top, then Add card. In the library, pick Design your own card.

Set PLC values as the card root data source. Add a Label — it inherits that source.

The Label now shows the whole value, for example {"temperature":21.5,"setpoint":22}. To show just the temperature:

  1. Select the Label.
  2. Under Data transformers pipe, tap Add... → Simple expression.
  3. Enter value?.temperature.

Set Touches on the Label to Capture so the tap action in the next step runs when you tap that Label.

Tap the save tick in the top-right. The Label shows 21.5 and updates every second.

Want the setpoint too? Add a second Label with value?.setpoint, or try a Dial gauge for the temperature.

Details about each read — the device address, the Unit ID used, the number of requests, and how long the read took — are available in transformers as ctx.transport. See Expressions.

4. Write a value on tap

On the home screen, turn on Edit layout, tap the card, then tap its menu button and choose Edit.

Select the Label, then open Events → On tap and tap Add... → under Data actions, choose Modbus send.

Set:

Save the card. Back on the home screen, tap the Label. The app writes 25 to holding register 10. Writes don't return anything to the tap; the new setpoint shows up with the next read.

What Value can be:

Value can include {{ value?.field }} or {{ env.my_key }} — the value is filled in when you tap.

Decimals are rounded for whole-number types (2.6 writes 3), and true writes 1 to a register. A value out of range for the data type, or text longer than the point's registers, is refused before anything is sent. A failed send stops the rest of the tap, so a Toggle skips Apply value and shows the device's real state again.

Only Coil and Holding register points can be written. Discrete input and Input register are read-only.

Reusable alternative: if several cards should write the same points, create a data destination instead (menu → Data destinations → Add data destination, Type Modbus, the same connection and points), then add Trigger data destination on tap with Text to send set to {"setpoint": 25}. See Data destinations (outgoing).

To see the new value right away, add Trigger data source(s) → PLC values after the send. It reads the points once.

Your tap actions, in order:

Category Action Role
Data actions Modbus send Writes 25 to the setpoint point
Data actions Trigger data source(s) Optional: reads the points again right away

Troubleshooting

If the card stays empty or shows an error, open Modbus connections → My PLC and check the status dot and the Connection log. On the "Data sources" screen, the source row shows the error of the last read.

What you built

Part Role
Modbus connection Shared link to your device: host, port, Unit ID
Modbus TCP data source Reads temperature and setpoint every second into value
Card A Label shows value?.temperature
Modbus send Writes a new setpoint on tap

Next steps