Configuring Node-RED to Connect to PLC via OPC UA
Configuring Node-RED to Connect to PLC via OPC UA
Now that Node-RED is installed and the PLC is exposing OPC UA tags, it's time to establish a live connection and start reading values. This post will walk you through how to connect Node-RED to the virtual PLC running in PLCSIM Advanced using the OPC UA Client nodes.
Open Node-RED in your browser at http://localhost:1880
Drag an opcua-client node from the sidebar into your flow
Double-click it to open the configuration panel
Drag in an opcua-item node and connect it to the opcua-client node.
Each opcua-item represents one tag to read. Set the following:
Node ID: use the OPC UA Node ID format, typically:
ns=3;s="DB1.TagName"
For symbolic tags, you can find them in TIA Portal → PLC Tags → Symbol Table.
Datatype: match the data type (e.g. Boolean, Int, Real
ns=3;s="GlobalDB.WorkpieceCounter"
Tip: Use UA Expert to browse and copy the exact tag names.
To read values on demand or at intervals, connect an inject node to your OPC UA item node.
You can configure it to:
Trigger every X seconds (for continuous updates, 0,5s for this project)
Or manually trigger on button click (for testing)
Connect the OPC UA client node output to a debug node.
You can deploy your flow and refer to the debug tab (top-right sidebar) to ensure that values are being read correctly.
You should see the current state of your tag(s), like:
{"value":true,"datatype":"Boolean"}
Node-RED is successfully connected to your virtual PLC.
You can browse and read tag values in real time.
You’ve set up a flow that polls PLC data and shows results in the debug panel.
This connection forms the backbone of your dashboard and monitoring logic.