Creating a Node-RED dashboard for OPC UA communication

13. February 2024 – Video
You can use the visual programming tool Node-RED to connect hardware, APIs and online services. The desired processes can be compiled in so-called dashboards according to the simple belly box principle. In this article, we explain how this works in detail in conjunction with an OPC UA server using the ACCON OPC UA server together with an S7-1516 PLC.
Creating a Node-RED dashboard for OPC UA communication

Creating a dashboard for OPC UA

With the ACCON OPC UA Server, you can communicate with PLCs of the type S7-1200, S7-1500, S7-300, S7-400 and SINUMERIK controllers. The creation of a dashboard for this is done in the same way for all of them. In the tutorial, we use the None security setting to simplify matters. For your practical application, we recommend using a higher security setting.
You can also find the complete instructions as a Video-Tutorial on our YouTube channel.

Preparing the tools

  1. Start OPC Server: Start the ACCON OPC UA Server and check with a UA client of your choice, e.g. UaExpert, that you can read the symbols.
  2. Loading and installing required modules: Open Node-RED. You can install new modules via the Manage palette menu at the top right. Search for and install node-red-dashboard and node-red-contrib-opcua. You now have access to OPC UA and dashboard nodes.

Create flow in Node-RED

  1. Add OpcUa-Client Node: Drag the OpcUa-Client node into the workspace. Enter the endpoint URL from the ACCON OPC UA Server in the Endpoint field. You can simply copy this via the right-click menu of the ServerConfigurator tray icon if the server is installed on the same computer.
    In the node settings, set Action to SUBSCRIBE and define an interval, e.g. 1s. For one-time reading or writing, you can use READ or WRITE here. We set the certificate settings as in the server, in our case to None.
  2. Add variables as OpcUa-Item Node: OpcUa-Item Nodes are dragged into the workspace for the variables to be monitored. Enter the node ID for Item in the settings. Also specify a name, set the data type and confirm the changes with Done.
  3. You can find the node ID and data type in the AddressSpaceConfigurator. To do this, click on the variable in the Address Space area on the left under Configure Address Space and then select and copy the node ID at the bottom. The data type of the variable is also shown there.
  4. Add Inject Node: Drag an Inject Node into the workspace. Remove msg payload and msg topic in the properties. Check Inject once after 0.1 seconds and leave Repeat at none. Confirm the settings with Done.
  5. Check flow - Add Debug Node: A Debug Node is used to check whether everything is working. Add it by dragging it into the workspace. To output the message in JSON format, set the debug output to complete msg object. After pressing Deploy, the variable values are displayed in the debug window. The variable monitoring setup is now complete. In this way, you can track changes to variables and react to them if necessary.
  6. Display several variables - Add Switch Node: If you want to monitor several variables, use a Switch Node. Enter the name of the OpcUa-Item Node, replace payload under Property with browseName and confirm with Done.
  7. Create Tabs and Groups: A tab and a group are required for the dashboard. These can be found on the right in the dashboard menu. First add a tab and then a group.
  8. Display variables - Add dashboard Text Node: Add a Text Node to display the variables. Select the group you have just added in the settings. Enter the heading under Label and confirm with Done. Press Deploy to display the first field in the dashboard.
  9. More variables - Add dashboard Gauge Node: Create another variable as before. This time, for example, add a dword: Add an OpcUa-Item Node. To do this, copy the Node ID and variable type from the AddressSpaceConfigurator and assign a name. Now create this item in the Switch Node. This time, use a Gauge as the output. Press Deploy again. Both variables are now displayed on the dashboard.

More questions about the ACCON OPC UA Server?

On our  YouTube channel we offer you a special OPC UA Server Playlist with various tutorials about the ACCON OPC UA Server. All information about the product, technical details and a free demo version can be found on the ACCON OPC UA Server product page. If you have any questions about the product and its use in your application, please do not hesitate to contact us via our contact form or by phone at +49 7171 916-120.
Tip
ACCON OPC UA Server High-performance, certified OPC UA server for S7 and SINUMERIK

For access to your Siemens controller via OPC UA the ACCON OPC UA Server is the right choice. Besides S7 PLCs, it is also suitable for SINUMERIK machine tool controllers. One of the few servers certified by the OPC Foundation that also supports optimized data blocks.

From €790.00*