Digital Developer Conference: Hybrid Cloud. On Sep 22 & 24, start your journey to OpenShift certification. Free registration

Transfer OPC UA data to the IBM Internet of Things platform


Manufacturers increasingly want to more tightly integrate the operations technology (OT) systems that control production with their informations technology systems to become more productive and flexible.

A typical scenario is the data transfer from these OT systems (like SCADA or PLC) to an OPC UA server, or in some cases to IT applications, where it can be analyzed and used for production control and optimization. The OT data is stored in OPC UA variables and contains production status, environment conditions, and additional information. It can be a problem, though, because while modern IT systems use protocols like http, websockets, MQTT (for IoT), and architectural styles (e.g. REST), OT systems use a variety of other protocols and fieldbus systems.

Data flow

To access OPC UA variables, a protocol conversion is needed. If you want to try out the visualization of sensor data or build a more sophisticated solution (e.g. worker assistant) based on OPC UA, you can use this tutorial as a starting point. An OPC UA simulation server simulates an OPC UA server connected to a temperature sensor that is permanently generating random temperature values.


It is assumed that you have basic knowledge about manufacturing and are signed-up with the IBM Cloud. You may also want to read more detailed information about the OPC UA simulation server. We are using Node-RED which is an open source tool with a graphical user interface used to quickly connect internet of things applications. It comes with some default functionality (e.g. input nodes, output nodes), and is extensible.


Below are the steps to setup the OPC UA simulation server with the IBM IoT Platform. The OPC UA simulation server and the Node-RED gateway will be running locally.

OPC UA simulation server

First, we want to generate some data. In this case we are using the free PROSYS OPC UA Simulation Server, that runs on Windows, Linux, and MacOS.

  1. Download and install the PROSYS OPC UA Simulation Server.
  2. Run the PROSYS OPC UA Simulation Server.

    • Note the ocp.tcp address, e.g. opc.tcp://your-opc-ua-address:53530/OPCUA/SimulationServer

    tcp address

  3. Select Options > Expert Mode to activate the expert mode.

  4. On the Simulation tab modify the simulation data that is needed.

Simulation Data

I added an OPC UA object MIB (which is an option to group variables) and a variable temp that ranges from -2 to 2 (just because that is the default). On the Address Space tab you can see the attribute values of all simulated variables. We later need them as parameters in the Node-RED gateway, for example: ns=3;s=temp.

Watson IoT platform

The purpose of Watson IoT platform is twofold:

  • It acts as an MQTT broker, receiving and forwarding MQTT events.
  • It visualizes the events on a dashboard.

Create an IoT service and a device in that service that represents the Node-RED gateway sending events to the IoT service:

  1. Go to the IBM Cloud catalog
  2. Create a free (Lite plan) Internet of Things Platform service
    • Note your Internet of Things Organization ID, e.g. lt9l36
  3. Create an Internet of Things device, see the Getting Started guide


Use descriptive names for the Device Type (e.g. OPCUA) and the Device ID (e.g. OPCUA1) and note them down. The Authentication Token can be generated automatically.

Now the IoT service is running and the device created, waiting for events to arrive. But before we create our visualization (temperature graph) we want to connect the OPC UA simulation server with the IoT service.

Node-RED Gateway

We use a simple Node-RED flow receiving messages from the OPC simulation server and sending them straight away to the IoT service.

  1. Install Node-RED locally or as a Docker container.

    We need two Node-RED nodes that are not pre-installed, so we need to add them to the Node-RED palette manually before we can use them. That’s a simple task, here is a video that shows how to do it.

  2. Install the node-red-contrib-opcua and the node-red-contrib-ibm-watson-iot nodes via the Hamburger icon > Manage palette.

    Now that the nodes are installed you can

  3. Import the Node-RED flow, again using the Hamburger icon.

    Node-RED Flow

    We need to configure our input and the output nodes:

  4. The OPC UA client node OPC-UA connects to the OPC UA simulation server: Enter the endpoint = opc.tcp://your-opc-ua-server-address:53530/OPCUA/SimulationServer.

  5. The Watson IoT node connects to our device: Enter Organization, Server-Name (, Device Type, Device ID, Auth Token.
  6. In the Node-RED app open the inject node and modify the Topic, if needed. Topic is set to ns=3;s=temp;datatype=Double, which represents the namespace, the variable name and type.

Inject Node

  • When finished, click deploy to deploy the Node-RED flow

Now the Node-RED flow is running. The OPC UA node is pulling the current value of the OPC UA variable temp from the OPC UA simulation server in intervals of 60 seconds and the OPC UA messages should appear in the debug sidebar. The payload of the OPC-UA node is then transferred to the IoT platform.


Let’s head over to the Watson IoT platform and check if we can see the temperature values:

  1. Go to
  2. Click on your device (OPCUA1) and Recent Events.

Recent Events


Finally, we want to see the temperature values on the dashboard of the Watson IoT platform. For that we need to create a board and a card:

  1. Go to and click Create New Board. Give it a name and click Next and then Submit.
  2. Select the board and click Add New Card.
  3. Click on Line chart and select the OPCUA1 device. Click on Next and then Connect new data set.
  4. Enter the data set’s parameters:

    Event: event
    Property: value
    Name: Temperature
    Type: Number
    Min: -2
    Max: 2

  5. Select the card size and click Next.

Now you can see the simulated temperature generated by the OPC UA server on the IoT platform.



This tutorial showed you how to connect an OPC UA simulation server to the Watson IoT platform for testing purposes. From this point you can explore more use cases, for example using the data in an application. It should be mentioned that although Node-RED can be used to quickly build prototypes, in real production scenarios, IBM App Connect for Manufacturing can be used as a more robust (or more readily manageable) gateway to tackle more massive deployments.