You have picked the protocol. Maybe it is OPC UA on an 840D sl, S7comm on a batch of 828D VMCs, or a mix with an S7-1200 special-purpose machine. Now you need numbers on a screen that the production manager trusts.
This guide walks through the sequence we follow on real Siemens installations, from the site survey to a working dashboard. If you have not yet decided between OPC UA, S7comm and Modbus TCP, start with Siemens SINUMERIK and S7 PLC data sources and protocols.
What you will end up with
At the end of this process, each machine publishes these values to an MQTT broker:
- Status: running, idle, stopped, alarm, with a timestamp for every change
- Spindle: running flag, speed and load (where the source allows it)
- Alarms: active alarm numbers and text, raised and cleared times
- Part count: total and per shift
- Cycle time: measured for each cycle, compared with the standard
- OEE inputs: planned time, run time, ideal cycle time, total and rejected parts
A dashboard turns those into live machine tiles, downtime Pareto charts and shift OEE.
Architecture in words
Picture four boxes from left to right:
- Siemens controllers (SINUMERIK 828D/840D sl, S7-1200/1500) on an isolated machine network, for example 192.168.10.0/24.
- An edge gateway with two network ports. One port sits on the machine network and polls the controllers. The other port sits on the plant LAN.
- An MQTT broker on the plant LAN, either on the gateway, on a local server or in the cloud over TLS (Transport Layer Security).
- The monitoring platform, which subscribes to the broker, stores history and serves the dashboard to browsers and phones.
Data flows in one direction: controller to gateway to broker to dashboard. Nothing on the plant LAN can reach the controllers directly.
Step 1: Survey every machine
Collect this for each machine before you touch any cable:
| Item | Where to find it | Why it matters |
|---|---|---|
| Control model and software version | CNC diagnostics / version screen | Decides OPC UA availability |
| OPC UA license present? | CNC license screen | Avoids a quote you cannot deliver |
| Free Ethernet port | Back of PPU / NCU, or PLC front | Physical connection |
| Current IP address and subnet | CNC network settings | Avoids conflicts |
| PLC documentation / interface list | Machine builder | Tells you which DB bits mean what |
| Who owns the PLC program | Machine builder or in-house | PUT/GET or Modbus changes need them |
On the 828D, use the factory network port (X130) for monitoring. Leave the machine-internal port alone. On the 840D sl, the company network port location depends on the NCU and PCU setup.
Step 2: Plan IP addresses and the network
Give every controller a unique static IP address on the machine network. Write the addresses in a simple sheet: machine name, controller, IP, protocol, port.
Then test reachability from a laptop on the same subnet before you install the gateway:
ping 192.168.10.21
nmap -p 102,4840 192.168.10.21
Port 102 open means S7comm is reachable. Port 4840 open means an OPC UA server is listening. If 4840 is closed on a machine you expected to have OPC UA, check the license and whether the server is enabled.
Step 3: Prepare the controller
What you do here depends on the protocol.
OPC UA on SINUMERIK: enable the OPC UA server in the CNC commissioning settings. Create a dedicated read-only user for the gateway. Choose a security policy. Use signed and encrypted connections unless the gateway cannot support them. Trust the gateway’s client certificate on the CNC. The exact menu path differs between 828D and 840D sl versions.
S7comm on SINUMERIK: usually nothing to change. The integrated PLC answers on port 102. You only need the interface DB addresses for the signals you want.
S7comm on S7-1200/1500: in TIA Portal, enable “Permit access with PUT/GET communication” in the CPU protection settings. Set the data blocks you will read to standard (non-optimized) access. Download to the PLC. Get the machine builder’s approval first. This is a change to their program.
Modbus TCP on S7-1200/1500: a PLC programmer adds the Modbus TCP server instruction and copies the wanted tags into a holding-register block. Ask for a written register map.
Step 4: Build the tag list
Start small. Ten good tags beat a hundred unverified ones. A typical first list for an 828D VMC:
| Tag | Type | Poll rate | Notes |
|---|---|---|---|
| Program running | Bool | 125 ms | Main status input |
| Cycle start | Bool | 125 ms | Cycle-time start edge |
| Program end / reset | Bool | 125 ms | Cycle-time end edge |
| Spindle running | Bool | 250 ms | Utilisation |
| Emergency stop | Bool | 250 ms | Stopped state |
| Alarm active | Bool | 250 ms | Alarm state |
| Feed override % | Int | 1 s | Process discipline |
| Spindle load % | Real | 1 s | OPC UA, or external sensor |
| Part counter | DInt | 1 s | NCK counter or R-parameter |
On our installations we poll status bits at 125 ms. Faster than that adds network load without better data. Analog values at 1 s are plenty for dashboards and trend alarms.
Step 5: Configure the edge gateway
Point the gateway at each controller with the protocol, IP, port and tag list. Then add the logic that turns raw bits into events:
- Status logic: alarm wins over everything. Then running, then idle (powered, no program running), then stopped.
- Cycle time: start a timer on the cycle-start edge and stop it on the program-end edge. Discard cycles shorter than a sensible minimum, such as single-block test runs.
- Part count: count the part-counter increments, not the program-end edges, wherever a counter exists.
- Store and forward: buffer messages locally when the broker is unreachable. Replay them in order when the link returns. Without this, a network outage shows as fake downtime.
Step 6: Publish to MQTT
Use a clear, stable topic structure. We use site, area, machine and data type:
plant1/machining/vmc-07/status
plant1/machining/vmc-07/cycle
plant1/machining/vmc-07/alarm
Send compact JSON payloads with a timestamp from the gateway clock (synced by NTP, the Network Time Protocol):
{
"ts": "2026-11-26T10:42:17.125+05:30",
"state": "RUNNING",
"spindle_rpm": 8000,
"spindle_load": 42.5,
"part_count": 1184
}
Publish status changes immediately, with the retained flag set so a new dashboard sees the current state straight away. Publish analog values at a fixed interval. Use QoS (quality of service) 1 for cycles and alarms, so no event is lost.
Step 7: Build the dashboard and OEE
Connect the monitoring platform to the broker and map each topic to a machine. Then:
- Set the shift calendar and planned breaks, so availability is calculated against planned time, not 24 hours.
- Enter the ideal cycle time per part program. Performance is meaningless without it.
- Add a simple way for operators to give a reason for each stop longer than a few minutes and to log rejected parts.
- Run one week in parallel with the manual log. Compare the two, and fix the mapping before anyone uses the numbers for decisions.
Our virtual machine monitoring overview shows what a finished dashboard typically looks like.
Troubleshooting
- S7 connection opens, reads fail (S7-1200/1500). PUT/GET is off or the DB is optimized.
- OPC UA connect refused. Port 4840 is closed, the server is disabled, or the gateway certificate is not trusted on the CNC.
- Status flickers between running and idle. You are using a signal that drops between blocks, such as spindle running. Use the channel program-running signal instead.
- Part count runs double. The program-end signal fires twice, or a subprogram ends with M30. Switch to the part counter.
- Timestamps jump. The gateway clock is not synced. Configure NTP.
- Random dropouts on one machine. Check the cabinet cable and switch. Electrical noise near drives kills unshielded patch cables.
Conclusion
Siemens data acquisition follows a clear order: survey, plan the network, prepare the controller, keep the tag list short, put logic in the edge gateway, publish clean MQTT, and validate against the manual log. Follow that order and you get numbers people trust within the first week.
If you run other brands too, the same pattern applies to Haas machine monitoring, FANUC FOCAS to MQTT, Mitsubishi CNC and PLC setup and Delta Modbus gateways. Our overview of top CNC controller brands helps if you are still mapping your floor.
Want a second pair of eyes on your Siemens machines? Book a free assessment. We will check your controllers and network, and show you what a gateway-based setup would collect on day one.