Configure an industrial gateway
General guide for choosing, installing, and configuring an IoT gateway that connects your PLCs with Rela-ai via MQTT.
What is a gateway
A gateway is a mini computer installed at the plant, next to the PLCs. Its job is simple: read data from machines over the local network (OPC UA, Modbus, S7) and publish it over the internet via MQTT so that Rela-ai receives it in the cloud.
PLC (local network) → Gateway (translates) → MQTT Broker (internet) → Rela-ai (cloud)Main advantage: The PLC is never exposed to the internet. The gateway is the only device that needs an internet connection. No VPN or firewall port opening is required.
Which gateway to choose
| Gateway | Price | Ideal for | Native OPC UA | Difficulty |
|---|---|---|---|---|
| Raspberry Pi + Node-RED | $50-80 USD | Testing, small plants | Via plugin | Easy |
| HiveMQ Edge | Free (software) | You already have Linux hardware | Yes (native bridge) | Easy |
| Siemens IOT2050 | $200-300 USD | Demanding industrial environments | Via Node-RED | Medium |
| Secomea SiteManager | $400+ USD | Enterprise, IEC 62443 certified | Yes | Medium |
| Softing edgeConnector | Quote required | Multi-protocol integration | Yes | Advanced |
Recommendation: To get started, use Raspberry Pi + Node-RED (step-by-step guide available). If you need a more robust environment, use HiveMQ Edge (guide available).
Prerequisites
Before configuring the gateway, you need:
- PLC details: IP address, port, protocol (OPC UA, Modbus, S7), and the nodes/registers to monitor. The plant automation technician provides these.
- MQTT Broker: Broker URL, credentials (username/password), and the topic to publish to. Rela-ai provides this information when you create the source in the dashboard.
- Network: The gateway must have access to the PLC's local network (ethernet cable) and internet access (WiFi or ethernet).
Configuration in Rela-ai
- In the dashboard, go to Alarms → Sources → Create source
- Select protocol OPC UA
- Select mode Via MQTT Gateway
- Fill in the fields:
- Broker URL: the MQTT broker URL (e.g.
mqtt://broker.hivemq.com:1883) - Topic: the topic the gateway publishes to (e.g.
north-plant/gateway-line1) - QoS: 0 for most cases
- Broker URL: the MQTT broker URL (e.g.
- Save the source. Rela-ai starts listening to the topic automatically.
Data format (OPC UA Pub/Sub JSON)
The gateway must send data in OPC UA Pub/Sub JSON format (Part 14 of the standard). This is the format Rela-ai expects:
{
"MessageType": "ua-data",
"PublisherId": "PLC-Line1",
"Messages": [
{
"DataSetWriterId": 1,
"Payload": {
"Temperature": {"Value": 75.5, "SourceTimestamp": "2026-04-03T12:00:00Z", "StatusCode": 0},
"Pressure": {"Value": 1.2, "SourceTimestamp": "2026-04-03T12:00:00Z", "StatusCode": 0}
}
}
]
}Each field in Payload becomes an independent event in Rela-ai.
Troubleshooting
| Problem | Solution |
|---|---|
| Gateway cannot connect to PLC | Verify IP and port. Ping from the gateway. Check that the local firewall allows the connection. |
| Gateway connects but data does not reach Rela-ai | Verify broker URL and topic. Use mosquitto_sub to confirm messages are arriving at the broker. |
| Data arrives but Rela-ai does not process it | Verify the format is valid OPC UA Pub/Sub JSON. The MessageType field must be "ua-data". |
| Slow reconnection | Check that the gateway has automatic reconnection configured. Node-RED handles this automatically. |
Specific guides
- Raspberry Pi + Node-RED — complete step-by-step guide
- HiveMQ Edge — native OPC UA bridge configuration