/opcua-to-ibmiotp

Visualizing OPC UA Data on the Watson IoT platform

Transfer OPC UA Data to the IBM Internet of Things platform

While modern information technology/IT systems use protocols like http, websockets, MQTT  (for IoT) and architectural styles (e.g. REST),   for operations technology/OT systems in manufacturing and plants a variety of other protocols are being used. In order to use this data a protocol conversion is needed. Fortunately OPC UA becomes a standard protocol and OPC UA servers can be used to collect data from southbound automation systems (like SCADA, PLC) that later can be consumed on the shopfloor/OT (e.g. predictive maintenance) or in combined OT/IT (worker assistants) e.g. uses cases.

Data flow

Below are the steps to consume (simulated) OPC UA data on the IoT platform. Note, that the data is pulled from the OPC UA server. The OPC UA protocol also supports publish/subscribe, see the announcement of the OPC foundation, but that would be a subject for another project.

OPC UA Server 

  • create an Ubuntu 16.04 VM on the IBM Cloud (register to the IBM Cloud, if not done already) with a public IP address (your-opc-ua-server-address)
  • note down the root password and the public IP address of the Ubuntu VM
  • install a web browser from the command line
  • setup security groups for the ports that are needed for that device: allow_opc_ua/inbound&outbound/53530, allow_ssh/inbound/22, allow_vnc/inbound/5900-5999 and assign them to the VM

We are using the Prosys OPC UA Simulation server to create some OPC UA simulation data

  • download and install the Prosys OPC UA Simulation Server via the Ubuntu desktop, see also the user manual
  • run the Prosys OPC UA Simulation Server from the Ubuntu desktop and note down the ocp.tcp address, e.g. opc.tcp://your-opc-ua-address:53530/OPCUA/SimulationServer
  • active Options > Expert Mode
  • on the Simulation tab modify the simulation data that is needed Simulation Data
  • on the Address Space tab you can see the attribute values of all simulated variables; we are using the temp varibale: ns=3;s=temp
  • Optional (for testing purposes): install an OPC UA client on your local machine and connect to the OPC UA server using the ocp.tcp address

IoT Platform

Node-RED Application

Node-REDs used to receive any incoming OPC UA messages from the OPC simulation server and send them to the IoT platform

  • install Node-RED locally, as a Docker container or as part of the [Node-RED starter kit] (https://cloud.ibm.com/catalog/starters/node-red-starter) on the IBM Cloud
  • install the node-red-contrib-opcua, node-red-dashboard and node-red-contrib-scx-ibmiotapp nodes via the Hamburger icon > Manage palette
  • import the Node-RED flow
  • configure the OPC UA client node OPC-UA: Endpoint = opc.tcp://your-opc-ua-server-address:53530/OPCUA/SimulationServer
  • configure the IBM IoT node: Device Type, Device ID, API Key, API Token, servername (youriotorgid.internetofthings.ibmcloud.com)

Test

  • go to https://youriotorgid.internetofthings.ibmcloud.com/dashboard/devices/browse

  • click on your device (OPCUA1) and Recent Events

  • in 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

  • click on the inject node

  • the OPC UA client node is pulling the current value of the variable from the OPC UA server. The payload of the OPC-UA node is then displayed on the dashboard and ... Node-RED Chart

  • ... transfered to the IoT platform, there should be events showing up under Recent Events Recent Events