Bring Modbus RTU / Modbus TCP devices into Virtuino Cloud — no native Modbus support needed, thanks to MQTT-to-Modbus gateways.
Most Modbus RTU devices live on an isolated RS-485 serial bus, and most Modbus TCP gateways sit behind your local router's firewall with no public IP — our cloud servers can't simply "dial in" to reach them. An MQTT-to-Modbus gateway solves this the other way around: it makes an outbound connection from your network to our broker, so no port-forwarding or exposing your equipment to the internet is required.
Configure your MQTT-to-Modbus gateway's MQTT client / MQTT publisher settings exactly as you would for any device connecting to Virtuino Cloud — see the full MQTT Connection Guide for details on every field. The essentials:
| Parameter | Value | Notes |
|---|---|---|
| *Broker Host | cloud.virtuino.com | Same host for both plain and TLS connections |
| *Port | 8883 TLS / SSL | Recommended — most gateways support TLS out of the box. Use 1883 only for local testing. |
| *Username | vr-abcd1234 |
Your Sub-account Key — found in Console → Keys & Sub Users |
| *Password | your MQTT password | Found in Console → Keys & Sub Users → MQTT Credentials |
| Client ID | any name, e.g. modbus-gw-01 |
Any name you like, as long as no other connection on your account uses the same one — two connections with the same client ID keep kicking each other off. It is the name the gateway shows in My Virtuino World. |
* Required field
Most MQTT-Modbus gateways let you define, per register, which MQTT topic to publish or subscribe to. In Virtuino Cloud a topic is simply the name of a field — plc1/temperature is one field. There is nothing else to add to the topic; see Topic Structure for the full reference.
| Modbus address | Modbus type | Direction | Gateway action | Topic = field |
|---|---|---|---|---|
| 30001 (temperature) | Input register | PLC → cloud | Publish | plc1/temperature |
| 30002 (humidity) | Input register | PLC → cloud | Publish | plc1/humidity |
| 40010 (setpoint) | Holding register | cloud → PLC | Subscribe | plc1/setpoint |
| 00001 (relay) | Coil | cloud → PLC | Subscribe | plc1/relay1 |
plc1/…, boiler/…. The fields then sort together in the Console and in every field list, and the next PLC simply gets its own prefix.
The gateway polls the register and publishes its value to the field's topic. The best payload is the plain value — 23.5, not {"value":23.5} — because it is stored exactly as it arrives.
235 for 23.5 °C. Use the gateway's scale or multiplier setting if it has one. Otherwise publish the raw value to a field such as plc1/temp_raw and let a script write the converted value to plc1/temperature.{"temperature":23.5,"humidity":61}. Publish that message to one field, e.g. plc1/data, and set up a JSON Splitter (dashboard → Tools → JSON Splitter) that writes each value to its own field. Make plc1/data a standard field — historical fields accept at most 512 characters.For a register or coil the gateway must write — a setpoint, a relay — the gateway subscribes to the field's topic. Whenever a value is written to that field with Publish via MQTT on — by a dashboard widget, a rule, a script or a scheduler — the gateway receives it and writes it to the PLC.
1 or 21.5. Check that your gateway accepts a plain value on its write topic.Any MQTT-to-Modbus gateway works, as long as it can publish/subscribe to a standard MQTT broker over TLS with username/password authentication. Common options:
node-red-contrib-modbus) with Node-RED's built-in mqtt out and mqtt in nodes to build a fully custom polling/mapping flow on a Raspberry Pi or similar — see the Node-RED tutorial for a ready flow.pymodbus) alongside an MQTT client library is straightforward to run on a Raspberry Pi or industrial PC if you need full control over polling logic.Whichever option you choose, the connection to Virtuino Cloud is always the same: standard MQTT, TLS on port 8883, authenticated with your Sub-account Key and MQTT password, publishing and subscribing to the names of your fields.
| Symptom | What to check |
|---|---|
| The gateway does not connect | Host, port 8883 with TLS switched on in the gateway, username = Sub-account Key, MQTT password. Gateways that ask for a CA certificate need ISRG Root X1 (Let's Encrypt); no client certificate is needed. See the MQTT Connection Guide. |
| Connected, but no values appear | Open the Debug Monitor. A rejected message shows the reason — usually a topic with no matching field, or a value longer than 512 characters sent to a historical field. |
| Values arrive but are 10× or 100× too large | The register holds a scaled integer. Set the gateway's scale factor, or convert with a script (section 3). |
| A JSON text is stored instead of a number | The gateway sends JSON. Set up a JSON Splitter, or switch the gateway to plain values if it can. |
| The PLC does not react to a dashboard button | Publish via MQTT must be on in the widget; the gateway must subscribe to exactly the field's name, and accept a plain value. |
| The gateway keeps disconnecting | Another connection on your account uses the same client ID. Give each gateway and board its own. |