How an IoT Gateway Connects to Siemens S7-1200/1500 PLCs
|
|
Time to read 6 min
|
|
Time to read 6 min
Connecting a modern Siemens S7-1200 or S7-1500 PLC to the cloud seems complex, but it boils down to two key steps: 1) Correctly configuring the PLC in TIA Portal, and 2) Using a capable IoT Gateway to read the data. This guide provides a practical walkthrough for enabling PUT/GET access and disabling "optimized blocks" in your PLC, then shows how an industrial IoT gateway like a Robustel EG5120 easily reads Data Blocks (DBs) for secure PLC data collection and translation to MQTT.
Two-Step Process: Success requires configuring both the PLC and the IoT Gateway.
TIA Portal "Gotchas": The two most critical settings in your Siemens PLC are disabling "Optimized block access" for the Data Blocks (DBs) you want to read, and enabling "PUT/GET communication" in the PLC's security properties.
IoT Gateway Role: The IoT Gateway acts as the S7 client. It securely polls the PLC's DBs, then translates the raw data into standardized JSON/MQTT for your cloud platform.
Beyond Data: A cellular IoT Gateway also provides secure PLC remote access (via RCMS/VPN), allowing engineers to troubleshoot or program the S7-1200 remotely with TIA Portal.
Siemens S7-1200 and S7-1500 PLCs are the powerful, modern heart of countless automation systems. But for many engineers, they can feel like a "walled garden." The S7 protocol isn't as open as Modbus, and getting data out of them and up to the cloud seems intimidating.
I've seen teams struggle with this, trying complex custom code or expensive SCADA licenses. The truth is, it's remarkably simple if you use the right tool. That tool is a modern industrial IoT gateway.
An IoT Gateway is designed for this exact task. It acts as the secure, intelligent "translator" that speaks the PLC's S7 communication language on one side, and the cloud's MQTT/HTTP language on the other. This guide isn't theoretical; it's the practical, step-by-step process our engineers use every day.
Unlike Modbus, where you just poll a standard register address, Siemens PLCs (especially the S7-1200/1500) use a more complex, optimized, and secure system. You can't just "ping" a memory address and get a value. You must:
This is where a dedicated IoT Gateway with a native S7 driver becomes essential. It handles all this complexity for you.
This is the most critical step, and it's the one everyone gets wrong. Before your IoT Gateway can read anything, you must configure the Siemens S7-1200 or S7-1500 in TIA Portal.
You only need to do two things:
Modern S7 PLCs use "optimized" data blocks by default. This is great for the PLC's internal speed, but it's terrible for PLC data collection because it means the data isn't stored in a simple, fixed memory address. Your IoT Gateway won't know where to find it.
You must turn this off for the DBs you want to read.
DB10,W2 or DB10,D4) that the IoT Gateway can poll.By default, the S7-1200/1500 blocks all external communication as a security feature. You must manually permit your IoT Gateway to connect.
That's it. Download the hardware configuration to your PLC. You've now unlocked the door and organized the data so your IoT Gateway can easily read it.

Now that the PLC is ready, setting up the IoT Gateway is incredibly fast. We'll use a Robustel IoT Gateway (like the EG5120) with our Edge2Cloud Pro software as the example, but the principles apply to any high-quality industrial IoT gateway.
This IoT Gateway acts as the S7 Client, initiating the connection.
My-S7-1500
Siemens S7 (S7-1200/1500)
192.168.1.10)Motor_Speed
DB10,REAL4 (Read a 32-bit REAL value starting at byte 4 in Data Block 10)Cycle_Count
DB10,INT2 (Read a 16-bit Integer starting at byte 2 in Data Block 10)Machine_Status
DB10,X0.1 (Read the 2nd Bit [X0.1] of the first byte in Data Block 10)Modbus to MQTT... oops, I mean S7 to MQTT).MQTT
factory/line1/s7
Your IoT Gateway is now actively polling the Siemens S7-1500, reading those specific data points, and publishing them as clean JSON data to your cloud platform. This entire IoT Gateway configuration takes about 5 minutes.

This IoT Gateway solution does more than just data collection. It unlocks two critical business values:
PLC Remote Access) This is the killer app. A cellular IoT Gateway with a platform like Add One Product: RCMS creates a secure VPN tunnel. This means your engineers can open TIA Portal on their laptop from anywhere in the world, connect to the IoT Gateway, and securely access the PLC to troubleshoot, patch, or update its logic—as if they were plugged in on the factory floor. This eliminates 90% of your service travel, saving you a fortune.IoT Gateway as Firewall)NEVER connect a PLC directly to the internet. It's a massive security risk. The industrial IoT gateway acts as a robust firewall. It isolates your entire machine network (OT) from the enterprise network (IT). It only allows the data you defined (outbound MQTT) to leave. It blocks all other traffic, protecting your S7-1200 from viruses, ransomware, and unauthorized access.Stop seeing your Siemens S7-1200 or S7-1500 as a locked box. It's a goldmine of data. And the IoT Gateway is the secure, intelligent key that unlocks it.
The IoT Gateway vs PLC debate isn't a conflict; it's a partnership. The PLC runs the machine with perfect reliability. The IoT Gateway extracts its data, protects it, and sends it to the cloud. By making two simple changes in TIA Portal and using a modern industrial IoT gateway, you can bridge the OT/IT divide in minutes, enabling everything from PLC data collection to full remote maintenance.

A1: Yes, a professional IoT Gateway can connect to those as well, but the process is slightly different. Those PLCs use the older "S7-300/400" protocol (often over MPI or Profibus, requiring an adapter, or via Ethernet). A high-end industrial IoT gateway will have separate drivers specifically for these models. The S7-1200/1500 is just the most common modern use case.
A2: No. PLC data collection is a very low-priority task for the PLC's powerful processor. The PLC will always prioritize its real-time control loop over responding to a data request from an IoT Gateway. Polling data (e.g., once per second) is a standard, non-intrusive operation that will have no measurable impact on your machine's performance.
A3: Yes. A true IoT Gateway supports two-way communication. You can send a secure MQTT command (e.g., a new recipe or setpoint) to the IoT Gateway. The gateway can then securely write that value to a specific, pre-approved Data Block (DB) in the PLC. This must be designed very carefully, but it's a core capability for remote control and recipe management.