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 family | CpuType value | Default rack / slot |
|---|---|---|
| S7-1500 | S71500 | 0 / 1 |
| S7-1200 | S71200 | 0 / 1 (some CPUs use 0) |
| S7-300 | S7300 | 0 / 2 |
| S7-400 | S7400 | 0 / 2 |
| S7-200 SMART | S7200Smart | rack / slot, or a TSAP pair if needed |
| S7-200 | S7200 | TSAP pair |
| LOGO! 0BA8 | Logo0BA8 | TSAP 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
| Limit | Value |
|---|---|
| Channels (Siemens S7 driver) | 1024 |
| Devices (PLCs) per channel | 1024 |
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:
- Open the CPU properties › Protection & Security › Connection mechanisms and tick Permit access with PUT/GET communication from remote partner.
- On every data block you want to read, open Properties › Attributes and untick Optimized block access. Absolute addresses only work on non-optimized DBs.
- Compile and download to the PLC. Both settings only take effect after the download.
- 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:
Test-NetConnection 192.168.0.10 -Port 102Optimized 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
| Setting | Default | Description |
|---|---|---|
ConnectTimeoutMs | 3000 | Connection timeout in ms |
RequestTimeoutMs | 3000 | Read/write request timeout in ms |
MaxGapBytes | 32 | Tags separated by up to this many unused bytes are still read in one block |
DemoteAfterFailures | 3 | After this many failures in a row the device is treated as offline |
DemoteForMs | 10000 | How long an offline device is skipped before the next try |
InterRequestDelayMs | 0 | Extra pause between requests |
Device settings
| Setting | Default | Description |
|---|---|---|
Host | required | PLC IP address or host name |
Port | 102 | ISO-on-TCP port |
CpuType | S71500 | S7200, S7200Smart, Logo0BA8, S7300, S7400, S71200, S71500 |
Rack | 0 | Rack number |
Slot | automatic | 2 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
| Setting | Description |
|---|---|
Name | Tag name; a . creates a sub-level in the topic |
Address | Absolute address, see below |
DataType | See data types below |
Length | Characters for String (default 254) |
Unit, Scale, Offset, Deadband | Unit, value = raw × Scale + Offset, minimum change before publishing |
Writable | true allows writing the tag |
Settings.StringType | S7String (default, 2-byte header), WString (4-byte header, UTF-16BE) or Char (fixed-length characters) |
Settings.DateTimeType | DT (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.
| Area | Bit | Byte | Word (2) | DWord (4) | 8 bytes |
|---|---|---|---|---|---|
| Data block | DB1.DBX0.3 | DB1.DBB2 | DB1.DBW4 | DB1.DBD6 | DB1.DBL8 |
| Marker (M) | M10.0 | MB10 | MW20 | MD30 | ML40 |
| Input (I/E) | I0.1, E0.1 | IB0 | IW2 | ID4 | IL8 |
| Output (Q/A) | Q0.0, A0.0 | QB0 | QW2 | QD4 | QL8 |
| Timer | T5 | ||||
| Counter | C3, 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 exampleDB1.DBB0withInt64reads 8 bytes. - Timers return seconds as
Float64, counters returnUInt16. Both are read-only.
Data types
DataType | S7 type | Size (bytes) |
|---|---|---|
Boolean | BOOL (on a bit address) | 1 bit |
Int8 / UInt8 | SINT / USINT, BYTE | 1 |
Int16 / UInt16 | INT / UINT, WORD | 2 |
Int32 / UInt32 | DINT / UDINT, DWORD | 4 |
Int64 / UInt64 | LINT / ULINT, LWORD | 8 |
Float32 | REAL | 4 |
Float64 | LREAL | 8 |
Bcd16 / Bcd32 | BCD word / dword | 2 / 4 |
String | STRING / WSTRING / CHAR array | Length + header |
DateTime | DATE_AND_TIME or DTL | 8 / 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.
| Name | Address | DataType | Unit | Notes |
|---|---|---|---|---|
Running | DB10.DBX0.0 | Boolean | ||
Speed | DB10.DBD2 | Float32 | rpm | Deadband 0.5 |
PartCount | DB10.DBD6 | UInt32 | ||
Recipe | DB10.DBB22 | String | Length 20 | |
TargetSpeed | DB10.DBD56 | Float32 | rpm | Writable |
AlarmBit | M20.3 | Boolean |
The channel in the editor looks like this:
{
"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:
connectmq/site1/production/line1/press/Press1/Speedwith this payload:
{
"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 exampleconnectmq/site1/production/line1/press/Press1/TargetSpeed/setwith the payload{"value": 1500}or just1500. - 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
| Symptom | Cause and fix |
|---|---|
| Timeout, device stays offline | The PC cannot reach the PLC on port 102. Check IP, routing and firewalls with Test-NetConnection. |
| Connection refused or rejected right after connecting | Wrong 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/1500 | PUT/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 fine | The 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_error | The address cannot be parsed (for example bit number above 7). Fix the address; the other tags keep running. |
Tags bad_comm_failure | The device was demoted after DemoteAfterFailures failed requests. It is retried after DemoteForMs. |
| REAL value looks like a huge integer | DataType is missing, so DBD is read as UInt32. Set "DataType": "Float32". |
| Several PLCs update slowly | One 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.
Related pages
- ConnectMQ Edge overview and installation
- Topics and payloads
- Offline buffer
- Local OPC UA server and MQTT broker
- Simulator for tests without hardware
- Digital twin and alerts
- Plans & broker limits and pricing