OPC Server Setup

Activating the OPC server in the user's Siemens TIA project

The 10 steps to prepare the TIA Portal project for the S7 Link OPC Client plugin. The captures come from the English TIA Portal, with a CPU 1513F-1 PN.

Steps 5 and 7–8 are two ways to create the OPC UA user: in the CPU configuration, or in the project security settings. One is enough. At the end, download the hardware configuration and the program to the CPU.

  1. Step 1

    Activate the OPC UA server

    In the CPU properties, under OPC UA › Server › General, tick “Activate OPC UA server”.

    TIA Portal: Activate the OPC UA server
  2. Step 2

    Check the connection settings

    On the same page, port 4840 is the one S7 Link uses unless you change it in the app. “Max. number of OPC UA sessions” must cover all the devices connected at the same time.

    TIA Portal: Check the connection settings
  3. Step 3

    Choose the security policies

    Under Security › Secure channel, tick the policies the server offers. S7 Link uses Basic256Sha256 - Sign and Basic256Sha256 - Sign & Encrypt; leave “No security” off, except for tests on an isolated network. Under Certificate settings, keep “Use certificates configured and downloaded using TIA Portal”.

    TIA Portal: Choose the security policies
  4. Step 4

    Check the server certificate

    Under Security › Certificates, “Server certificate” must show a certificate, here PLC-TEST/OPCUA-1-2; if it is empty, create it with the “…” button. Under “Trusted clients”, add the certificate exported from S7 Link, or turn on “Automatically accept client certificates during runtime”.

    TIA Portal: Check the server certificate
  5. Step 5

    Create the OPC UA user

    Under Security › User authentication, tick “Enable user name and password authentication” and add the user, here s7link, with its password. Enter the same user and password in S7 Link.

    TIA Portal: Create the OPC UA user
  6. Step 6

    Decide on guest access

    “Enable guest authentication” lets any client connect without user name and password. For a secure connection leave it off; when it is on, S7 Link connects as a guest if the user field is empty.

    TIA Portal: Decide on guest access
  7. Step 7

    Enable the project users

    Under OPC UA › General, tick “Enable additional user management via project security settings” to use the users of the project security settings as well.

    TIA Portal: Enable the project users
  8. Step 8

    Give the user the OPC UA rights

    In the project tree, under Security settings › Users and roles, create the user (Local user, with a password) and assign it a role, here OPC_Client, with the runtime rights “OPC UA server access” and “User authentication of the OPC UA client”.

    TIA Portal: Give the user the OPC UA rights
  9. Step 9

    Make the PLC tags reachable

    In the PLC tags table, tick “Accessible from HMI/OPC UA/Web API” for the tags to read and “Writable from HMI/OPC UA/Web API” for those to write.

    TIA Portal: Make the PLC tags reachable
  10. Step 10

    Make the data blocks reachable

    Do the same in every data block, optimized ones included, like DB_TEST_OPT. A variable without “Writable”, like READONLY, is read only in S7 Link. Then download everything to the CPU.

    TIA Portal: Make the data blocks reachable

For the app settings see the guide, Preparing the PLC for OPC UA.

Are you an iS7 or S7 Link user?

If you like, tell me what you think of the new version or send me your suggestions.

Do you represent a school, an institute or a university? Write to me and we will see whether a free promo code can be provided.