S7 Connector: Integrating Siemens PLCs into Modern IoT Architectures

Siemens S7 MQTT IoT Sparkplug Industry 4.0 SCADA InfluxDB Grafana

Production facilities with Siemens S7 controllers generate valuable data. But how do you make this data accessible for modern monitoring systems, dashboards, and analytics? The S7 Connector bridges this gap: A middleware solution that connects S7 protocols with MQTT, SparkplugB, and the Unified Namespace (UNS).

The Integration Challenge

Siemens S7-300/400/1200/1500 controllers are widely used in industry. However, integrating these systems into modern cloud or edge computing platforms requires powerful middleware:

  • Different Worlds: Automation technology vs. IoT platforms
  • Protocol Barriers: S7 communication vs. MQTT/REST APIs
  • Vendor Lock-in: Proprietary systems vs. open standards
  • Scaling: Single installations vs. site-wide monitoring

The S7 Connector solves these challenges through a standards-based architecture.

Architecture: MQTT + SparkplugB + Unified Namespace

The S7 Connector is based on proven Industrial IoT standards:

MQTT as Communication Backbone

MQTT (Message Queuing Telemetry Transport) is a lightweight, reliable publish-subscribe protocol. It enables:

  • Efficient data transmission even with limited bandwidth
  • Bidirectional communication between PLCs and monitoring systems
  • Decoupling of data sources and data sinks

SparkplugB for Industrial Interoperability

SparkplugB is the MQTT specification for Industrial IoT and offers:

  • Standardized data models (Protobuf encoding)
  • Auto-discovery of devices and data points
  • Birth/Death certificates for connection monitoring
  • Metadata and units for each data point

Unified Namespace (UNS)

The Unified Namespace is a central information architecture that:

  • Organizes all plant data in a hierarchical topic tree
  • Enables scalability across sites and assets
  • Flexibly connects consumers (dashboards, databases, analytics)

Example topic structure:

uns/site/area/plant/parameter
uns/Bremen/Hall1/PLC1/Temperature
uns/Bremen/Hall1/PLC1/Pressure

Technologies Used

Hardware & Control:
  • Siemens S7-300/400/1200/1500 PLCs
  • Ethernet connection to PLC (PROFINET or TCP/IP)
Industrial IoT Stack:
  • MQTT Broker (Mosquitto, HiveMQ, or others)
  • SparkplugB protocol specification
  • Unified Namespace architecture
  • S7 Connector (Go-based middleware)
Data Logging & Visualization:
  • InfluxDB (time-series database)
  • Grafana (dashboard & alerting)
  • NodeRED (optional for data processing)
Integration Features:
  • Report-by-Exception (intelligent data transmission)
  • Configuration generators (TIA Portal export → YAML config)
  • Bidirectional communication (read + write)

Core Functions Overview

Intelligent Data Transmission

Report-by-Exception reduces network traffic by typically 80-95%. Data is only transmitted when values change. Additionally, a push feature for time-controlled transmission is available – ideal for time-series databases.

Easy Configuration

Integrated configuration generators automatically create a complete config.yaml from TIA Portal exports:

# CLI Generator
s7gen -in db_export.st -out config.yaml -base "uns/Site/Area/PLC1"

# Or via Web UI
s7gen-web

This significantly simplifies setup. Complex data structures and UDTs are automatically detected.

Bidirectional Communication

The S7 Connector enables not only data reading but also write operations to the PLC:

UNS-JSON Mode:

mosquitto_pub -t "uns/Site/PLC1/cmd/SpeedSetpoint" -m '{"value": 75.5}'

SparkplugB DCMD:

spBv1.0/Site/Area/DCMD/PLC1/SpeedSetpoint

This functionality is essential for SCADA systems and remote control of plants.

Flexible Data Formats

The S7 Connector supports various data formats:

  1. UNS-JSON: Traditional MQTT with JSON payloads
  2. SparkplugB: Industry standard with Protobuf encoding
  3. Raw Format: Simple values for minimal bandwidth

This enables flexibility depending on use case and infrastructure.

Practical Use Cases

The S7 Connector is suitable for diverse Industrial IoT scenarios:

SCADA Systems

  • Replacement for proprietary gateways
  • Bidirectional control via MQTT
  • Integration into modern web-based control rooms

Production Monitoring

  • Real-time monitoring of plant conditions
  • KPI dashboards with Grafana
  • Historical data analysis

Predictive Maintenance

  • Continuous data acquisition for predictive maintenance
  • Anomaly detection through ML integration
  • Early warning of deviations

MES Integration

  • Connection of Manufacturing Execution Systems
  • Production data for ERP systems
  • Traceability and quality assurance

Energy Monitoring

  • Recording energy consumption (ISO 50001)
  • Load profile analysis
  • Optimization of energy costs

Environmental and Process Monitoring

  • Water treatment plants
  • Pumping stations and wastewater treatment plants
  • Building services and HVAC systems

Advantages of This Solution

Scalable One Unified Namespace, unlimited plants – no separate integration per PLC required.

Open MQTT + SparkplugB = vendor-independent, no vendor lock-ins, standards-based.

Real-time Sub-second latency between PLC data point and dashboard.

Maintainable Standard protocols, open-source stack, no black-box systems.

Future-proof Expandable to include additional assets and data sources without architectural changes.

Efficient Report-by-Exception significantly reduces network load and infrastructure costs.

Deployment: Docker-ready and Multi-Arch

The S7 Connector is fully Docker-compatible:

# Start Docker Compose
docker-compose up -d

# Multi-arch support for ARM and x86
docker buildx build --platform linux/amd64,linux/arm64 \
  -t yourrepo/s7-connector:latest --push .

This enables flexible deployments – from edge devices (industrial PCs, Raspberry Pi) to cloud infrastructure.

Summary

The S7 Connector bridges the gap between proven Siemens automation technology and modern IoT platforms. Through support for MQTT, SparkplugB, and Unified Namespace, it seamlessly integrates into modern monitoring architectures.

Intelligent data transmission (Report-by-Exception) and easy configuration make it a robust, production-ready solution for industrial IoT scenarios.

Are you planning to integrate Siemens S7 controllers into your IoT infrastructure?

The S7 Connector helps you connect your plants quickly and reliably – standards-based and without vendor lock-in.

Previous Post Next Post