Skip to content

Siemens S7 connector Basic & Scale ​

The Siemens S7 connector of ConnectMQ Edge reads S7 PLCs directly over ISO-on-TCP (port 102), without an extra OPC server or custom code. Every tag is published to your ConnectMQ broker as an ISA-95 topic with value, quality, unit and timestamp.

Supported PLCs ​

CPU familyCpuType valueDefault rack / slot
S7-1500S715000 / 1
S7-1200S712000 / 1 (some CPUs use 0)
S7-300S73000 / 2
S7-400S74000 / 2
S7-200 SMARTS7200Smartrack / slot, or a TSAP pair if needed
S7-200S7200TSAP pair
LOGO! 0BA8Logo0BA8TSAP pair

The connector reads data blocks (DB), markers (M), inputs (I/E), outputs (Q/A), timers and counters. Many tags are packed into a few multi-variable requests, sized to the PDU the PLC negotiates.

Limits ​

LimitValue
Channels (Siemens S7 driver)1024
Devices (PLCs) per channel1024

Each device is its own PLC connection with its own IP address, rack and slot. All traffic in one channel runs one request after another, so put PLCs you want to read in parallel into separate channels. Limits are per driver, not per project. How many tag values you can send to the cloud depends on your plan: see Plans & broker limits and pricing.

Prepare the PLC ​

For S7-1200 and S7-1500 CPUs, in TIA Portal:

  1. Open the CPU properties › Protection & Security › Connection mechanisms and tick Permit access with PUT/GET communication from remote partner.
  2. On every data block you want to read, open Properties › Attributes and untick Optimized block access. Absolute addresses only work on non-optimized DBs.
  3. Compile and download to the PLC. Both settings only take effect after the download.
  4. Note the absolute offsets of the variables (shown in the DB once optimized access is off) and the PLC IP address.

Check that the Edge PC reaches the PLC on TCP port 102, for example in PowerShell:

powershell
Test-NetConnection 192.168.0.10 -Port 102

Optimized data blocks

Optimized (symbolic) data blocks cannot be read over S7. On an S7-1500, read them through the PLC's built-in OPC UA server with the OPC UA Client connector, or turn off optimized access and use absolute addresses.

Add the connector in ConnectMQ Edge ​

Add a channel from the template ​

In the ConnectMQ Edge desktop app open Connectors in the left menu, click + Add channel and pick the Siemens S7 template. The channel is added with sample addresses.

Enter the PLC connection ​

In the channel editor on the right, set the PLC IP address (Host), CpuType, Rack and Slot. For LOGO! and S7-200 enter LocalTsap and RemoteTsap (for example 0100 / 0102) instead of rack and slot. Add one device per PLC.

Add your tags ​

Replace the sample tags with your own: a name, an absolute address such as DB10.DBD2, the DataType, and optionally Unit, Scale and Deadband. Mark tags you want to write as Writable.

Validate and save ​

Click Validate project to check the configuration, then press Save and apply. The channel starts right away; the service is not restarted. You can add as many channels as you need, including several Siemens S7 channels.

Check the values ​

On Overview the PLC shows Reading data under Field devices; problems such as a wrong address or a timeout appear in the Last problem column. Live values are on Local OPC UA Server › Live tag values, details in Windows Service Settings › Logs.

Use the data in ConnectMQ ​

Open the ConnectMQ console: the tags appear in the topic tree, ready for dashboards, alerts and the digital twin.

Settings reference ​

The channel editor uses these setting names.

Channel settings ​

SettingDefaultDescription
ConnectTimeoutMs3000Connection timeout in ms
RequestTimeoutMs3000Read/write request timeout in ms
MaxGapBytes32Tags separated by up to this many unused bytes are still read in one block
DemoteAfterFailures3After this many failures in a row the device is treated as offline
DemoteForMs10000How long an offline device is skipped before the next try
InterRequestDelayMs0Extra pause between requests

Device settings ​

SettingDefaultDescription
HostrequiredPLC IP address or host name
Port102ISO-on-TCP port
CpuTypeS71500S7200, S7200Smart, Logo0BA8, S7300, S7400, S71200, S71500
Rack0Rack number
Slotautomatic2 for S7-300/400, 1 for S7-1200/1500 (0 is also common on 1200/1500)
LocalTsap / RemoteTsap—Hex TSAP pair for LOGO!, S7-200 or special access, for example 0100 / 0102. When both are set they replace rack and slot

The device also has ScanRateMs (how often it is read) and an Isa95 block (Area, Line, Cell) that places it in the topic tree.

Tag settings ​

SettingDescription
NameTag name; a . creates a sub-level in the topic
AddressAbsolute address, see below
DataTypeSee data types below
LengthCharacters for String (default 254)
Unit, Scale, Offset, DeadbandUnit, value = raw × Scale + Offset, minimum change before publishing
Writabletrue allows writing the tag
Settings.StringTypeS7String (default, 2-byte header), WString (4-byte header, UTF-16BE) or Char (fixed-length characters)
Settings.DateTimeTypeDT (default, DATE_AND_TIME, 8 bytes) or DTL (12 bytes)

Address syntax ​

Addresses are not case-sensitive. German mnemonics (E = input, A = output, Z = counter) are accepted too.

AreaBitByteWord (2)DWord (4)8 bytes
Data blockDB1.DBX0.3DB1.DBB2DB1.DBW4DB1.DBD6DB1.DBL8
Marker (M)M10.0MB10MW20MD30ML40
Input (I/E)I0.1, E0.1IB0IW2ID4IL8
Output (Q/A)Q0.0, A0.0QB0QW2QD4QL8
TimerT5
CounterC3, Z3
  • Bit numbers are 0–7.
  • When you set a DataType, the data type decides how many bytes are read; the prefix only gives the start address. For example DB1.DBB0 with Int64 reads 8 bytes.
  • Timers return seconds as Float64, counters return UInt16. Both are read-only.

Data types ​

DataTypeS7 typeSize (bytes)
BooleanBOOL (on a bit address)1 bit
Int8 / UInt8SINT / USINT, BYTE1
Int16 / UInt16INT / UINT, WORD2
Int32 / UInt32DINT / UDINT, DWORD4
Int64 / UInt64LINT / ULINT, LWORD8
Float32REAL4
Float64LREAL8
Bcd16 / Bcd32BCD word / dword2 / 4
StringSTRING / WSTRING / CHAR arrayLength + header
DateTimeDATE_AND_TIME or DTL8 / 12

With Auto the type follows the prefix: X → Boolean, B → UInt8, W → UInt16, D → UInt32, L → Float64. Set DataType explicitly for REAL values (DB10.DBD2 + Float32) and signed integers.

Example ​

A press line with one S7-1500 PLC. The project's ISA-95 levels are connectmq / site1 / production, and the device sets Line: line1 and Cell: press.

NameAddressDataTypeUnitNotes
RunningDB10.DBX0.0Boolean
SpeedDB10.DBD2Float32rpmDeadband 0.5
PartCountDB10.DBD6UInt32
RecipeDB10.DBB22StringLength 20
TargetSpeedDB10.DBD56Float32rpmWritable
AlarmBitM20.3Boolean

The channel in the editor looks like this:

json
{
  "Name": "PressLine",
  "Driver": "SiemensS7",
  "Settings": { "RequestTimeoutMs": 2000, "MaxGapBytes": 32 },
  "Devices": [
    {
      "Name": "Press1",
      "ScanRateMs": 500,
      "Isa95": { "Line": "line1", "Cell": "press" },
      "Settings": { "Host": "192.168.0.10", "CpuType": "S71500", "Rack": 0, "Slot": 1 },
      "Tags": [
        { "Name": "Running", "Address": "DB10.DBX0.0", "DataType": "Boolean" },
        { "Name": "Speed", "Address": "DB10.DBD2", "DataType": "Float32", "Unit": "rpm", "Deadband": 0.5 },
        { "Name": "PartCount", "Address": "DB10.DBD6", "DataType": "UInt32" },
        { "Name": "Recipe", "Address": "DB10.DBB22", "DataType": "String", "Length": 20 },
        { "Name": "TargetSpeed", "Address": "DB10.DBD56", "DataType": "Float32", "Unit": "rpm", "Writable": true },
        { "Name": "AlarmBit", "Address": "M20.3" }
      ]
    }
  ]
}

The Speed tag arrives in ConnectMQ on the topic:

text
connectmq/site1/production/line1/press/Press1/Speed

with this payload:

json
{
  "timestamp": "2026-10-21T14:29:00.123Z",
  "value": 1493.2,
  "quality": "good",
  "unit": "rpm",
  "dataType": "Float32",
  "tag": "Speed",
  "device": "Press1",
  "channel": "PressLine"
}

See Topics and payloads for the topic rules, quality values and the $status topic of each device.

Write values to the PLC ​

Tags with "Writable": true can be written:

  • From the cloud: turn on Allow writes from the cloud in Cloud Settings, then publish to the tag topic plus /set, for example connectmq/site1/production/line1/press/Press1/TargetSpeed/set with the payload {"value": 1500} or just 1500.
  • Locally: write the tag from an OPC UA client connected to the Edge local OPC UA server.

Bit addresses are written as a single bit; other types are encoded and written as bytes. Timers and counters cannot be written. Scale and Offset are reversed before the value is written.

Troubleshooting ​

SymptomCause and fix
Timeout, device stays offlineThe PC cannot reach the PLC on port 102. Check IP, routing and firewalls with Test-NetConnection.
Connection refused or rejected right after connectingWrong rack/slot or CpuType. Use slot 1 for S7-1200/1500 (try 0), slot 2 for S7-300/400. LOGO! and S7-200 need LocalTsap / RemoteTsap.
Tags bad on an S7-1200/1500PUT/GET is not allowed or the DB still uses optimized block access. Change both in TIA Portal and download to the PLC.
Some tags bad, others fineThe PLC returned an address error (for example the DB does not exist or is too short). Only the tags in that block are affected; the connection stays up.
Tag quality bad_config_errorThe address cannot be parsed (for example bit number above 7). Fix the address; the other tags keep running.
Tags bad_comm_failureThe device was demoted after DemoteAfterFailures failed requests. It is retried after DemoteForMs.
REAL value looks like a huge integerDataType is missing, so DBD is read as UInt32. Set "DataType": "Float32".
Several PLCs update slowlyOne channel reads its PLCs one after another. Put PLCs into separate channels.

Known limitations ​

  • No symbolic (optimized DB) access; use the OPC UA Client connector for optimized S7-1500 data.
  • Peripheral areas (PI/PQ) and arrays in a single tag are not supported. Define array elements as separate tags; neighbouring tags are read in one block anyway.
  • Timers and counters are read one by one, not packed.

Fully managed MQTT broker for connected devices.