Connect OPC UA to Siemens S7-1200
| Product | Siemens S7-1200 |
|---|---|
| Category | PLC |
| OPC UA role | Server |
The S7-1200 can act as an OPC UA server, configured in TIA Portal like its larger sibling and reachable on opc.tcp://<plc-ip>:4840. Expect a licence or option requirement, a firmware floor, and materially tighter limits than an S7-1500. Confirm all three with Siemens for your exact CPU before planning.
Before you start
- A CPU firmware level that includes the OPC UA server. The S7-1200 gained server capability later than the S7-1500 and the capability set is narrower; confirm what your CPU supports rather than assuming parity.
- The licence or option that activates the server, if one applies to your CPU. Establish this at quotation stage.
- TIA Portal at a version matching the firmware.
- A realistic client design. This is a compact controller and the OPC UA server competes with the cyclic program for the same CPU.
- Network access to TCP 4840, or a reverse-connect path where the network layer only permits outbound connections.
Setting it up
- Enable the server and set the application nameIn the CPU properties, enable the OPC UA server and set the application name before you generate any certificate. The name feeds the ApplicationUri, and a later change invalidates the trust relationships you built around the old one.
- Expose a small, deliberate set of tagsUse the per-tag accessibility attributes to publish only what a client genuinely needs, and mark writability explicitly. On a compact CPU this is not tidiness, it is capacity management: every published node is a candidate monitored item.
- Define a server interface as the contractWhere the TIA version supports it, define a server interface with stable names rather than exposing raw symbol names. It keeps the browse tree small and decouples the client from internal program structure.
- Set security policies and generate the server certificateChoose the offered security policies and message security modes, decide on anonymous or username identity, and generate the CPU certificate with every hostname and IP a client will dial in the Subject Alternative Name plus the ApplicationUri as a URI entry.
- Download, then prove the endpoint from an independent clientConnect on security None first to confirm the network path and endpoint, then on a signed and encrypted endpoint. Expect BadCertificateUntrusted on the first secure attempt and complete the trust exchange in both directions.
- Measure before you scaleCreate the subscription you actually intend to run and watch the revised sampling and publishing intervals the server returns, not the ones you asked for. On a compact CPU the revision is often substantial and it is the real cadence your data will arrive at.
- Resolve namespace indexes from the NamespaceArrayRead the NamespaceArray at connect and map URI to index. Store URI plus identifier in configuration so a program download cannot break your node references.
What the address space looks like
The same Siemens-shaped tree as the S7-1500: a node named for the PLC with data-block, input, output and memory folders beneath it, and string identifiers mirroring TIA symbol names such as ns=3;s="MyDB"."Count". Companion-specification content is not present unless someone built and downloaded a server interface mapped to a model, and the tooling path for doing so on a compact CPU is more constrained than on an S7-1500. Assume you are integrating against named tags, and design your client so the tag mapping lives in configuration rather than in code.
The traps
- Do not assume feature parity with the S7-1500. Client functionality, PubSub, server-interface tooling and method support are the areas where a compact CPU is most likely to differ, and a design that quietly depends on one of them fails late.
- Session and monitored-item limits are low enough that a second client can be the whole problem. An engineer leaving UaExpert connected overnight while a historian collects is a genuine cause of BadTooManySessions on this platform.
- The server revises your sampling and publishing intervals downward in capability terms without failing the request. Read the revised values back and treat them as the contract, or your OEE timing assumptions will be wrong by a factor you never see.
- A namespace index shift after a program download breaks hardcoded node references with BadNodeIdUnknown, exactly as on any other platform.
- Certificate trust remains the biggest single deployment hurdle, and it must be completed on both the CPU and the client.
- Timestamp quality is limited. Expect ServerTimestamp to be the meaningful one and expect the clock to need NTP discipline; a downtime record with the wrong timestamp is worse than no record.
Getting OEE data out of it
Treat an S7-1200 as a source of a handful of well-chosen signals rather than a machine-data platform. Counts should come from a counter maintained in the PLC, not from your client edge-detecting a boolean across a sampling interval that the server may have widened. State should come from an integer state variable the programmer commits to, and downtime reasons from a fault word decoded against a documented table. Because subscription capacity is tight, favour one client, one session, one publishing interval, and a heartbeat so that no change is distinguishable from a dead connection. Planned production time, shift patterns and standard cycle times are not here and never will be.
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.