Node-red connect PLC to dashboard


i have project using Node-red to connect with PLC. i want take data from some address in PLC and show it to dashboard.
i have problem, how to solve %MW100:X1 / %MW100:X2 of PLC with some variable?


so what have you tried? Where are you stuck?

i mean, how to make 1 address plc can contains all the variable?

usually i make 1 address for 1 variable value. not for 1 module plc.

You've not said what node you are using or given any example of your flow.

But if you would normally obtain one variable you could do that twice to pick up both variables and then use the join node to get them into one message in Node-RED

sorry, i want use a simple node red like this.


how the formula to using 1 address from PLC with the many variable like list picture before.
because usually, i make 1 address for 1 variable value from PLC.

As you want to do something that is more complex your flow will get more complex too.
Try something like below:

[modbus tcp]-|
[modbus tcp]-|

I assume you are using node-red-modbus-tcp (though you have not told us that, you could name any node modubustcp on the flow) then the readme says you can pass in a payload telling it what to read and what topic to set for the answer. I think that rather than trying to get them all in one go (which may be possible, I don't know) then send in a sequence of messages and get them one after another with different topics. Then you can use the topic to know what is in each reply (in a switch node or function node for example) and do whatever is required with each one.

if i join 2 modbus, so i need 2 address for plc, right? and i just call the other address with extend the quantity in modbustcp.

but thanks for your idea.

yeah i want all of them go. but in 1 address.:slightly_smiling_face:

I want all of the data get out, one by one.
Depend of the situation :grinning:

What is wrong with getting them one at time as a sequence of messages?

[Edit] If you want to show them on the dashboard you would have to split them up anyway, with them coming as a sequence you can use a Switch node to send them each to the appropriate dashboard nodes.


Do u want read or write ? or both ?

Usually what is usual to do is to read the word of the plc, in decimal for example and then break the word by the weight of the bits and so you know which active bit .... in modbus there are several functions to read or write, for example the function 1 can read only one bit.
More info, about modbus function:

I also advise using the modbus node in the image

all right, thanks for the idea.
i will try something with it.