New to Node-Red. We got a Vector controller which uses Node Red, and I'm trying to read data from it with a Siemens PLC using modbus TCP. The Siemens used the same code to read from another PLC. I was surprised that when I put the Vector's IP address as the remote address in the Siemens modbus config, it connected without my creating a client first. If I unplug the Vector's ethernet cable, it loses the connection, so I know the PLC is connected to the Vector and not something else.
When I do set up a modbus client on Node-Red, it tells me that it is not connected.
When assume the client must just be there because the PLC's modbus server is connected to it, and create the modbus tags, nothing is read. I'm playing with different ways to create the modbus tags, but there's nothing I see in the modbus libraries that is specifically for that.
I'm a little out of my depth. Any help creating these modbus tags would be appreciated.
I am having some difficulty understanding your system.
So you have a controller made by Vector, which is running node-red.
and you have a Siemens PLC. The PLC is to be configured as a Modbus client, trying to read data from node-red, so node-red must be configured as a modbus server.
Where had you not created the client? The Siemens PLC is the client and the Vector is the server. That suggests the there is already modbus server running in the Vector.
Perhaps you can clarify my (or your) understanding. I suspect you are confused about what a Modbus client is, and what a modbus server (slave) is. The Client is the one that asks the server for data using the servers address, id, coil number and so on.
Thank you for your reply! That was helpful. I thought the Siemens PLC was the server, but it is the client.
For some reason, the modbus client on the PLC says that its status is 7006 (data is being recieved), even if I don't create a server on the Node-Red. Do you know why that is?
When I do deploy a server, Node-Red's log tells me ECONNREFUSED. I'm playing with the settings on the server, but I'm not sure that's the right path because of the client on the PLC's status mentioned above.
I suspect that you will find that the Vector unit has created a Modbus server by default. Node Red us usually used by them to provide automation services. Which of the Vector controllers do you have as that will give you somewhere to start.
Essentially you have to get a list of Modbus Registers (where all the good information is stored) and how they are accessed (there are different types of methods) - this document is called a Modbus Map.
Typcially you would be able to use Node Red running on the Vector controller (if indeed it is on there) to read from what is called the Loopback address 127.0.0.1 to access the data on the controller and then push it out using MQTT or some other protocol of choice
Thank you for your reply! I have a vSECC.MCS. I've made progress. I set up a server and am writing to the holding registers. I'm worried that the server I set up is redundant, like you suggested. The PLC's client side 'Busy' output is always on, and the 'Done' bit never is.
Thank you for your help! It is no longer saying ECONNREFUSED (think I was using the wrong node). I'm writing to the holding registers now, but still not seeing the data on the client. Here is the setup:
Here is what's in the function node (it will only let me embed 2 pics, so I'm copying it):
msg.payload = { 'value': msg.payload, 'register': 'holding', 'address': 0, 'disableMsgOutput': 0 };
This is what I'm seeing in the debug:
msg.payload : buffer[8]
buffer[8]raw
0: 0x1
1: 0x2
2: 0x3
3: 0x4
4: 0x5
5: 0x6
6: 0x7
7: 0x8
The PLC's client side 'Busy' output is always on, and the 'Done' bit never is. The status is always
7006 (data is being sent) and occasionally blinks to 7005 (data is being received) for a moment, but the data never comes in.
I'm sorry if I'm missing something but why are you reading from the Siemens PLC using Modbus TCP? Is there any reason you can't read the data with S7 nodes, and configure using rack/slot?
There is one. When I turned off the Vector gateway's modbus server, the connection dropped and it gave me an error message. I think I was close to getting it to work, but tried setting up the comms using an S7 library, and that worked. Thank you!
The problem with Modbus TCP is that on the Siemens side, you'd have to make sure you define the connection within your hardware configuraton, and then use that HEX identifier that is the connection ID. You could also have done maybe an unspecified connection but even then you'd have to download the hardware configuration separately. Using the S7-contrib library is much easier and more straight forward so I'm glad that worked out for you.