Modbus RS485 to USB communication

Im trying to communicate Schneider PM1200 energy meter with Node red. There i have used Brainbox US-324 RS485 to USB converter and i have successfully check my path via modscan.

As per Schneider data sheet i want to read 3709 Float holding register to Node red. I have tried my best to do that and still i could not be able to do what i want to do. Can anyone here help me please. I will add my project below.

Baud rate= 19.2K ,Parity = Even , Device ID = 1, Com port = 3

Thank you.

[{"id":"2da777de.4f8f08","type":"modbus-flex-getter","z":"7024384e.688ae8","name":"","showStatusActivities":true,"showErrors":true,"logIOActivities":false,"server":"82ee0a01.a68618","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"x":340,"y":100,"wires":[[],["44869b94.c9bdf4","ee1e4a00.88aff8","71ef44c1.ca05bc"]]},{"id":"44869b94.c9bdf4","type":"modbus-response","z":"7024384e.688ae8","name":"","registerShowMax":20,"x":570,"y":260,"wires":[]},{"id":"eda55341.ee2be","type":"inject","z":"7024384e.688ae8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":100,"wires":[["752f1d16.efc514"]]},{"id":"752f1d16.efc514","type":"function","z":"7024384e.688ae8","name":"","func":"msg.payload = {\n    value: msg.payload, \n    'fc': 3, \n    'unitid': 1,\n    'address': 3709 ,\n    'quantity': 2 } \nreturn msg","outputs":1,"noerr":0,"x":180,"y":200,"wires":[["2da777de.4f8f08"]]},{"id":"ee1e4a00.88aff8","type":"debug","z":"7024384e.688ae8","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":540,"y":60,"wires":[]},{"id":"71ef44c1.ca05bc","type":"ui_gauge","z":"7024384e.688ae8","name":"","group":"c59b5080.b59d4","order":4,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":640,"y":140,"wires":[]},{"id":"82ee0a01.a68618","type":"modbus-client","z":"","name":"RS485","clienttype":"simpleser","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"COM3","serialType":"RTU-BUFFERD","serialBaudrate":"19200","serialDatabits":"8","serialStopbits":"1","serialParity":"even","serialConnectionDelay":"100","unit_id":1,"commandDelay":1,"clientTimeout":1000,"reconnectOnTimeout":false,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true},{"id":"c59b5080.b59d4","type":"ui_group","z":"","name":"Modbus Test","tab":"3deed73f.259758","order":1,"disp":true,"width":"6"},{"id":"3deed73f.259758","type":"ui_tab","z":"","name":"Modbus","icon":"dashboard"}]

Hi welcome to the node-red forum.
Can you please edit your post

In order to make code more readable and importable it is important to post it between two sets of three backticks - ``` - see this post for more details - How to share code or flow json

1 Like

Thank you for your kind advice. I have corrected now as you asked. :smile:

Now it is nicely formatted and importable :white_check_mark:

BUT - you have only posted 1 node (the Flex Getter).

Be sure to select all nodes before opening the export dialog.

1 Like

Dear Steve, I have corrected that as well. Can you please be good enough to take a look at my case?

Are you certain this is correct? an incorrect setting here can mess up the data (i.e. cause a CRC error).

This link shows you how to check comm settings.

It works fine with modscan with these settings

In your function, you provide a value but you are performing a FN3 (read hold reg)

Try removing the value part

e.g..

msg.payload = {
    //value: msg.payload, 
    'fc': 3, 
    'unitid': 1,
    'address': 3709 ,
    'quantity': 2 } 
return msg;

Regarding this image...

... That is the settings of your PC comm port - not the comm settings of the end device.

No good results yet. Yes it is confirm on Device ID=1 ,Baud rate=19.2K , Parity= Even 1

All i can suggest now is to intercept the values and inspect them.

Modbus RTU is quite simple to decipher (and even easier with online tools)

you can install virtual COM ports on your PC and link them together in order to capture the COM data.

so examples here

Then you can inspect the data - see if your node-red data (going out) is correct.

1 Like

Dear Steve,
If you can please build and send me a sample project?
Baud rate =19.2K
ID=1
Holding register ID = 3709
PC Com port = COM3

Hi,

to start, have you tried using the "modbus read" node?

[{"id":"621f8588.82c52c","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"b6f0ed19.99e04","type":"modbus-response","z":"621f8588.82c52c","name":"","registerShowMax":20,"x":370,"y":260,"wires":[]},{"id":"d1ff4ed8.f4c89","type":"debug","z":"621f8588.82c52c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":370,"y":360,"wires":[]},{"id":"a8776b3.ff8bd98","type":"modbus-read","z":"621f8588.82c52c","name":"","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"1","dataType":"HoldingRegister","adr":"3709","quantity":"2","rate":"5","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"2242755f.cb325a","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":150,"y":360,"wires":[["b6f0ed19.99e04"],["d1ff4ed8.f4c89"]]},{"id":"2242755f.cb325a","type":"modbus-client","z":"","name":"","clienttype":"serial","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"COM2","serialType":"RTU-BUFFERD","serialBaudrate":"19200","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]
1 Like

Dear rromele ,
I will check this on monday and will give you a feed back.The reason is my devices are in my workplace and i will go there on monday.
Thank you.

error remian the same.

@Hasitha_Sudasinghe, @rromele suggestion was to try the modbus read node.

From the screenshots, It looks like you're still using the flex getter?

It was the project that rrmole has created for me :roll_eyes: