Integration · PLC

Connect OPC UA to CODESYS

ProductCODESYS
CategoryPLC
OPC UA roleServer

CODESYS provides an OPC UA server as part of its runtime, and because CODESYS is the engine inside many small and mid-sized PLC brands, you often meet it without the badge on the cabinet saying so. Symbols are published through the Symbol Configuration object, and the server typically requires a runtime licence.

Before you start

  • A runtime that includes the OPC UA server component, and the licence that activates it. Licensing is per runtime and is normally the responsibility of the device vendor rather than of CODESYS directly, which is exactly why it gets missed.
  • The CODESYS Development System at a version compatible with the runtime on the device.
  • A Symbol Configuration object in the application. Without one there is nothing to publish, and adding one is a code change requiring a download.
  • Filesystem or configuration access to the runtime for certificate handling, and knowledge of where that particular device vendor put the PKI directory.

Setting it up

  1. Establish what you are actually runningIdentify the device vendor, the CODESYS runtime version and whether the OPC UA server component is installed and licensed. On an OEM-badged controller this takes a phone call, and making that call first saves a day. The vendor's own naming for the option will not match CODESYS documentation.
  2. Add a Symbol Configuration and select symbolsAdd the Symbol Configuration object to the application, build, then tick the variables, program instances or global variable lists you want published, setting read or read and write access per entry. Selecting a whole GVL is the usual pragmatic choice; selecting everything is how you end up with an unbrowsable address space on a small controller.
  3. Confirm the symbol configuration is set up for OPC UA publicationThe Symbol Configuration has settings controlling how symbols are exposed and whether the OPC UA server publishes them. Check these rather than assuming that ticking a variable is sufficient, because the same object also serves other clients.
  4. Build and download, then reboot the runtime if requiredSymbol changes take effect with the application download; some runtimes need a restart before the server rebuilds its address space. Verify by browsing rather than by inspecting the project.
  5. Browse and record the namespace URIConnect a client, read the NamespaceArray and note the URI for the application's namespace. Store URI plus identifier in your configuration; the index will move.
  6. Complete the trust exchangeConnect once on a secure endpoint, let it fail, then move your client's certificate into the runtime's trusted store and trust the server certificate on the client. Where the device vendor exposes certificate handling through a web interface or a device tool rather than a filesystem, use that path.
  7. Check the runtime's limits and set intervals accordinglySmall CODESYS targets are frequently the tightest servers you will meet on session, subscription and monitored-item counts. Create the subscription you intend to run in production, read back the revised sampling and publishing intervals, and design to those.

What the address space looks like

The published address space follows the application structure: a namespace for the application, then program and global-variable-list nodes, then the symbols you selected, with structure and array members nested underneath. Identifiers are strings derived from the symbol path, so they read like the code and change when the code is renamed. There is no companion-specification content unless the device vendor has added an information model on top, which some do and most do not. Because the same Symbol Configuration serves other CODESYS communication paths, the OPC UA view is not always the whole picture of what the runtime exposes, and the browse tree is the only reliable statement of what a client can see.

The traps

  • The licence is per runtime and the device vendor controls it. A controller that browses fine on the bench and refuses in the field because its licence was never applied is a common and entirely avoidable schedule loss. Confirm the licence position with the device vendor, not with generic CODESYS material.
  • Because CODESYS is an OEM engine, documentation drift is severe: the vendor's manual, the CODESYS manual and the runtime's actual behaviour can disagree about option names and where certificates live. Trust the device in front of you.
  • Renaming a variable or restructuring the application changes string identifiers and breaks clients with BadNodeIdUnknown. Symbol selection is a published interface; version it.
  • Namespace indexes shift after application downloads. Resolve them from the NamespaceArray on every connect.
  • Certificate trust is the biggest deployment hurdle, and on OEM hardware the mechanism for placing a trusted certificate is the part nobody documents. Find out how it works on one unit before rolling out to fifty.
  • Symbols published read-only accept a write and return a Bad status. Read back and check the StatusCode.
  • Session and monitored-item ceilings on small targets are low. A historian, an HMI and an engineer with a browser open at once can exhaust them, and the failure arrives as a connection problem rather than as a capacity message.

Getting OEE data out of it

What you can get depends entirely on what the application computes, and on a CODESYS-based machine that usually means asking the machine builder to publish four things: a state or mode variable with a documented enumeration, a good-parts counter, a reject counter, and a fault or reason code. Counters must be maintained in the application; do not edge-detect a running bit through a subscription whose sampling interval the runtime may have widened. Because these targets are subscription-constrained, use one session, one publishing interval, a deadband on analogs and a heartbeat so that a silent connection is distinguishable from a stopped machine. Availability and counts are achievable and reasons are achievable if the fault table is documented. Planned production time, shift calendars, order context and standard cycle times are not in the controller.

Verify before you rely on this: Whether the OPC UA server component is present, whether a runtime licence is required and what the device vendor calls it, which CODESYS runtime versions your controller supports, where its certificate stores live and what its session, subscription and monitored-item limits are must all be confirmed with the device vendor for your exact controller, not with generic CODESYS material and not with this page. On OEM-badged hardware the vendor's answer overrides everything else, including the CODESYS documentation.

Last verified 7 September 2026 against OPC UA 1.05.07. OPC UA Connect is an educational resource and is not affiliated with the OPC Foundation.

Free download
OPC UA Machine Data → OEE Mapping Kit
Which nodes to subscribe to, how they become Availability, Performance and Quality, and which companion specification already gives you the answer, so you stop inventing tags.
Get the free mapping kit →
Free, no course, no login