IMD SolutionComputing LibraryShop main store

How-to

Push ClearSCADA values to MQTT through an edge gateway

Edge computing and IIoT Published 7 min read

Short answer

ClearSCADA and Geo SCADA do not publish straight to an MQTT broker: the value travels from the SCADA server through an edge gateway to the broker as two independent client connections. Prove the SCADA read on one known point and the MQTT publish on a fixed test payload separately, join them only after both pass, and chase a login failure in the server's own web logs, never in the broker settings.

On this page
  1. How the ClearSCADA-to-MQTT path runs
  2. Choose the implementation
  3. Run the gateway on its own edge PC
  4. Configure and prove the gateway flow in this order
  5. Sizing the publish rate for 500 points at a 10 second poll
  6. Diagnose "Error in Login" in the server's web logs
  7. Questions asked

A ClearSCADA or Geo SCADA server never talks to an MQTT broker directly. The value leaves the server through one client connection, crosses a gateway process, and reaches the broker on a second, independent connection. That is why the fastest route to a working feed is to prove the two halves separately — one known value read out of the server, one fixed test payload confirmed by an independent subscriber — and only then join them. Newer Geo SCADA Expert releases shorten the path with a native MQTT driver and, from Geo SCADA Expert 2022, a Sparkplug B driver; on ClearSCADA builds, an external gateway such as Node-RED remains the standard route. The steps below cover the Node-RED gateway, the two proof tests, a publish-rate calculation, and the log-based fix for the classic "Error in Login" failure.

How the ClearSCADA-to-MQTT path runs #

The gateway is two client connections joined back to back. On the SCADA side it authenticates against the server's web API and requests point values; on the MQTT side it connects to the broker as an ordinary MQTT client and publishes. The broker neither knows nor cares whether the SCADA login worked, and the server knows nothing about the broker. Between the two connections sits the mapping: a point identity becomes a topic, and the value, its timestamp and its quality become a payload. Each stage fails for different reasons — credentials and versions on the SCADA hop, type and encoding in the mapping, addressing and authentication on the broker hop — which is why the habit that saves hours is proving each stage on its own before the flow ever runs end to end.

Choose the implementation #

Start from the server version, because the built-in options depend on it. Geo SCADA Expert's 2019 feature set added a driver for the MQTT protocol, and Geo SCADA Expert 2022 added an MQTT Sparkplug B driver, so a current Geo SCADA Expert server can join a broker on its own. Schneider Electric also publishes a basic MQTT sample driver on its Exchange site, compatible with all Geo SCADA Expert versions and adaptable to ClearSCADA with minor changes. Where no driver fits, or while you commission and want the message flow visible, an external gateway is the practical route.

Approach SCADA side MQTT side Best when
Native server driver The server's own MQTT or Sparkplug B driver The server connects to the broker as a client Geo SCADA Expert at a release that carries the driver
Node-RED gateway Web API node reading point values MQTT output node Proving the path, modest mapping counts, visible diagnostics
Custom service or DDK An API client you write An MQTT client library you choose Large mapping sets, controlled retries, formal software lifecycle

If the server already serves its points over OPC UA, the same edge box can do the job by bridging OPC UA PLC data to MQTT with an edge PC, and the two-halves proof below applies unchanged. Whichever route you take, record the exact ClearSCADA or Geo SCADA version and build first: login behavior and the components that can connect differ between releases, and every diagnosis later in this article starts from that string.

Run the gateway on its own edge PC #

Keep the gateway off the SCADA server. A separate host carries its own broker credentials, restarts its flow without touching the historian, and turns a gateway fault into a stopped feed instead of a stopped server. Node-RED sits comfortably beside other plant software on that box — the same pattern as run Python and Node-RED beside PLC code on an edge PC — and for a host mounted in the cabinet, a fanless industrial mini PC is the usual hardware for this duty. Install the Geo SCADA node set from its published package and pin the versions, the practice behind stable Node-RED gateway flows with vendor-pinned nodes; an unplanned node update on a working gateway is a self-inflicted outage.

Configure and prove the gateway flow in this order #

  1. Record the server version and build. Everything after this step is easier to defend when you can name the release.
  2. Point the SCADA input node at the server: the machine's IP address as the host, the port its web interface listens on, and a dedicated service account rather than a personal login.
  3. Request one known point and drop the raw result on a debug node. Compare it against the same point in the SCADA client. A matching number proves the login, the request and the value mapping in one shot; if the login errors instead, go to the diagnosis section, fix it there, and come back.
  4. Prove the broker before the gateway touches it. Publish one fixed test payload from any throwaway client and receive it on an independent subscriber running on a second machine; a lab broker such as the one in run a secure Mosquitto MQTT lab broker with Node-RED makes this test take minutes.
  5. Configure the gateway's MQTT output with the broker host, listener port, credentials and TLS settings the broker service specifies, publish the same fixed test payload from the flow, and confirm it on that independent subscriber. MQTT only ever moves messages from client to broker to client, the delivery model described in MQTT clients publish and subscribe through the broker, so the subscriber — not the publish node's indicator — is the proof.
  6. Map the point to a stable topic and an explicit payload: value, timestamp and quality, plus a stated rule for bad-quality and stale data instead of a silent skip. If a JSON payload arrives at the subscriber with stray or doubled characters, the causes in fixing extra characters in a PLC MQTT JSON payload apply to gateway-built payloads too.
  7. Join the halves: wire the validated read into the validated publish, and leave debug taps on both boundaries so the next fault shows which half broke.
  8. Give each failure a visible status — login failure, read failure, bad quality, broker disconnection, rejected publish — instead of a silent retry loop.
  9. Set the publish policy from a calculation, not from habit; the next section works one through.

Sizing the publish rate for 500 points at a 10 second poll #

Worked example, with declared inputs: 500 analogue points (a small utility-scale site — substitute your own point count), a 10 s poll interval taken from the project requirement, and one constant, 86,400 s in a day.

The rule, in words: under an every-poll publish policy, polls per point per day equal seconds per day divided by the poll interval; daily publications equal the point count times polls per point per day; and the sustained average rate equals daily publications divided by seconds per day.

The arithmetic:

  • 86,400 s ÷ 10 s = 8,640 polls per point per day
  • 8,640 polls per point × 500 points = 4,320,000 publications per day
  • 4,320,000 publications ÷ 86,400 s = 50 publications per second, sustained

The result: an every-poll policy on this input set holds a steady 50 messages per second on the broker link, 4.32 million publications a day, before retained messages and reconnect bursts.

The decision: at 50 messages per second, publish on change and on quality change instead, and reserve every-poll publishing for points a consumer demonstrably reads at the full poll rate. Run the same arithmetic on your own point count and poll interval, and before pointing the flow at a shared public broker, take your computed rate to that service's documented ingestion limit — the number in that comparison is yours, not this example's.

Diagnose "Error in Login" in the server's web logs #

When Node-RED reports "Error in Login", the request died at the SCADA hop. No topic name, QoS level or broker credential is involved yet, so leave the MQTT half untouched and read the server's own account of the attempt.

The ClearSCADA Server Status Tool is where the log files and logging settings live, with the logging categories themselves set from the server's configuration dialog. Enable all Web logging types and disable the unrelated categories, so the next thing the log writes is the login sequence. Trigger exactly one attempt from Node-RED, then read the freshly written lines: they show whether the server saw the request, how authentication answered, and which stage refused it. Comparing the failing sequence with a successful login from the legacy WebX client makes the difference hard to miss.

Check the connection basics in the same pass. The reported fault used the server machine's IP address as the hostname and port 80 for the web interface; confirm the address is the server itself and that its web interface listens on that port. A TCP connection to port 80 proves only that something accepted a connection — it does not prove the SOAP endpoint received a valid request.

Watch one exchange over plain HTTP if you need the raw login sequence, and treat that as a short diagnostic window on a network segment you control. Plain HTTP exposes the login exchange, so once the fault is named, restore the production TLS configuration on the server's web interface and the Node-RED connection.

Questions asked

Can Geo SCADA publish to MQTT without an external gateway?

Partly, and the answer depends on the release. A native MQTT driver arrived in the 2019 feature set, and a Sparkplug B driver followed in the 2022 release, so a current server can reach a broker on its own. Schneider Electric also publishes a basic MQTT sample driver that works on every Geo SCADA Expert version, adaptable to ClearSCADA with minor changes. Older ClearSCADA builds need the external gateway this article builds.

Why does my subscriber show nothing even though the flow looks healthy?

Check three things in order: that the publish node reports a connected session and an accepted publish, that the subscriber's topic filter matches the published topic exactly, including any wildcards, and that the QoS levels on both ends line up so the broker actually forwards the message. If publishing itself is in doubt, request one known point into a debug node to confirm the SCADA half still reads.

Which port does the gateway use, the SCADA one or the broker one?

Two different numbers on two different hosts. In the fault this article diagnoses, the server's web interface answered on port 80 at the server's IP address; that port comes from the server's own web configuration. The broker's listener port comes from the broker service and belongs only in the MQTT node's configuration. A TCP connect to the SCADA port proves only that something accepted the connection, not that login will succeed.

Should I publish Sparkplug B or plain MQTT topics?

Plain topics suit one consumer reading a handful of values where you control both ends. Sparkplug B adds a defined topic namespace, birth and death messages and typed metrics, which is what SCADA clients use for state and stale-data detection; the Sparkplug B driver in Geo SCADA Expert 2022 targets exactly that case. Pick Sparkplug B whenever a SCADA package is the subscriber, plain topics for simple feeds to scripts and dashboards.

Which account should the gateway use on the SCADA server?

A dedicated service account with read access to only the points the gateway publishes, never a personal login. A personal login breaks the feed when that person's password changes or the account is disabled, and an over-broad account turns a gateway compromise into read access to the whole point database. If the gateway only reads values, give it no write rights on points at all.

Keep reading

  • Comparison

    OPC UA vs MQTT Sparkplug from a controller to SCADA

    Pick OPC UA when the controller and the SCADA host share one plant LAN you control: the host subscribes inbound to the controller's browsable server. Pick MQTT Sparkplug B when the controller sits behind NAT, on cellular or at a remote site, or when several consumers need the same tags: outbound-only connections plus birth and death certificates give automatic tag discovery and stale detection.

    Edge computing and IIoT

  • How-to

    Bridging OPC UA PLC data to MQTT with an edge PC

    Keep the OPC UA server on the PLC side and give MQTT publishing its own role on a separate edge PC that acts as the OPC UA client and MQTT publisher. Commission the two links independently — first a verified tag read, then a verified subscriber message — and only then widen the tag set.

    Edge computing and IIoT

  • Troubleshooting

    Fix CODESYS MQTT TLS peer verification handshake failure

    Enabling peer verification in the MQTT client's TLS context fails because the controller has no trust anchor for the broker's certificate chain. Import the issuing CA certificate into the runtime's trusted certificate area through the security screen; the client identity .pfx does not provide that trust. A TCP_Init error is an earlier socket-layer fault, so check endpoint settings before touching certificates.

    Edge computing and IIoT

How Geo SCADA publishes values to MQTT