Reading Modbus TCP data

Hi

I want to read some data from Modbus TCP, but it didn't work and I don't know where the problem is



image

[{"id":"9a63982dc9dc282c","type":"modbus-read","z":"6b9454ad03aaa289","name":"Voltage","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"61","dataType":"HoldingRegister","adr":"0","quantity":"46","rate":"10","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"62a4b715be1f5c5b","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":210,"y":260,"wires":[["bbd8805693f01e58"],[]]},{"id":"bbd8805693f01e58","type":"buffer-parser","z":"6b9454ad03aaa289","name":"test","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatle","name":"item1","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item2","offset":4,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item3","offset":8,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item4","offset":12,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item5","offset":16,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item6","offset":20,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item7","offset":24,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item8","offset":28,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item9","offset":32,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item10","offset":36,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item11","offset":40,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item12","offset":44,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item13","offset":48,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item14","offset":52,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item15","offset":56,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item16","offset":60,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item17","offset":64,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item18","offset":68,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item19","offset":72,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item20","offset":76,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item21","offset":80,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item22","offset":84,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"floatle","name":"item23","offset":88,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"swap16","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":390,"y":260,"wires":[["6ac769f038435cd4"]]},{"id":"6ac769f038435cd4","type":"debug","z":"6b9454ad03aaa289","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":260,"wires":[]},{"id":"62a4b715be1f5c5b","type":"modbus-client","name":"","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"Smappee5130007388","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":"61","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]

Since we cannot see inside your node-red flows, dont have connection to your network or devices and we have no idea what devices you are using, you will need to provide more info.

  • Is the node-red server connected to the same network as the device?

  • Can you ping Smappee513007388 from node-red (use node-red-node-ping)?

  • Are the settings correct?

  • Are you seeing errors?

  • What node package is this?

  • What versions of node-red and node-js are you using?

I can ping to it

  1. That is not what I asked. I said "Can you ping Smappee513007388 from node-red (use node-red-node-ping)?"

  2. what about the 5 other questions?

  • The settings are correct

  • I don't see any error

  • node-red-contrib-modbus

  • 5.21.0

  • The ping works in node-red also

  • What are the nodejs and node-red versions?

    • I need this as there were issues in certain versions
  • What OS are you running node-red on?

    • I need this so I can best advice (depending on what the other answers are)
  • Is the firewall blocking port 502?

  • How are you starting node-red (as a service or from a terminal)?

    • I need this so I can advise how to look at logs

The modbus getter is directly active..
image

nodejs version: v16.14.0
OS : opdrachtprompt
I don't know, it already worked once
as a service, I do 'node-red' and enter

That is not a service. A service is a program that runs even after you log off. You are running from command prompt. In which case, what (if anything) do you see in the command prompt (terminal) when you operate the "Modbus Read"?

Q: Is the Modbus Read always displaying "waiting"

Q2: Can you attach a debug node to BOTH outputs of the modbus nodes (set the debug nodes to show the complete message) - do you see any messages in the debug sidebar?

Ok,

Yes it's constantly displaying 'waiting'

If I set the debug nodes, there comes nothing in the debug sidebar

This looks like either a firewall issue (blocking port 502) or the device is simply not responding (settings changed? device crashed?)

Quick Q. I'm a little surprised to see that your (starting register) Address for the read is 0 (zero). If you do connect, your setup will try to read registers 0 to 45. Is that what you seek?

You can test your configuration with this free tool that will help you confirm or not your actual configuration.

Modbus Doctor free.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.