Connect Heidenhain CNC with OPC UA support
In this tutorial you will learn how to integrate a Heidenhain controlled CNC machine and use it in your App.
This tutorial explains how to connect a Heidenhain controlled CNC machine to your App using OPC UA.
This guide uses a modern TNC7-based machine as an example, but the steps apply to any Heidenhain controller that supports OPC UA connectivity.
Connectivity guide
Allow SSH access via password
Temporarily enable password-based SSH access on your CNC machine.
Open the settings (Einstellungen) menu on the controller.

Under the operating system (Betriebssystem) section, select Current User and click Open (Öffnen).

In the dialog box, select Certificates and keys (Zertifikate und Schlüssel).

Check the box to allow password authentication (Erlaube Authentifizierung mit Passwort).

Click Save and restart server (Speichern & Server neu starten) to restart the internal SSH server.

Download and start a Native Agent
Open the App Builder on a computer that has network access to your CNC machine.
Click the create Agent icon in the Function Explorer panel (see Agents).

Check the checkboxes for both the OPC UA Client and the Heidenhain OPC UA connectors.
Enter a prefix that identifies your workspace and click Submit.

The system compiles a custom Native Agent executable to embed the specific security credentials of your workspace. This process takes up to 2 minutes.
Wait for the download dialog to open automatically in your browser.
Re-downloading Agents
You can access and download your compiled Native Agent executables at any time from the native-agents directory inside the File Explorer.

Create a new directory on your local computer (such as
C:\Heisenware) and move the downloaded Native Agent binary into it.

Run the Native Agent executable. If prompted by Windows SmartScreen, click More info (Weitere Informationen) and select Run anyway (Trotzdem ausführen).

Once the terminal window opens and displays a broker connection status of
[OK], verify that your new Agent appears online in the Function Explorer panel of the App Builder.
Set up certificates for the OPC UA connection
To establish a secure connection to the Heidenhain OPC UA server, you must exchange certificates between the CNC machine and your host computer.
Our Native Agent automates this file exchange. You only need to perform these configuration steps once per machine.

Drag the
createfunction from the Heidenhain OPC UA connector onto the Backend Builder canvas.Define an instance name (such as
tnc7) and enter your machine's IP address in themachineIpAddressinput field. Trigger the function manually.

Drag both the
prepareOpcUaAssistantandfinalizeOpcUaAssistantfunctions onto the canvas.Trigger the
prepareOpcUaAssistantfunction. Once it returns successfully, return to your CNC machine.

Run the OPC UA Assistant on the machine
Open the OPC UA Assistant interface on your CNC machine.
On a TNC7 controller, navigate to Settings (Einstellungen) > Network/Remote Access (Netzwerk/Fernzugriff) > OPC UA > OPC UA Connection Assistant (OPC UA Verbindungsassistent). On a TNC640 controller, open this menu via the Heros interface.

Follow the assistant's prompts step by step.

When the assistant prompts you to export server certificates, select the
TNC:drive, open theheisenwaredirectory, and navigate into theexportfolder.

Click Export all certificates (Alle Zertifikate exportieren) to save the machine certificates into this folder, then click Next (Vorwärts).

When the assistant prompts you to import the client certificate, navigate to the
heisenwarefolder and open theimportdirectory.

Select the
heisenware_opcua_client.dercertificate and complete the import.

Check the checkbox to enable the OPC UA connection, click Apply (Anwenden), and click Next.

When prompted to import the user certificate, open the
heisenware/importdirectory and select theheisenware_opcua_user.dercertificate file.

Allow the system firewall to accept OPC UA traffic. Double-click the OPC UA method (Methode) option and set it to Allow all (Allen erlauben).
Click Reload firewall configuration (Firewall-Konfiguration neu laden) to apply the network rules.

Complete the assistant to finalize the on-machine certificate setup.
Connect to the OPC UA server
Return to the App Builder in your browser to finalize the integration.
Trigger the
finalizeOpcUaAssistantfunction on your canvas. It should return a success message.

Drag the
connectfunction from the Heidenhain OPC UA instance onto the canvas and trigger it. A return value oftrueconfirms a successful connection.

You can now use the standard Heidenhain OPC UA functions to read, write, and monitor live parameters from your CNC machine.

Last updated
Was this helpful?