Resolving WinCC Unified OPC UA Connection to S7-1500 Server

David Krause18 min read
OPC / OPC UASiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview

Connecting a SIMATIC WinCC Unified runtime to an S7-1500 OPC UA server is a common architecture for separating the HMI project from the PLC project, especially when the HMI is published on a Unified Comfort Panel (UCP), Unified PC runtime, or a multi-project engineering setup. The connection is conceptually simple—TIA Portal handles the discovery, the runtime consumes the published DB tags—but the failure modes produce identical symptoms: tags are visible in the engineering system (discovery succeeds, browse succeeds) yet the runtime value field stays empty and the tag quality displays an error code.

This article walks through the canonical case in which a WinCC Unified OPC UA client sees a S7-1513 server, can browse the address space, but cannot read or update tag values at runtime. It covers certificate management across projects, security policy selection, endpoint URL construction, server interface configuration, and runtime-side trust store configuration, and it ends with a verification procedure and a troubleshooting matrix.

Problem Symptoms

The reported failure pattern has three diagnostic features that are diagnostic by themselves:

  1. OPC UA discovery on the engineering system succeeds. The OPC UA connection wizard in TIA Portal locates the server, browses the address space, and lets the engineer select individual tags.
  2. Third-party OPC UA clients behave inconsistently. UaExpert (Unified Automation) reads the value correctly; OPC Scout (Siemens) returns an empty value. The difference is the trust-store behavior at first contact: UaExpert prompts the user to install the server certificate, while OPC Scout rejects unknown server certificates silently.
  3. WinCC Unified runtime returns the tag with an empty value and a non-zero quality code (typically OPC_Quality_Bad or OPC_Quality_Bad_CommunicationError). The value is not held at the last good reading; the connection state shows the channel as up, but the item state shows bad.

The combination is a strong indicator of a trust-store or endpoint-resolution problem at the runtime, not a tag mapping or a server-side publishing problem. Discovery and browse happen over the Discovery service on port 4840 and require only an unauthenticated session; read services require an activated secure channel, a session, and a trusted server certificate, all of which must be present at runtime.

Root Cause Analysis

Three layered causes produce the reported symptoms. They must be resolved in order because each one masks the next.

Cause 1 — Server certificate not in the WinCC Unified runtime trust store. The S7-1500 OPC UA server ships with a self-signed certificate. The engineering system implicitly trusts it because TIA Portal is the same project (or a project that has been synchronized with the PLC's certificate via the global certificate manager). When the HMI runtime starts, it has its own certificate store. If the server certificate is not present in that store, the runtime either refuses the secure channel or accepts it but cannot verify the application description, and the read requests are dropped.

Cause 2 — Endpoint URL configured for engineering but not for runtime. The OPC UA connection object in TIA Portal accepts a discovery URL (opc.tcp://<IP>:4840). During engineering, the client follows the discovery URL to the endpoint description list and selects a working endpoint. The runtime re-resolves the same discovery URL. If the runtime PC or Unified Comfort Panel cannot reach the same IP address at runtime (DNS, routing, firewall on port 4840, or a DHCP-issued address that changed between engineering and deployment), the discovery request fails and the channel never opens.

Cause 3 — Server interface not published. The S7-1500 OPC UA server only exposes tags that the user has explicitly published. The server interfaces are configured per PLC under Properties → OPC UA Server → Server interfaces. A DB tag that is not added to a server interface is invisible to all OPC UA clients, including UaExpert if the user is browsing the wrong interface. Discovery succeeds, browse succeeds, the tag is visible—but the read returns a status code Bad_NodeIdUnknown at runtime.

Architectural Prerequisites

Before changing any setting, confirm the deployment matches the assumptions of the OPC UA client channel in WinCC Unified.

Component Minimum Version Notes
TIA Portal (engineering) V17 Update 4 or later V18, V19, V20 are supported; the OPC UA client channel API is stable across these versions.
S7-1500 CPU firmware V2.9 or later Firmware V2.9 added the modern security policies (Basic256Sha256). Earlier firmware versions only support None and Basic128Rsa15.
WinCC Unified runtime (PC) V17 or later Unified PC Runtime; corresponds to the TIA Portal version used to compile the project.
Unified Comfort Panel MTP/MTP700–MTP2200 with firmware V17 or later All MTP panels ship with the WinCC Unified runtime; the OPC UA client channel is enabled by default.
OPC UA discovery port 4840/TCP Default for the S7-1500 OPC UA server. Must be reachable from the runtime host.
A license is required for the S7-1500 OPC UA server. The runtime license is included in the CPU firmware as a basic OPC UA server. The full-featured OPC UA server (with method calls, alarms, and historical access) is unlocked by a separate SIMATIC OPC UA S7-1500S license (6ES7823-0BA00-2BA0 for V18/V19, 6ES7823-0BA10-2BA0 for V20). For simple tag publishing as in this case, the basic server is sufficient.

Configuring the S7-1500 OPC UA Server

The server-side configuration is the foundation. If the server is not publishing the tag, no client configuration will produce a value at runtime.

  1. In the TIA Portal project that contains the S7-1500 CPU, open the device view of the CPU and navigate to Properties → OPC UA Server.
  2. Enable the Activate OPC UA Server checkbox.
  3. Confirm the port is 4840. If the network requires a different port, change it here and update the connection in the HMI project accordingly.
  4. Under Server interfaces, add the data block(s) you want to expose. Each server interface has a name, an optional namespace URI, and a list of accessible nodes.
  5. Select the DB tag(s) you want to publish and add them to the server interface. The PLC symbol table is the source for selection.
  6. Under Security, set the security policy. For an initial test where you want to isolate other causes, set Security policy to None and User authentication to Allow anonymous (this is the "guest authentication" the user mentioned). This corresponds to OPC UA MessageSecurityMode=None and SecurityPolicy=None.
  7. Compile the project, download it to the CPU, and perform a STOP → RUN transition to start the OPC UA server. The server only starts after a power-on or STOP→RUN transition following a configuration change.
The S7-1500 OPC UA server ignores the security settings until the project is recompiled and downloaded. Editing the security policy and saving the project without downloading leaves the runtime server on the previous configuration.

Verify the server is publishing by connecting UaExpert. The address is opc.tcp://<PLC_IP>:4840. After the first connection, UaExpert prompts the user to trust the server certificate. This single observation—UaExpert reading values while OPC Scout returns empty—is the strong signal that the server is healthy and the trust store is the problem.

Configuring the WinCC Unified OPC UA Client Connection

The connection object on the HMI side is configured in TIA Portal under HMI device → Connections → OPC UA. For the canonical S7-1500 server case, follow the procedure documented in the Siemens TIA Portal help portal for WinCC Unified OPC UA client configuration: Defining connection settings to the OPC UA server (RT Unified).

  1. Add a new connection. The connection type is OPC UA.
  2. Set the Connection URL to opc.tcp://<PLC_IP>:4840. Do not append a path. Do not use the hostname unless DNS resolves it on the runtime host.
  3. Set the Security policy to None and the Message security mode to None to match the server configuration during the first commissioning pass.
  4. Set the User token policy to Anonymous (this is the "guest authentication" mode).
  5. Use the Browse button to verify that TIA Portal can browse the server address space. If browse succeeds, the engineering connection is working.
  6. Add the tags you want to read. The wizard produces a list of HMI tags with OPC UA item names of the form ns=3;s="DB_Name"."Tag_Name" or ns=4;s="MyInterface"/"TagName" depending on the namespace configuration.
Do not confuse the Connection URL (the discovery endpoint on port 4840) with the runtime endpoint. The runtime re-opens the discovery URL and selects an endpoint from the server's GetEndpoints response. If the server is configured with a non-default port or with a hostname, the runtime will use the same value. The runtime does not store the engineering-time discovery IP.

Certificate Management Across Projects

When the PLC and the HMI are in different TIA Portal projects, the global certificate manager is the default mechanism. It allows the engineering system to sync certificates between projects during download. The user has indicated they do not want to use the global certificate manager, so the certificate must be managed manually. There are two certificates to manage:

  • The server certificate issued by the S7-1500 OPC UA server. The runtime must trust it.
  • The client certificate issued by the WinCC Unified runtime. The server must trust it (or, with None security and anonymous authentication, the server does not check it).

Exporting the server certificate

  1. Open the S7-1500 device view in TIA Portal.
  2. Navigate to Properties → OPC UA Server → Security → Server certificate.
  3. Use Export certificate to write the DER-encoded certificate (file extension .der or .cer) to a local file. The certificate is self-signed by the CPU and is regenerated on each full download if the OPC UA server is re-initialized.

Importing the server certificate into the WinCC Unified runtime trust store

The WinCC Unified runtime on a PC uses the local certificate store of the user account running the runtime service. The Simatic Runtime Manager exposes this store. On a Unified Comfort Panel, the store is on the panel itself.

  1. Open Simatic Runtime Manager.
  2. Select the runtime instance.
  3. Open Settings → OPC UA → Trusted server certificates.
  4. Import the DER file exported from the PLC.
  5. Restart the WinCC Unified runtime to ensure the trust list is re-read.
If the PLC is reset to factory defaults or the OPC UA server is re-initialized, the server certificate changes. The import procedure must be repeated. A common silent failure is that the engineering-time import was performed against a different certificate (the device certificate shown in the device view) than the runtime-time certificate issued at server start. Use the certificate the server actually presents during the TLS handshake; the easiest way to capture it is to use UaExpert on the runtime host, connect to opc.tcp://<PLC_IP>:4840, and export the server certificate from the certificate dialog. That is the certificate the runtime must trust.

Client certificate handling

With None security and Anonymous authentication, the client certificate is not checked by the server. As soon as the security policy is upgraded to Basic256Sha256, the server-side Trusted client certificates list must contain the runtime's client certificate. The runtime's client certificate is generated on first start of the runtime and stored in %ProgramData%/Siemens/Automation/WinCCUnified/runtime/<instance>/certstore on a PC, or in the corresponding location on a Unified Comfort Panel.

Resolving Empty Tag Values at Runtime

With the server publishing, the connection configured, and the certificate in the trust store, the next most common reason for empty values is the endpoint-selection behavior at runtime. WinCC Unified uses the OPC UA discovery URL to obtain the list of available endpoints and selects the first endpoint that matches the configured security policy. If the server returns multiple endpoints (for example, one on port 4840 with None security and one on port 4841 with Basic256Sha256), the runtime may select a different endpoint than the engineering system.

To force a deterministic endpoint selection:

  1. Open the OPC UA connection in the HMI project.
  2. Set the Endpoint URL explicitly to the URL of the desired endpoint. On the S7-1500 with default configuration, this is opc.tcp://<PLC_IP>:4840 for the None endpoint, or opc.tcp://<PLC_IP>:4841 for the Basic256Sha256 endpoint.
  3. Recompile the HMI project and download to the runtime.

If the runtime still returns empty values, enable the OPC UA diagnostic logging on the runtime host. On a PC, this is %ProgramData%/Siemens/Automation/WinCCUnified/runtime/<instance>/Logs/OPCUA.log. The log records every channel open, endpoint selection, certificate validation result, and read request with its status code.

Interpreting WinCC Unified OPC UA Error Codes

The cryptic error code reported by the user is a WinCC Unified quality code. The most common codes seen in this scenario, with their OPC UA StatusCode equivalents, are:

WinCC Unified Quality Code OPC UA StatusCode Hex Value Meaning
OPC_Quality_Bad Bad 0x80000000 Generic failure; see the log for the inner status code.
OPC_Quality_Bad_ConfigurationError Bad_ConfigurationError 0x80050000 The connection or tag is misconfigured in the engineering project.
OPC_Quality_Bad_CommunicationError Bad_CommunicationError 0x80050000 The runtime could not reach the server, or the secure channel was rejected.
OPC_Quality_Bad_ServerCertificateInvalid Bad_CertificateInvalid 0x80120000 The server certificate is not trusted by the runtime.
OPC_Quality_Bad_ServerCertificateTimeInvalid Bad_CertificateTimeInvalid 0x80140000 The PLC clock is wrong, or the runtime host clock is wrong, by more than the certificate validity window.
OPC_Quality_Bad_ServerCertificateUriInvalid Bad_CertificateUriInvalid 0x80130000 The application description URL does not match the certificate SAN.
OPC_Quality_Bad_NodeIdUnknown Bad_NodeIdUnknown 0x80340000 The tag is not published in any server interface.
OPC_Quality_Bad_AccessDenied Bad_UserAccessDenied 0x801F0000 The user token is rejected, or the server-side access list excludes the tag.
OPC_Quality_Bad_SecurityChecksFailed Bad_SecurityChecksFailed 0x80120000 Security policy or message security mode mismatch.

The exact inner status code is written to the OPC UA log on the runtime host. Reading the log is faster than guessing from the HMI quality code alone.

Verification

After applying the changes, verify the connection end-to-end with the following procedure.

  1. On the S7-1500, confirm the OPC UA server is running. In the CPU's online diagnostics, navigate to Diagnostics → OPC UA. The server should report Running with the configured endpoint URL.
  2. On the runtime host, open UaExpert and connect to the same URL. If UaExpert reads the value, the network path, port, server, and server-side publishing are all correct. The remaining cause is the WinCC Unified trust store.
  3. In Simatic Runtime Manager, confirm the server certificate is in the trusted list. Restart the runtime.
  4. Start the WinCC Unified runtime. Open the HMI tag in the online tag diagnostics. The value should be displayed, and the quality code should be OPC_Quality_Good (hex 0x00000000).
  5. Force a value change in the PLC (set the tag to a known value in the watch table). Confirm the HMI reflects the new value within the configured acquisition cycle (default 1 s for cyclic polling, 250 ms for change-of-state).

Troubleshooting Matrix

Symptom Most Likely Cause Action
Discovery succeeds, browse succeeds, runtime value is empty. Server certificate not trusted by runtime. Export server certificate, import into Simatic Runtime Manager, restart runtime.
Discovery fails from runtime host, succeeds from engineering PC. Network or firewall blocks port 4840 between runtime and PLC. Run Test-NetConnection <PLC_IP> -Port 4840 on the runtime host; open the port on intermediate firewalls.
UaExpert reads the value, OPC Scout does not. OPC Scout rejects the server certificate silently; UaExpert installs it on first contact. Install the server certificate into the OPC Scout trust store manually, or upgrade both clients to trust the same CA chain.
Runtime shows Bad_NodeIdUnknown for a tag that is visible in browse. Tag is not added to a published server interface. Add the tag to a server interface in PLC Properties → OPC UA Server → Server interfaces, recompile, redownload the PLC.
Runtime shows Bad_CertificateTimeInvalid. PLC clock or runtime host clock is out of range. Enable NTP on the PLC (default time source is NTP); check the runtime host date and time.
Runtime shows Bad_ConfigurationError after upgrading TIA Portal. Tag address format changed between TIA Portal versions; the OPC UA item name changed. Re-add the tag from browse; do not edit the ItemName field manually.
Connection is up, value is correct, but updates are slow. Acquisition cycle is too long, or server-side sampling rate is too long. Reduce the polling cycle in the HMI tag properties; check the published sampling interval on the server interface.
Runtime works in engineering, fails in production. PLC IP changed; the connection URL is hard-coded. Use a DNS name and confirm resolution on the runtime host, or use the runtime configuration to override the URL at deploy time.

Hardening for Production

The None / Anonymous configuration is acceptable for the initial commissioning pass and for isolated lab networks. It must not be left in place for production. The recommended production configuration is:

  • Security policy: Basic256Sha256 on the S7-1500 (firmware V2.9 or later) and on the WinCC Unified client. This policy uses SHA-256 and 256-bit AES, and is the only policy currently considered secure by the OPC Foundation. Basic128Rsa15 and Basic256 are deprecated.
  • Message security mode: SignAndEncrypt. This ensures both message integrity and confidentiality.
  • User authentication: Username/Password with a dedicated OPC UA user, or Certificate with mutual TLS. Anonymous is not appropriate for production.
  • Certificate management: a CA-issued certificate for both the server and the runtime, with the CA root in the trust store of the other side. Self-signed certificates are acceptable but must be rotated annually.
  • Firewall: restrict port 4840/TCP to the runtime host IP only. The S7-1500 firewall (CPU PROFINET interface) should also restrict the port to the runtime host's MAC or IP.

When upgrading from None to Basic256Sha256, perform the change in a controlled sequence. First, add Basic256Sha256 as an additional policy on the server while keeping None available. Confirm the runtime connects with the new policy. Then remove None. This sequence avoids a configuration error locking out the only client.

Notes on Alternative Client Channels

The OPC UA client channel documented in the Siemens TIA Portal help is the official channel for connecting WinCC Unified to an S7-1500 OPC UA server. Third-party OPC UA channels exist (the OPC UA Extension for SIMATIC WinCC developed by Allmendinger and distributed by Unified Automation is one example) and offer features such as redundant server handling and historical access. These channels are configured separately and are not part of the TIA Portal connection wizard. The OPC UA Extension for SIMATIC WinCC case study documents the deployment topology for these third-party channels and is useful for advanced scenarios such as connecting to a non-Siemens OPC UA server.

For a S7-1500 server, the native WinCC Unified OPC UA client channel is the supported path. It uses the same discovery and browse experience as the engineering connection, and it is maintained by Siemens as part of the TIA Portal release.

Field-Proven Caveats

A few caveats seen in field deployments are worth recording explicitly.

  • The S7-1500 OPC UA server uses the PROFINET interface's IP address. If the CPU has multiple PROFINET interfaces, the OPC UA server listens on the IP of the interface configured under OPC UA Server → IP address. A common error is pointing the runtime at the PROFINET X2 IP when the server is listening on X1.
  • The server certificate is regenerated when the CPU is reset to factory defaults. The runtime trust list must be re-imported after a factory reset, even if the project was downloaded unchanged.
  • WinCC Unified on a Unified Comfort Panel uses the panel's IP, not the engineering PC's IP, to reach the server. The connection URL must be reachable from the panel's network interface, not the engineering subnet.
  • If the runtime is started before the PLC is online, the connection enters a retry state. Confirm in the runtime diagnostics that the connection state is Connected and not Establishing or Disconnected before evaluating tag quality.
  • The default acquisition cycle for an OPC UA tag in WinCC Unified is 1 second. A 100 ms update rate requires explicit configuration on the tag and on the server interface sampling interval.

Why does UaExpert read the tag but WinCC Unified shows it as empty?

UaExpert prompts the user to install the server certificate on first connection, adding it to the local trust store. WinCC Unified runtime uses a separate trust store managed by Simatic Runtime Manager; if the server certificate is not imported there, the runtime rejects the secure channel and the tag quality becomes Bad_CommunicationError or Bad_CertificateInvalid. Export the server certificate from the PLC (Properties → OPC UA Server → Security → Server certificate) and import it into Simatic Runtime Manager → Settings → OPC UA → Trusted server certificates, then restart the runtime.

Do I need the SIMATIC OPC UA S7-1500S license to publish DB tags?

No, not for simple DB tag publishing. The S7-1500 firmware includes a basic OPC UA server that supports read, write, and subscription on tags added to a server interface. The SIMATIC OPC UA S7-1500S license (catalog numbers 6ES7823-0BA00-2BA0 for V18/V19, 6ES7823-0BA10-2BA0 for V20) unlocks method calls, alarms and conditions, and historical access. For the WinCC Unified use case described here, the basic server is sufficient.

Which port does the S7-1500 OPC UA server use?

Port 4840/TCP for the None and Basic256Sha256 discovery endpoint. When the security policy is set to Basic256Sha256 with SignAndEncrypt, the server additionally opens a second endpoint on port 4841/TCP for the encrypted session. Both ports must be reachable from the runtime host. The default can be changed in PLC Properties → OPC UA Server → Port.

Can the PLC and HMI projects share certificates without the global certificate manager?

Yes. The global certificate manager is a TIA Portal convenience that syncs certificates between projects during download. It is not required at runtime. At runtime, only the certificate stores on the runtime host and on the PLC matter. Export the server certificate from the PLC project, import it into the WinCC Unified runtime trust store, and (if using a non-None security policy) export the runtime's client certificate and import it into the PLC's Trusted client certificates list. The procedure is documented in the TIA Portal V20 OPC UA client configuration help.

What does the cryptic WinCC Unified error code mean?

WinCC Unified displays an OPC UA StatusCode. The most common values seen in this scenario are Bad_CertificateInvalid (0x80120000, server certificate not trusted), Bad_CommunicationError (0x80050000, network or firewall blocking the secure channel), Bad_NodeIdUnknown (0x80340000, tag not published in any server interface), and Bad_CertificateTimeInvalid (0x80140000, clock skew between PLC and runtime host). The full inner status code is written to %ProgramData%/Siemens/Automation/WinCCUnified/runtime/<instance>/Logs/OPCUA.log on a PC runtime, which is the fastest way to identify the exact cause.

Back to blog