Hey to all,
i want to use OPC UA in Node-Red to Read from my PLC(Tia V15) and store Data. I don´t now how to process.
I have try it, but nothing is coming out .
Hey to all,
i want to use OPC UA in Node-Red to Read from my PLC(Tia V15) and store Data. I don´t now how to process.
I have try it, but nothing is coming out .
In my experience, getting data from OPC is never easy... but you should be seeing some raw data once you get connected. Please give us all the details on which OS, versions of node/npm/nodejs, and the full module name of the node(s) you are trying to use (since there are at least 3 versions in the flows library).
Sharing your flow is probably not helpful right now because we wouldn't be able to test against your specific devices.
Connecting node-red to OPC-UA is super easy, IF you know what namespace the tag is located in and the actual tag path.
The servers typically sit at:
opc.tcp://ipaddress:4840
Verify your IP address and port number in your server settings.
The address you enter for your tag should look similar to this example.
ns=6;s=::AsGlobalPV:PTank.Temperature
To get this information, I suggest finding a free opc-ua client browser. UaExpert is one. This will allow you to at least login to the server and see where tags are located.
Security settings on the server also need to be verified so that they match in node-red.
Oh yes. I am using "node-red-contib-opcua" i install it from the Node-red library. all my data are in a DB of my PLC and i am trying to use OPC Ua to Read and Write it.
Ok thks seth350, i will try it like you suggest and see if it`s works.
Good luck. I am talking to a B&R plc running node-red.
I will also mention this, once you get it working, each time you place a opcua client node in the flow, it opens another connection to your plc.
You can read and write many tags using just one client node but it will take a little work depending on how many tags you want to read.
Also, since you mentioned Siemens, I believe I have seen a node created to communicate with a Siemens plc. Might also be worth checking out.
I don´t understand what my Endpoint is? is it My PLC IP-Adresse with the port? or what?
for the Inject node what is ns and s. Please answer me if you know. because i try several time but nothing is coming out. the opc ua client i use show connecting by the way
The endpoint is
opc.tcp://ipaddress:port
This will be the IP address of your plc and the port number the opcua server is running on. Typically, the port is 4840 but you will need to verify your plc configuration.
“ns” = namespace index
The name space is, from what I understand, a number indicating what “section” of the server the tag is located.
There are many standard namespaces that will point you to different sections of the server. There is a section for global variables, one for program scope variables, server status, etc.
You must tell the server which namespace you want to access first.
“s” = string. This is not what you may think. It is not the data type of the tag you want to read, instead it is indicating that you are going to enter a tag address as a string. There are tags in the server that can be read by their nodeID number. To read a tag by nodeID, your address would look like this example:
ns=21;i=43
Data types can be added to the address and come after the tag location. For example as:
...Temperature.Int16
I’ll break down my previous example:
ns=6;s=::AsGlobalPV:PTank.Temperature
I want to read a tag in the server at namespace 6.
The tag that I want to read is located in folder AsGlobalPV, and the tag is PTank.Temperature.
AsGlobalPV is a folder that contains my global variables on a B&R plc. Siemens may call it something else. TIAGlobal or something.
If you haven’t already, step out of node-red and get a free opcua client application from online somewhere. UaExpert is one off the top of my head. Get connected to your plc using it first. Once you are connected you will see the folder structure I am talking about.
If you can, post some pictures of your opcua server configuration in the Siemens software and also copy your flow from nodered to here.
I will also look at my configuration when I get back to work.
HI @seth350,
Do you know how can I browse the data of opcua server using node-red?
I want to browse all the data and select any data which I want to visualize on dashboard of node-red. Is it possible?
Thanks
Yes, it is possible using the OPC Browse node. I have not used it personally.
Basically, you would want the output of the browse node to point to a drop down list on the dashboard. You will more than likely need a switch node in between to filter the output so you only see what you need.
Then, let the output if the drop down list go to an OPC Read node.
Your mileage may vary.
I have tried using the Browser node and the template node together. But I am struggling with it which I posted here but got no response yet.
Maybe you can help me with that. Thanks.
With the node-red-contrib-iiot-opcua
nodes, there are a ton of built in samples.
Node-red Editor --> menu (top RH corner) --> import --> examples --> iiot opcua
Have you looked here for clues?
Hi @Steve-Mcl,
I have looked into the examples, In examples either I have to inject or filter the data to get the desired data so I need to know what I am browsing for and what should I get.
On the contrary, I require a solution in which the available data should be there and when I select a particular node, then the data should be displayed accordingly. For this, I wanted to use template node from the dashboard package but I don't know how to develop a solution like this.
What I've done in the past is use uaexpert like @seth350 said...
With that, I browse the OPCUA server, find the tags of interest, copy the path and paste it into node-red.
I'm certain once you can so it statically you can do it dynamically (IE entering a tag name into dashboard field).
@Steve-Mcl, Thanks for your kind response. I have done it statically. I want to do it dynamically. For that purpose, I think I need to use a template node and get all the data from root node and then select a particular node to show the data. But I don't know how to get that.
@seth350 i have a similar case but the problem is that i am not able to get any output in the debugging tab.
I have an injecter connected to a OPC UA client who is further connected to read, response and debug in order respectively.
The session is active in OPC UA client.
@Digs_10,
Can you share the screenshot of your flow?
The first thing I notice is that you're using 2 modules.
node-red-contrib-opcua and node-red-contrib-iiot-opcua.
OPC UA Client needs the nodeid at input if it is in READ or SUBSCRIBE mode. What is timeRead injecting?
You don't need to use READ and Response to read something from the server. There may be multiple ways to do it. The easiest way which I know is to use Inject node where you define the nodeid and the OPC UA Client node wher you define the endpoint and the action (READ in this case) and put a debug node at the output of the OPC UA Client node. You will get something.
Wow
This is amazing sir!
Thanks a lot!
I just have one doubt: what is the difference between 'node-red-contrib-opcua' and 'node-red-contrib-iiot-opcua'? I've googled the question but didn't get any clear-cut answer. It would be just great if you could explain in brief sir!
Also i tried what you said but...here is the output