Edge Gateway

Modbus to MQTT

A Modbus device, published to a broker as one message per tag, or grouped per device.

Product page →

The data flow

SOURCE TO MQTTModbus devicePLC · meter · driveEdge Gatewaythe runtime on your devicepolls · decodes · scalesdeadband and rate limit on the routeone message per tag, or groupedMQTT brokermqtt:// or mqtts://topic from the node's templateQoS 0–2, retainTLS with CA and client certificates

The runtime polls the device on the source node's interval, decodes each register into a tag with a quality, applies the tag's scaling, and hands every update to the route. The route decides whether it is news (first value, a change past the deadband, a heartbeat, a quality change) and publishes it to the broker as JSON.

What arrives on the broker for one tag
{"device":"Main meter","tag":"Voltage_L1","value":230.5,"unit":"V","quality":"GOOD","timestamp":"2026-09-29T07:25:03.629Z"}

In the editor

Edge LogicPump house✓ Saved · v3DeployFilter nodes…PLC & INDUSTRIALModbusSiemens S7Allen-Bradley (CIP)…TRANSFORMSScaleDeadbandExpression…LOGIC & ROUTINGCondition / RouteJoinInject / TriggerOUTPUTMQTT outHTTP outSQL out…GATEWAYModbus converterMain meterModbus · 192.168.1.20every 1 s · 6 tagsDeadband0.5 absolutePlant brokerMQTT outplant/{device}/{tag}Plant brokerTOPICplant/{device}/{tag}QOS1RETAINoffBATCH TAGS PER PUBLISHoff
A Modbus source, a deadband so only real changes are sent, and MQTT out. The broker itself is not on the drawing.

The MQTT out node carries what belongs to the message: the topic template (plant/{device}/{tag}), QoS, retain, the schema name and whether tags are batched per publish. Which broker it reaches belongs to the gateway being built, not to the drawing, so it lives in the design page's Destination settings: URL, client ID, user name, and whether to buffer while offline.

The broker password is never in the design. After the install, on the device: modbuslogic-edge secrets set <destination-id> password. The runtime keeps it encrypted there; a design or a download can be shared without carrying it. The destination id is in the log line the runtime prints for the destination, and in project.json under the data directory.

Without {tag} in the topic, every tag is published to the same topic; validation warns. Batch tags per publish sends one message per device with all its tags in a values map instead. A Store & forward node before the output keeps messages on disk while the broker is unreachable and replays them in order.

Test it with the Modbus Simulator

You do not need the PLC to try this flow. The Modbus Simulator answers as a Modbus slave on your own PC, with registers that move, so the whole path from polling to the output can be watched before any hardware is involved.

  1. Start the Simulator and add a slave: Modbus TCP, bind host set to this PC's LAN address (the prefilled one), port 1502, unit ID 1. Add a few holding registers, say 40001–40010 as FLOAT32 or INT16 in random mode so the values change, and press Start.
  2. In the editor, set the source node's host to that address, port 1502, unit ID 1, and the same addresses and data types. Poll interval 1s is fine.
  3. Deploy the design to a device on the same network, or to this very PC: the Edge Gateway Console installs on a laptop as readily as on an edge computer, and the gateway polls the Simulator over the LAN.
  4. The Simulator's request log shows the gateway's reads arriving: function code 03, the start address and quantity, once per poll interval. Neighbouring registers arrive as one read.
  5. Subscribe to the broker with any MQTT client (mosquitto_sub -t 'plant/#' -v is the usual one) and watch a message per tag arrive as the Simulator's random values move. Switch a register to fixed and the messages for it stop, except the heartbeat.
THE TEST BENCHModbus Simulatora slave on your PC · port 1502registers in random moderequest log shows each readEdge Gatewaythe runtime on your devicepolls every secondthe live view shows valuesThe outputon the same PC or elsewhere

Registers in fixed mode make a deadband or a condition easy to exercise: change a value by hand and watch what is, and is not, published. A register set to a value the Simulator refuses (uncheck Fill unmapped and read an address that is not there) shows what a BAD quality looks like at the output. The Simulator's own page has the rest.

From design to device

THE SAME FOUR STEPS FOR EVERY FLOWValidateon the design pageInstallthe console on the deviceDevice codeentered on the design pageBundlegiven to the console
  1. Validate. On the design page, Run validation. The editor's rules, the tag document and the runtime binary itself check the design; every issue names its node. Details: Validating a design.
  2. Install. From the Devices panel download the installer for the device's platform (Windows x64, Linux x64 or Linux ARM64). Windows: extract and run Edge-Gateway-Console.exe from an administrator terminal. Linux (Debian, Ubuntu, Raspberry Pi OS): sudo dpkg -i the .deb, then sudo edge-gateway-console. It shows the device code. Details: Installing on the device.
  3. Device code. Enter it in the Devices panel, choose a trial or one of your purchased licences, and press Download activation bundle: one small zip with the design and a licence bound to that machine, sealed so only that machine can open it. Details: Downloading.
  4. Bundle. Give the zip to the console (drag it onto the program, pass its path, or put it beside the program and run it again; a USB stick is fine for a device without internet). It opens the bundle with its own code, installs the runtime as a service and starts it. The device never contacts the site. Details: Activation and the licence.

The console then opens the gateway's web view in a browser (on a device without a desktop it prints the address instead) and stays attached with the live view: devices up or down, values as they change, what was published, and the log.

  • The live view lists the broker under destinations as connected, and counts what each route published.
  • The broker receives one retained-or-not message per tag on the topic template; a subscriber sees them at the poll rate, filtered by the deadband.
  • A broker that refuses the connection, or a password not yet set on the device, appears as the destination's last error in the live view and in the log.

Ctrl-C leaves the gateway running as a service. Run edge-gateway-console again at any time: it shows the service, the licence, every device and destination with what to check, the web view, and the live log. Running covers the data directory, secrets and the diagnostics.

Modbus to MQTT · Edge Gateway documentation | Modbus Logic