# Modbus RS485 to USB communication

**URL:** <https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074>\
**Category:** Industrial\
**Created:** [22 May 2020 08:33 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074 "2020-05-22T08:33:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [22 May 2020 08:33 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/1 "2020-05-22T08:33:16Z")

</div>

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.

```auto
[{"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"}]

```

---

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [22 May 2020 08:36 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/2 "2020-05-22T08:36:05Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/8/a87dd00c6c30cbdaaf023e3328c87140408e25b9.png)

---

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [22 May 2020 08:36 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/3 "2020-05-22T08:36:40Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/7/479c67576ad72ea8c608f9674a7bb694e6171bae.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 May 2020 08:37 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/4 "2020-05-22T08:37:20Z")

</div>

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](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [22 May 2020 08:40 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/5 "2020-05-22T08:40:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [22 May 2020 08:40 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/6 "2020-05-22T08:40:48Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/9/09a48276e7f282c70f709b4e76dc1c7d31a3c10d.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 May 2020 08:42 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/7 "2020-05-22T08:42:41Z")

</div>

Now it is nicely formatted and importable ✅

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

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

---

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [22 May 2020 08:43 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/8 "2020-05-22T08:43:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 May 2020 08:47 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/9 "2020-05-22T08:47:48Z")

</div>

> [@Hasitha\_Sudasinghe](#):
>
> Baud rate= 19.2K ,Parity = Even , Device ID = 1, Com port = 3

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

[This link](https://www.youtube.com/watch?v=XoYNbi1kJs8) shows you how to check comm settings.

---

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [22 May 2020 08:48 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/10 "2020-05-22T08:48:35Z")

</div>

It works fine with modscan with these settings

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/e/2e3ed9035c556ec83591927b637839d977c0fe0a.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 May 2020 08:51 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/11 "2020-05-22T08:51:14Z")

</div>

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

Try removing the value part

e.g..

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

```

* * *

Regarding this image...

> [@Hasitha\_Sudasinghe](#):
>
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/e/2e3ed9035c556ec83591927b637839d977c0fe0a.png)

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

---

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [22 May 2020 08:56 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/12 "2020-05-22T08:56:06Z")

</div>

> [@Steve-Mcl](#):
>
> om

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/8/7839969df6f0d7ad5e25b3e0bda26d45cbdcf332.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 May 2020 09:04 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/13 "2020-05-22T09:04:59Z")

</div>

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](https://rapidscada.net/modbus/ModbusParser.aspx))

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

so examples [here](https://www.virtual-serial-port.org/articles/best-serial-port-monitor-utilities/#SerialMon)

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

---

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [22 May 2020 11:47 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/14 "2020-05-22T11:47:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rromele](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rromele/32/18431_2.png) [@rromele](https://discourse.nodered.org/u/rromele)\
**Post date:** [22 May 2020 15:14 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/15 "2020-05-22T15:14:06Z")

</div>

Hi,

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

```auto
[{"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}]

```

---

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [22 May 2020 18:12 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/16 "2020-05-22T18:12:24Z")

</div>

> [@rromele](#):
>
> `"`

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.

---

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [25 May 2020 07:08 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/17 "2020-05-25T07:08:30Z")

</div>

error remian the same.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/6/064e60b5641947ba2580af64e99f9e73551a8c2e.png)

---

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [25 May 2020 07:09 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/18 "2020-05-25T07:09:23Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/d/ad8a190b27feae3d4b72f43fc5153a43f85165f5.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [25 May 2020 07:43 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/19 "2020-05-25T07:43:18Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Hasitha\_Sudasinghe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hasitha_sudasinghe/32/22710_2.png) [@Hasitha\_Sudasinghe](https://discourse.nodered.org/u/Hasitha_Sudasinghe)\
**Post date:** [25 May 2020 07:44 UTC](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074/20 "2020-05-25T07:44:10Z")

</div>

> [@Steve-Mcl](#):
>
> sing the f

It was the project that rrmole has created for me 🙄

[Next page](https://discourse.nodered.org/t/modbus-rs485-to-usb-communication/27074.md?page=2)
