Connecting a SINUMERIK CNC Control
How to read machine state, spindle, and tool data from a Siemens SINUMERIK CNC control with the SINUMERIK connector and map it into an ISA-95 style MQTT topic hierarchy.
This guide shows you how to read machine, spindle, and tool data from a Siemens SINUMERIK CNC control with the Connectware SINUMERIK connector and map it into an ISA-95 style MQTT topic hierarchy. The connector supports SINUMERIK 840D sl and 828D CNC systems and acts as a client for the SINUMERIK "Access MyMachine / OPC UA" machine interface. The data collected here (program name and status, spindle speed and feed, and the tools loaded in the magazines) is the typical input for machine monitoring, OEE dashboards, and tool management applications. In more detail, the following topics are covered:
Understanding how the SINUMERIK connector addresses data through driver methods
Preparing the OPC UA interface on the SINUMERIK
Choosing the driver methods and polling intervals
Creating the service commissioning file
Mapping the data into an ISA-95 style MQTT topic hierarchy
Reading tool details on demand with the request/response pattern
Verifying data in the Data Explorer
This guide focuses on reading data from the machine. For the complete method catalog, including tool creation, magazine management, and file system access, see the SINUMERIK connector reference.
A complete example file is available at the end of this guide.
Prerequisites
To follow this guide, you will need the following:
A running instance of Cybus Connectware.
A Siemens SINUMERIK 840D sl or 828D CNC system that is reachable over Ethernet from Connectware. The machine requires SINUMERIK Operate, a SINUMERIK OPC UA license, and a compatible OPC UA server version. For the machine-side prerequisites, compatibility, and setup, see the SINUMERIK Access MyMachine / OPC UA Configuration Manual.
The username and password of an OPC UA user configured on the SINUMERIK.
Access to the Admin UI with sufficient user permissions.
Basic knowledge of MQTT and the Connectware services concept (for example, service commissioning files, connections, and endpoints).
How the SINUMERIK Connector Addresses Data
Connectors such as Modbus/TCP or S7 address individual registers or variables. The SINUMERIK connector works differently: it provides a set of driver methods, and each method is a remote procedure call that bundles related NC data into one structured result. For example, getMachineState returns the active program name, the program status, and the machine runtime in a single object, and getTool returns the complete essential configuration of one tool. You do not assemble NC variable addresses yourself; the driver maps each method to the underlying SINUMERIK data internally.
An endpoint combines one method with one mode of operation:
Polling subscription (
subscribewith typepoll): Connectware calls the method in a fixed interval and publishes the result. This is the right mode for continuous monitoring and is the main pattern in this guide.Read and write (
readorwrite): Connectware exposes a request/response pattern over MQTT, following the JSON-RPC 2.0 specification. This is the right mode for methods that take parameters, such as reading one specific tool.Notify subscription (
subscribewith typenotify): the driver fires an event when something changes on the machine, for exampleonNcProgramChanged.
The notify subscription is highly unstable and can crash the OPC UA server on the machine. Use polling subscriptions instead, as this guide does. For details, see Notify Subscription.
Each driver method requires certain access rights on the SINUMERIK. The driver automatically sets the required OPC UA access rights for the connected OPC UA user, so the user must be allowed to change its own access rights. You can inspect the current rights with the getMyAccessRights method.
Choosing the Driver Methods
This guide polls a set of methods that cover the most common machine monitoring needs. The polling interval is a trade-off between data freshness and load on the machine's OPC UA server: fast-changing process values get short intervals, while static information and slowly changing lists get long ones.
getMachineInfo
Static machine information such as the NC type and version
60000 ms
getMachineState
Program name, program status, power-on state, and runtime
5000 ms
getSpindleSpeed
Actual and commanded spindle speed
2000 ms
getSpindleFeed
Actual and commanded constant cutting rate
2000 ms
getToolsInMagazines
Tool numbers in all magazine places of all magazines
10000 ms
The minimum polling interval is 1000 ms. For all endpoint properties, see Sinumerik Endpoint Properties.
Writing the Service Commissioning File
The service commissioning file contains all connection and mapping details. Do not worry about copying the snippets together into one file, the complete example file is available at the end of this guide.
Description and Metadata
These sections contain general information about the service commissioning file. Only the metadata name is required.
Parameters and Definitions
We define the network address and the credentials of the machine as parameters, so you can set them when you install the service. The default OPC UA port is 4840.
The MQTT topics in this guide follow an ISA-95 style equipment hierarchy (<enterprise>/<site>/<area>/<line>/<work-cell>). We define the prefix once in the definitions section and reuse it in every mapping with !sub.
Cybus::Connection
The connection resource establishes the connection to the "Access MyMachine / OPC UA" interface of the machine. The SINUMERIK driver uses the Connectware OPC UA driver implementation, so the OPC UA connection settings, including security options and the connectionStrategy retry behavior, apply here as well. For all connection properties, see Sinumerik Connection Properties.
Cybus::Endpoint
Each endpoint polls one driver method. The method property selects the driver method, and pollInterval sets the polling frequency in milliseconds according to the table in Choosing the Driver Methods.
Cybus::Mapping
The mapping publishes each endpoint on a topic of the ISA-95 hierarchy.
With this mapping, the machine state is published on the topic enterprise/hamburg/machining/line-1/cnc-01/machine/state, and every other method result follows the same pattern.
Reading Tool Details on Demand
Methods that take parameters, such as getTool with a tool number, fit the request/response pattern better than polling. An endpoint with the read operation subscribes to a request topic ending in req and publishes the result on the corresponding response topic ending in res:
To read tool number 1, publish the following payload on the request topic. The id is a user-defined correlation ID that identifies the response, and params holds the method parameters in order:
The response on the res topic contains the essential tool configuration under the result key, including the tool identifier, tool type, lengths, radius, and the magazine and place where the tool is loaded. If the call fails, the response carries an error key instead. For a complete request/response walkthrough with example payloads, see the Examples section of the connector reference.
Installing the Service Commissioning File
Install the service commissioning file. See Installing Services.
Enable the service. See Enabling Services.
Result: The service is enabled. Connectware connects to the OPC UA interface of the SINUMERIK and starts polling the configured methods.
Verifying the Data
Open the Data Explorer and subscribe to enterprise/hamburg/machining/line-1/cnc-01/#. Each topic carries a JSON object with the keys timestamp and value, where the value holds the return object of the driver method. For example, the spindle speed:
A few plausibility checks for the first readings:
The
progNameon themachine/statetopic matches the NC program selected on the SINUMERIK Operate HMI.The
actualSpeedon thespindle/speedtopic is 0 while the spindle is stopped and follows the commanded value while machining.The
poweronTimeon themachine/statetopic (machine runtime in minutes) only increases over time.The tool numbers on the
tools/magazinestopic match the tool list on the HMI, with 0 for empty magazine places.
If the connection does not reach the Connected state, verify that the OPC UA server on the SINUMERIK is running and licensed, that the port is reachable from Connectware, and that the username and password match the OPC UA user on the machine. If the connection is established but method calls fail, check that the OPC UA user is allowed to change its own access rights, because the driver sets the required access rights for each method automatically. The getMyAccessRights method shows the rights currently granted to the user.
Service Commissioning File Example
Disclaimer: SINUMERIK and SINUMERIK Operate are trademarks of Siemens AG.
Last updated
Was this helpful?

