Using OPC UA with TwinCat

Hey there, for once I am the one asking for support.
Has anyone tried set up TwinCat with OPC UA to use it with Factory I/O?
I tried setting it up but stumbled at multiple points…

1 Like

Hi @janbumer1!
Could you please elaborate a bit more about the issues you’ve encountered? We have a Beckhoff PLC here in the lab and we would like to test it out and see if we can help in any way.

1 Like

Hey there
I guess it’s not really problem on your end. I tried setting up a OPC Server using the tools provided by Beckhoff. But when I try to connect to the OPC Server I get an Error message.

1 Like

I see, could you let me know what error you get?

In the meantime, I tried to set it up and also had some troubles. Eventually, I got it to work with Factory I/O and control the ‘From A to B’ scene. I’ll detail the steps I took here and I hope it helps you set it up. If you still can’t get it to work let us know and we’ll try to help you.

First, you need to install the TF 6100 OPC UA communication package available on Beckhoff’s website, here. I installed the TF 6100 Server, TF 6100 Configurator.

The second step is to configure the TwinCAT project so it is ready to use OPC UA, for that, in this link select TwinCAT 3 > TFxxxx | TwinCAT 3 Functions > TF6xxx - Connectivity > TF6100 | OPC UA > Technical introduction > Server > Quick Start and then follow the instructions given.

Next, you will configure the server. For that, you use the TF 6100 Configurator. This is installed both as a standalone application and integrated into the TwinCAT software. I tried both and I, personally, prefer the version that is integrated into TwinCAT. To use the configurator you open TwinCAT XAE Shell and create a new “Connectivity Project”.

Create Connectivity Project

Once the project is open you right-click on the project item in the Solution Explorer tree, and add an OPC UA Server Project, as shown in the images below.

Add new item to the Connectivity Project

With that set up, the next step is to add the OPC UA tools to the toolbar. Select View > Toolbars > TwinCAT OPC UA Configurator.

Next, you need to edit the server list. For that, in the toolbar you’ll find the OPC UA tools you just added. In the dropdown list select “Edit Serverlist” and the “Server configuration” window should open.
Select Edit Serverlist

Click “Add Server”.

This should open the “Endpoint configuration” window.

Endpoint configuration

In the dropdown list there should appear one or more options (in my case it only shows one because I’ve disabled the others as I’ll show in a bit). Select the one that has “Basic256Sha256”, make sure you select the “Anonymous” option and click “OK”. Close the “Server configuration” window.

The last thing to configure here is the Security Policies the server supports. For that select the OPC UA Server Project and then select the tab UA Endpoints. In this tab deselect all checkboxes except the Basic256Sha256.

In the dropdown list in the OPC UA toolbar select the server you just added and hit the “Connect” button in the OPC UA toolbar. It will then ask you for a username and password. You can use whatever you want, just note them down because they will be needed later. The first time you try to connect to the server it will not connect, it will initialize the server. Click “Connect” again.
You should see a window asking if you trust the server, click “Trust”.

Trust server

If the connection is successful the “Connect” button should now be greyed out. In case the Security configurations are reverted, reconfigure them and, in the OPC UA Server toolbar, select the “Activate OPC UA Server Config” button, which is next to the “Disconnect” button. Then click “Connect”.
Next, make sure that in the project tree, under the OPC UA Server Project item, in the Data Access, there is an item with the same name as the PLC Project you are using for programming.

Data access point

Select that item and check the “Properties” window to make sure the “AMS Net ID” is the same as the one in the PLC Project you are using. For that, you can select the “…” button in the AMS Net ID field to open the “Choose target device” window and select the device you are using.


Restart the server to apply the changes. For that, you can do “Disconnect” and “Connect” or use the restart button, illustrated below.

Restart server

The last thing to configure is to add the username and password defined before in Factory I/O. In order to do that you have to use the “drivers.opc_client.ua_username” and “drivers.opc_client.ua_password” commands in Factory I/O’s console. For more info on the console, you can check our documentation here.

Now you should be able to connect to the server normally. I hope this helps.


You are the best, thank you very much!
I will try this later on!

1 Like