IMD SolutionComputing LibraryShop main store

Comparison

MQTT on a CoDeSys 2.3 PLC: gateway vs controller client

Edge computing and IIoT Published 8 min read

Short answer

No MQTT client library is identified for the WAGO 750-830 running CoDeSys 2.3, so the controller cannot be the MQTT client; keep it on control and publish from an external gateway or edge PC that reads it over an interface the installation already supports. Migrate the controller only when MQTT must run inside it. The comparison below gives the decision for each path.

On this page
  1. Can the 750-830 publish MQTT from CoDeSys 2.3?
  2. Why does MQTT need a library instead of a socket?
  3. How do I confirm whether a library fits the 750-830?
  4. Where should the MQTT client run instead?
  5. Which interface should the gateway use to read the controller?
  6. How much network load does the gateway design add?
  7. How do I verify the design before production?
  8. When is moving to a newer controller the better decision?
  9. Questions asked

Treat the direct path as closed: no MQTT client library is identified for a WAGO 750-830 running CoDeSys 2.3, so the controller cannot be the MQTT client until WAGO names a package compiled for that exact target — on CoDeSys 2.3 hardware, MQTT client use is associated with the PFC generation of controllers, not this one. The working design keeps the 750-830 on control and runs the MQTT client on an external gateway or edge PC that reads the controller over an interface the installation already supports. Below: the three client locations compared, the checks that confirm or kill each path, and the traffic numbers for the gateway design.

Can the 750-830 publish MQTT from CoDeSys 2.3? #

Not on today's evidence: no MQTT client library is identified for the 750-830 on CoDeSys 2.3, so the direct-client path stays closed until WAGO confirms a package for that exact controller and runtime.

"No library identified" is a statement about the documentation found, not proof of impossibility, and it is the correct engineering stop signal just the same. CoDeSys 2.3 is a different runtime generation from CoDeSys 3: a library written for the newer runtime, or for another vendor's controller, cannot be assumed to insert, compile or run on the 750-830. Memory limits, dependent libraries, the socket services the runtime exposes and its programming interfaces all gate the outcome.

Under CoDeSys 2.3, MQTT client use shows up around WAGO's PFC generation of controllers; the 750-830 is not in that group. If WAGO support supplies a library name, a supported-controller list that includes the 750-830, the required runtime and an example project, run the checks below before believing it; until then, plan for one of the two architectures that do not depend on the controller.

Why does MQTT need a library instead of a socket? #

Because ISO/IEC 20922, the standardized MQTT v3.1.1 protocol, requires a client to do far more than send bytes: session setup, keepalive, publish tracking and quality-of-service acknowledgements are all client duties.

In practical terms the client must open a TCP session, complete the connection handshake with the broker, keep the session alive at an agreed interval, publish messages tagged with topics at a chosen quality of service, track acknowledgements for QoS 1, run the fuller exchange for QoS 2, maintain subscriptions, detect a broken session and reconnect — all without blocking the control task. The socket function blocks you will find in a CoDeSys 2.3 project provide the transport pipe only; every behaviour above is yours to implement or to load from a library. Authentication and encrypted transport add credentials, certificates and cryptography on top. A socket is the road, not the truck: the library is what carries the protocol.

How do I confirm whether a library fits the 750-830? #

Five checks, in order: record the exact controller and runtime, search the installed library repository for an MQTT client for that target, read its compatibility list, and ask WAGO support for the package name in writing.

  1. Record the target exactly: controller 750-830, runtime CoDeSys 2.3. A claim that a library "supports CoDeSys" says nothing until the controller list and runtime generation match.
  2. Search the engineering tool's library repository for an MQTT client intended for that target. Finding socket or Ethernet function blocks is not finding MQTT.
  3. For any candidate, read the documentation for the supported controller list, required runtime, dependent libraries, memory requirements and licensing conditions.
  4. Build the smallest test project. A library that cannot be inserted for the target, or that fails to compile on unresolved dependencies, is not a deployment option.
  5. Ask WAGO through an official support channel whether a maintained MQTT library exists for this combination, and request the package name, the compatibility statement and an example project.

Compilation proves insertion, not production. The runtime test must cover connection loss, broker restart, malformed inbound data and recovery, with the control task's cycle time unchanged throughout. Only that result opens the direct path.

Where should the MQTT client run instead? #

On a separate box: an external gateway or edge PC reads the 750-830 through a documented interface and runs the MQTT client itself, which is the recommended architecture whenever the controller stays in place.

Architecture Where the MQTT client runs What it needs from the 750-830 Decision
Direct PLC client Inside the CoDeSys 2.3 application An MQTT library compiled for this exact target Closed until WAGO confirms a package; then run the target checks above
External gateway On a gateway or edge PC beside the controller A data interface the installed configuration already supports The working choice while the 750-830 stays in place
Controller migration On a newer controller platform Application, I/O and network migration Choose when MQTT must run in the controller or replacement is due anyway

The general trade between a client in the controller and a client on a box beside it is covered in PLC MQTT direct publishing versus an IoT gateway; the legacy runtime here does not tilt that trade, it removes one side of it. The gateway splits the jobs cleanly: the 750-830 keeps the machine and presents selected variables, while the box beside it owns the broker session, payload formatting, buffering and reconnects. For the hardware, a fanless mini PC in the controller cabinet covers the gateway role with no moving parts.

Which interface should the gateway use to read the controller? #

Whichever one the installed 750-830 configuration already documents: the 750 I/O family supports common fieldbus protocols and Ethernet standards, and WAGO's application notes for that family include Modbus communication between Ethernet couplers and controllers.

Base the choice on the hardware, application and communication facilities actually present, and verify the protocol set against your installed configuration before designing around it. Then build an explicit data map before touching the gateway configuration:

  • Each PLC variable with direction, data type, scaling, permitted range, update condition and MQTT topic.
  • Read-only telemetry topics kept separate from writable command topics.
  • For write-back, confirmed subscribe capability: publish-only products exist, and edge gateways with no MQTT subscribe function cannot carry commands at all.

Treat the write path as a machine boundary: no external command may put the machine into a state the control program has not defined and validated.

How much network load does the gateway design add? #

Almost nothing at plant scale: a representative 20-variable telemetry map published every second plus 500 ms polling moves about 552 bytes per second of application data, roughly 4.4 kbit/s, which is 0.004 percent of a 100 Mbit/s link.

Worked example — illustrative inputs, not documented limits:

  • 20 analog variables, each held in one 16-bit register, mapped contiguously so one block read fetches all 20, polled every 500 ms.
  • One JSON publish per second, averaging 20 bytes per tag.

Arithmetic:

  • Read request: 7 B header + 5 B payload = 12 B. Read response: 7 B header + 2 B count + (20 x 2 B) data = 49 B. Round trip: 12 + 49 = 61 B.
  • Two round trips per second: 61 B x 2 = 122 B/s on the controller hop.
  • Publish message: 20 tags x 20 B = 400 B payload, plus about 30 B of topic and protocol overhead = 430 B, once per second = 430 B/s on the broker hop.
  • Total application data: 122 + 430 = 552 B/s, which is 552 x 8 = 4416 bit/s, about 4.4 kbit/s, or 4416 / 100,000,000 = 0.0044 percent of a 100 Mbit/s segment.

TCP/IP and Ethernet framing add per-frame overhead on the wire and a QoS 1 acknowledgement adds a few tens of bytes per publish; neither changes the order of magnitude. The number that actually constrains the design is not bandwidth but the poll rate the controller can serve: set the poll from the fastest change you must catch, and confirm the control task's cycle time is unchanged with polling running. On that basis, any plant segment carries this design.

How do I verify the design before production? #

Leg by leg: prove the controller-to-gateway connection and the gateway-to-broker connection independently, because a healthy broker session says nothing about the controller hop, and that split is what catches the failure you will actually get.

Hop Proven by Failure signature
Controller to gateway A known PLC value read through the gateway matches the controller's type, scaling and byte order Broker session stays green while the value freezes or never arrives
Gateway to broker Broker session state plus an independent subscriber receiving the mapped topic and payload Gateway keeps reading fresh PLC values while publishes stop
  1. Confirm link indications and addressing on the controller-to-gateway segment.
  2. Read a known value and compare data type, scaling and byte interpretation against the controller application.
  3. Change the value under controlled conditions and confirm the gateway detects the update at the intended rate.
  4. Subscribe with an independent authorized client and compare topic and payload against the data map.
  5. Disconnect each leg separately — controller, gateway, broker — and confirm a separate health indication changes for each; one combined communications-OK bit hides the failed hop.
  6. Send one stale, one out-of-range and one malformed command, and confirm each is rejected without touching outputs.
  7. Restart the broker and cycle the controller under controlled conditions, and confirm recovery without stretching the control cycle.

The same leg-by-leg split is the working procedure when edge gateway online but PLC offline is the symptom you are chasing in an existing installation.

When is moving to a newer controller the better decision? #

When MQTT must execute in the controller itself, or the 750-830 is due for replacement anyway: migrate to a platform whose runtime has a maintained MQTT library — under CoDeSys 2.3 that points to the PFC generation, and CoDeSys 3 targets widen the choice.

Migration is a project, not a swap: the application moves to the new engineering tool and runtime, I/O and network fit are re-verified, and everything retests. On CoDeSys 3 targets, maintained MQTT client libraries are available, and setting up the MQTT Client SL library on a CODESYS controller shows what that path looks like once the runtime supports it. The decision rule: if the machine control is stable and the goal is telemetry, historian feeds or remote monitoring, the gateway delivers it without touching the control program; spend the migration only when the control platform is changing regardless.

Questions asked

Do Ethernet socket function blocks in CoDeSys 2.3 mean MQTT is possible without a library?

No. Socket function blocks give you a raw TCP pipe, while ISO/IEC 20922 requires a full client on top: connection handshake, keepalive, topic-based publish and subscribe, and quality-of-service acknowledgements. You could write that state machine yourself in a CoDeSys 2.3 task, but you would then own code that must reconnect and recover without stretching the control cycle, which is exactly the work a supported library or an external gateway takes off your plate.

Can the gateway write setpoints back into the 750-830?

Yes, provided the gateway can subscribe to command topics and the controller interface accepts writes; publish-only products cannot. Keep ownership in the controller: validate payload type, range and command age against machine state before every write, and define the fail behaviour for when commands stop, repeat or arrive late. The gateway is a guest with a validated key, never the authority over outputs.

Is a controller from the PFC generation a drop-in replacement for the 750-830?

No. It is the CoDeSys 2.3 platform where MQTT client use is found, but migration still means moving the application to the new runtime and engineering tool, re-verifying I/O and network fit, and retesting. What it buys is a controller that can be the MQTT client itself, which matters when reads and writes must execute in the program rather than through a box beside it.

Which MQTT quality of service should the gateway publish at?

QoS 0 for fast telemetry where a lost sample is acceptable, QoS 1 for state changes and commands that must arrive, and a retained QoS 1 message for current machine state so a new subscriber starts current. QoS 2 is rarely needed on a plant broker and adds handshake traffic the 750-830 never sees directly, since the controller only answers polls from the gateway.

Keep reading

  • How-to

    Set up the MQTT Client SL library on a CODESYS controller

    MQTT Client SL is part of the CODESYS IIoT Libraries SL package. Verify the exact controller runtime and its license, pin the library version, batch JSON per asset, and set the controller clock before opening a TLS session.

    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

  • Comparison

    PLC MQTT direct publishing versus an IoT gateway

    For publishing process data to an MQTT broker for web monitoring, put the MQTT client in a gateway and leave the S7-1500 out of broker session logic. Keep the LMQTT_Client block in the PLC only when publication must be coordinated with control logic or the gateway cannot meet your topic, payload and delivery requirements. A green MQTT status proves the broker connection only, never the S7 data behind it.

    Edge computing and IIoT