In a SCADA, historian or IIoT project, the question at the first technical meeting is often the same: “How will we get the data from the PLC?” Because Siemens S7 is a widely used control platform, this question comes up a lot; the answer depends on the PLC series, firmware version, security requirements and how much communication load can be placed on the PLC. If the wrong method is chosen, either the PLC’s connection resources run out or a write door without authentication is left open. Below, from a field perspective, we compare PUT/GET, the built-in OPC UA server, external servers and active sending from the PLC across the S7-300/400/1200/1500 family.
The S7 PLC family and its communication capabilities
The four series come from different generations, and their ability to expose data differs accordingly:
- S7-300 and S7-400: CPUs from the STEP 7 Classic era. They are accessed with the S7comm protocol using absolute addressing (DB, M, I, Q) on an integrated Ethernet interface or via a CP. These CPUs have no built-in OPC UA server; communication module or external server options are verified from the manufacturer’s catalogue.
- S7-1200: Programmed with TIA Portal. In current firmware versions, PUT/GET access by external clients is disabled by default and must be enabled in the project. According to Siemens documentation, an OPC UA server (data access) is supported from firmware V4.4 onwards; the server interface is defined by modelling and requires a runtime licence.
- S7-1500: Programmed with TIA Portal. A built-in OPC UA server is offered and, according to Siemens documentation, an OPC UA client from firmware V2.6 onwards; verify from which firmware the server is supported in the CPU’s documentation. Both require a runtime licence depending on the CPU class. Connection resources are greater than on the S7-1200.
Which firmware version supports which feature, and which licence is needed for OPC UA, varies by CPU. Before deciding, verify with the CPU’s order number and firmware version in the manuals on Siemens Industry Online Support. The first job on site is to build the inventory from the actual CPU label and the TIA project; the order number in the electrical design and the CPU in the cabinet are not always the same.
S7comm uses TCP port 102 over ISO-on-TCP (RFC 1006). How this protocol is handled in terms of firewall rules and deep packet inspection is described in the article Modbus and S7 deep packet inspection on industrial firewalls.
S7comm PUT/GET access and its limitations
PUT/GET is an external client reading (GET) and writing (PUT) areas of PLC memory by absolute address. Many SCADA drivers, external OPC servers and open-source libraries (for example Snap7) use this mechanism. Snap7 is not an interface supported by Siemens; the example below should only be used with the automation team’s approval and on a PLC you are authorised for.
On the S7-1200 and S7-1500, the option Permit access with PUT/GET communication from remote partner under “Protection & Security → Connection mechanisms” in the CPU properties in TIA Portal must be ticked for this access. The S7-300/400 has no such switch; access is open by default. With TIA Portal V19 and CPU firmware V3.1 (V4.7 on the S7-1200) and later, the enabling step has changed: in addition to this option, the relevant access right must be granted in the user and role settings; for the current steps, see entry 109925755 on Siemens Industry Online Support. If the client connects but reads fail, the first places to look in the console are this checkbox and the access type of the DB being read.
A simple read example (with the python-snap7 library, from standard-access DB10):
import snap7
from snap7.util import get_real, get_int, get_bool
plc = snap7.client.Client()
# rack 0, slot 1: typical for S7-1200/1500; usually slot 2 for S7-300
plc.connect('10.20.30.11', 0, 1)
data = plc.db_read(10, 0, 8) # DB10, 8 bytes from byte 0
temperature = get_real(data, 0) # DBD0 (REAL)
counter = get_int(data, 4) # DBW4 (INT)
running = get_bool(data, 6, 0) # DBX6.0 (BOOL)
plc.disconnect()
The limits of PUT/GET:
- There is no authentication. Once access is enabled, any client that can reach it over the network can read and write the permitted areas. This is the method’s weakest point.
- Dependence on absolute addresses: If the DB structure changes and addresses shift, the client does not report an error; it reads wrong data. The trend looks fine, but the value is wrong. Change control is essential.
- PDU size: The data that can be carried in a single request is limited by the PDU size negotiated on the connection; large reads are split into several requests.
- Optimised blocks cannot be accessed: On the S7-1200/1500, only standard-access blocks can be read by absolute address.
Optimised block access and data block design
On the S7-1200 and S7-1500, DBs are created with “optimized block access” by default. In this mode, the compiler decides where variables sit in memory, and the concept of absolute addresses (DBX, DBW, DBD) does not exist; variables are accessed by symbolic name only. A DB to be read with PUT/GET must therefore have standard access.
The right way is not to turn off optimised access across the whole program, but to set up a separate interface DB exposed to the outside world:
- Create a DB with standard access (optimized block access off), for example
DB_Interface. - Define the variables to be exposed in this DB in a fixed order, with the same data types grouped together. Leave spare space at the end; existing addresses don’t shift when new variables are added.
- In the PLC program, for example in a cyclic OB, copy the values from the optimised DBs into this DB.
- Put commands to be written from outside into a separate DB and process them in the PLC with validation; the external system should not write directly to process variables.
This structure is also a contract. The IT and automation teams track which data is at which address from a single DB definition. Who is to be informed when a change is made on the automation side should also be part of this contract.
Using the built-in OPC UA server
On S7-1500 CPUs and S7-1200 CPUs that support OPC UA, the server is enabled in the CPU properties in TIA Portal. What it brings:
- Variables are accessed by symbolic name; optimised DBs can be used.
- Certificate-based encryption and signing, and username/password authentication are supported.
- With subscriptions, the client receives changes instead of polling every time.
- Which variables are visible and writable via OPC UA can be set at DB and variable level; by defining a server interface, only selected variables can be published.
Points to watch: Siemens requires a runtime licence for using the built-in server, depending on the CPU class; the licence status must be checked in the project. The number of simultaneous sessions and monitored items supported is limited by CPU class. Subscribing to many variables with a short sampling interval increases the CPU’s communication load; cycle time gets longer. The security policy and certificate management must be set up correctly; details are in the article OPC UA security settings.
Active data sending from the PLC
In some cases, it is more appropriate for the PLC itself to send the data rather than reading it from outside. Options:
- Open User Communication (TCP/UDP): With blocks such as
TSEND_C/TRCV_C, the PLC sends data to a server in a format it defines. It is flexible, but requires a dedicated receiving application on the other side and a written format contract. - MQTT client: With the MQTT client library Siemens has published for the S7-1200/1500, the PLC can publish directly to a broker. TLS support and PLC resource consumption must be assessed according to the library version.
- OPC UA client (S7-1500): The PLC can call methods or write variables on an OPC UA server in the higher-level system.
The real advantage of active sending is that the event is captured on the PLC side exactly on time and with a timestamp: a part result or alarm is transmitted independently of the read interval. There is a cost, too. Every change is made in the PLC program, and the program has to handle communication errors (other side down, buffer full). A TSEND_C call without error handling silently loses data the day the server goes down.
Method comparison table
| Method | PLC series | Security | PLC load |
|---|---|---|---|
| S7comm PUT/GET | 300, 400, 1200, 1500 | No authentication | Low–medium, depends on read frequency |
| Built-in OPC UA | 1500, 1200 (V4.4+) | Encryption, certificates, users | Medium, depends on number of subscriptions |
| External OPC/gateway (S7 on the PLC side) | All | On the PLC side, as for PUT/GET; secure on the upper side | Low to medium |
| Open User Communication | 300, 400, 1200, 1500 | Depends on the application | Low, depends on the program |
| MQTT client inside the PLC | 1200, 1500 | TLS and broker authentication | Intermediate |
A practical order of decision: if the PLC is an S7-1500 or an S7-1200 with OPC UA support and the licence is in order, the built-in OPC UA is the first option to consider. On older-series PLCs, or in setups where many PLCs are collected at a single point, an edge gateway that speaks the S7 protocol on the PLC side is used, publishing to higher-level systems via OPC UA or MQTT. For event-based and time-sensitive data, active sending from the PLC is added as a complement.
Recommendations on PLC load and security
- Limit the number of collectors. SCADA, the historian, MES and a test tool each connecting separately to the same PLC consumes connection resources, and each puts a separate communication load on the CPU. A single gateway or OPC UA collector should get the data and distribute it to the other systems.
- Read contiguous blocks. Instead of reading scattered individual variables, read a block from the interface DB in one go.
- Choose the read interval according to need. Reading all variables every 100 ms is rarely necessary; separate trend and screen data from event data.
- Separate write access. Limit the areas external systems can write to with a separate DB; in OPC UA, grant read-only access per variable.
- Narrow network access. In industrial network infrastructure, allow only the collector server to reach the PLC’s TCP 102 and OPC UA port (default 4840); tie engineering access to a separate rule.
- Access level and password protection. The CPU’s access level and passwords must be set to prevent remote program downloads and mode changes.
For the general framework of protocol choice, the article OPC UA or MQTT is a useful complement. For choosing a method based on your existing PLC inventory and commissioning, see our PLC-to-PLC and PLC-to-server integration and OPC UA, MQTT and data integration services.
Frequently asked questions
Is enabling PUT/GET on an S7-1200 a security vulnerability?
PUT/GET access includes no authentication; any device that can reach the PLC over the network can read and write the permitted areas. Enabling it on its own is therefore risky. If it has to be enabled, access to the PLC should be restricted to the collector server only, using network segmentation and a firewall, and if there is a firewall that understands the S7 protocol, only read operations should be allowed.
Does turning off optimised DBs reduce PLC performance?
On the S7-1200 and S7-1500, optimised block access lets the processor access data more efficiently and provides certain features (for example, downloading without reinitialisation while preserving existing values when adding variables to a DB). Don’t turn off optimised access in the whole program; make only a separate interface DB exposed to external access a standard-access DB. Both performance and ease of maintenance are preserved.
Is there a way to use OPC UA with an S7-300?
S7-300 CPUs do not have a built-in OPC UA server. The practical option is to use an external OPC UA server or edge gateway that talks to the PLC using the S7 protocol. In this setup, the S7 protocol still runs on the PLC side, and OPC UA is only used between the gateway and the higher-level system.
What should the read interval from the PLC be?
It is determined by how the data will be used. For screens and trends, 1 second is usually enough; for counters and status, less frequent reading can be combined with report by exception. If fast events need to be captured, buffering the event with a timestamp inside the PLC is more reliable than reading more often.