--- title: "OPC UA Server | Examples | N3uron KB V1.22" slug: "opc-ua-server-examples" description: "OPC UA Server is a N3uron module designed to expose the data collected through any other data acquisition module within the platform to third-party systems…" updated: 2025-09-30T15:55:34Z published: 2025-12-23T12:31:41Z canonical: "docs.n3uron.com/opc-ua-server-examples" excludeFromSearch: true excludeFromExternalSearch: true --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.n3uron.com/llms.txt > Use this file to discover all available pages before exploring further. # Examples ## Connecting to N3uron's OPC UA Server from UA Expert Client This is a detailed step-by-step guide to connecting to **N3uron's OPC UA Serve****r** using the **UA Expert** **Client,** which can be downloaded from [https://www.unified-automation.com/](https://www.unified-automation.com/)[](https://www.unified-automation.com/)**[](https://www.unified-automation.com/)** - **Step 1:** Create an instance of the module: (Config => Modules => button to the left of Modules => New module) ![Figure - New module(1)](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20New%20module(1).png) - **Step 2:** Provide a name for the module, in this case, OpcUaServer, set the module type to OpcUaServer, and configure the new module instance as shown below. ![Figure 7- Configure the module](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%207-%20Configure%20the%20module.png) - **Step 3:** Set the **API** and **Logger** configuration as default. Next, it's time to configure the module to establish which networks will be able to establish communication. - **Step 4:** Configure the main parameters of your OPC UA Server instance according to your needs. ![Figure - OPC UA Server Config](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20OPC%20UA%20Server%20Config.png) - **Step 5:** As we don't want to allow **Anonymous users** to access the server, we need to add a role with the corresponding permissions for it. In this case, we have added the Administrator role with all the permissions enabled and no restrictions regarding tag access. ![Figure - Example OPC UA Server Access](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Example%20OPC%20UA%20Server%20Access.png) ![Figure - New Role 2](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20New%20Role%202.png) At this point, the server is fully configured. Now, let's configure the connection in UA Expert. - **Step 6:** Inside UA Expert, click on Servers and select Add to add a new server. ![Figure 11 - Add Server](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2011%20-%20Add%20Server.png) - **Step 7:** Click on Custom Discovery and introduce the discovery URL of the server previously configured. ![Figure 12 - Select server](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2012%20-%20Select%20server.png) - **Step 8:** Select the target endpoint with the desired security policy. In this case, Basic256Sha256. ![Figure 13 - Select Basic256Sha256](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2013%20-%20Select%20Basic256Sha256.png) - **Step 9:** Now, connect with the **N3uron** **OPC UA Server**. ![Figure 14 - Connecting](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2014%20-%20Connecting.png) - **Step 10:** After connecting, enter the credentials of a user with administrator permissions. In this case: - **Username:** admin. - **Password:** n3uron. ![Figure 15 - Introducing the credentials](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2015%20-%20Introducing%20the%20credentials.png) - **Step 11:** Once the credentials are introduced, Trust the Server certificate. ![Figure 16 - Trusting the certificate](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2016%20-%20Trusting%20the%20certificate.png) - **Step 12:** Navigate to **N3uron** and trust the certificate issued by UA Expert to enable the connection. ![Figure - Trust(1)](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Trust(1).png) - **Step 13:** Once trusted, UA Expert will allow browsing of the server. ![Figure - Root](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Root.png) ## **How to** **Access** **Historical Data (HA)** ## [Embedded content](https://www.youtube.com/embed/s_b4XZKVlZE?&t=11s&wmode=opaque&rel=0) **N3uron** supports **Historical** **Data** **Access** (HA), which allows the client to fully access historical data from the server (using the [Historian](https://docs.n3uron.com/v122/docs/historian-introduction) module). In this example, we're going to retrieve historical data corresponding to 3 sinusoidal signals that are 120º out of phase with each other. - **Step 1:** Once the **OPC UA Server** module is created and configured and the connection is successfully established, go to UA Expert and in **Document**, click on Add. ![Figure - Sinus 3](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Sinus%203.png) - **Step 2:** Now, select **History Trend View** and click on **Add**. ![Figure - Sinus 4](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Sinus%204.png) - **Step 3:** Inside the **Address Space** select the tags you want to visualize and drag them to the **Configuration** section within **History Trend View**. ![Figure - Sinus 5](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Sinus%205.png) ![Figure - Sinus 6](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Sinus%206.png) - **Step 4:** Enter the **Start** and the **End time** according to the period you want to visualize and click on **Get Start Time**. ![Figure - Sinus 7](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Sinus%207.png) - **Step 5:** Now, click on **Update** to visualize the **History Data** diagram. ![Figure - Sinus 8](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Sinus%208.png) ## ![Figure - Example OPC UA Server HDA](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Example%20OPC%20UA%20Server%20HDA.png) ## **Creating and Configuring a Method** [Embedded content](https://www.youtube.com/embed/WjWeqnhkB0I?&t=5s&wmode=opaque&rel=0) Using methods, **N3uron** enables additional complex functions to be launched (provided by the [Scripting](https://docs.n3uron.com/v122/docs/scripting-introduction) module) by using an OPC UA method. In this example, we're going to show how to create a method for adding two values. - **Step 1:** Create a **New Task** in the **Scripting** module. ![Figure - Scripting 1](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Scripting%201.png) - **Step 2:** Then, create a **New** **Action**. We've called it Methods. This action must be an **External** action type. ![Figure - Scripting 2](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Scripting%202.png) - **Step 3:** Once created, generate a new script named Sum by clicking on **New Script**. When the **OPC UA Server** module calls an external script, the input arguments can be used in the script by using $.event.ARGUMENT_NAME. Additionally, if the script needs to return one or more values to the **OPC UA Server**, this must be done by returning an object whose keys are the output arguments. ![Figure - Scripting 3](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Scripting%203.png) ![Figure - Scripting](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Scripting.png) ![Figure - Script](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Script.png) - **Step 4:** To configure the Method, go to **Methods** inside **OPC UA Server** and click on **New Method**. ![Figure - Scripting 4](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Scripting%204.png) - **Step 5:** Once created, enable it and select the corresponding **Scripting instance** and the name of the script. In this case, we select the Sum script previously created and insert a description of the method. ![Figure - Configuring a Method](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Configuring%20a%20Method.png) - **Step 6:** Now, let's create the corresponding arguments. First, we will create the **Input arguments**. ![Figure - Scripting 5](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Scripting%205.png) ![Figure - Input arguments](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Input%20arguments.png) - **Step 7:** Then, create the **Output arguments** and the method is ready to use. ![Figure - Scripting 6](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Scripting%206.png) ![Figure - Output arguments](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Output%20arguments.png) - **Step 8:** Now, if we go to UA Expert, we can invoke the Sum method as shown in the image below. ![Figure - Methods](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Methods.png)