Modbus RS485 to USB communication

Have you tried running a modbus RTU simulator (pc based application) to see if that works?

Have you tried analysing the serial data?

Another option could be to open the source files in .node-red/node_modules/node-red-contrib-modbus, find the code where serial data is sent & received, and see if there is a debug flag to write serial com data to the console for analysis.

Lastly, you could try sending a known working COM string direct from a serial request node to see if the data reply is good or bad.

Edit....
Can you clarify exactly which node this is?

node-red-contrib-serial-modbus or node-red-contrib-modbus?

Lovely screenshots. But what are you trying to say?

Answer my questions please.

1 Like

what i have installed here is
node-red-contrib-modbus

The all in one Modbus TCP and Serial contribution package for Node-RED.

Since the port and device is working with MODSCAN and the application you have given i assume there is no wrong with port and the device.
In node-red/node_modules/node-red-contrib-modbus, find the code where serial data is sent & received, and see if there is a debug flag to write serial com data to the console for analysis. case actually i have no idea what to do, because why i have posted screen shots here .

So @rromele said

have you tried using the "modbus read" node

and you send this

That is NOT the flow or the read node he posted.

He posted this...

image


Other things to try...

  • RTU / RTU buffered? image
  • Is the UnitID set correctly?
  • Have you tried adjusting delays?
  • Try putting debug messages (set to show complete message) to both outputs & inspecting the full msg properties for clues?

well i think i tried wrong one early. Okey now i use correct one and it keep connected. But no output.

Have you closed other programs accessing serial port?

Are you certain unitid is correct?

Have you tried the other RTU settings?

It would be nice if you bothered answering my questions otherwise I'm gonna have to give up trying to help you.

1 Like

Dear Sir,
I have close all other port consuming softwares.unit ID is 1,Baud rate is 19.2K,parity is Even.
Above screen shot is when i changed my parameters to RTU as u said early. The same case is happening when i connect RTU -BUFFERED mode as well.

Also i have noticed this when i remove my converter to the PC the node red interface is showing me that it has disconnected and when i reconnected it automatically gets conneccted meaning that the modbus communication is working but the data is not transfering there to here properly. Right?

Also please tell that do i have to install node-red-contrib-serial-modbus ?

That is a separate implementation of modbus. Give it a try. It might work.

And once more, that screen shot is your PC com port and is not relevant. The com settings that matter are the end device.

And lastly, as I asked before. Have you tried connecting to a modbus simulator? By this I mean instead of connecting to a real device, connect to a simulator (that will prove node-red and the modbus node)

Also, you did you try to capture serial data (I posed a link to several applications) and analyse it in the modbus analyser website I linked to.

Lastly, raise an issue on GitHub (but I think the problem is yours)

my advice is to first test the communication between your device and a software like ModScan.
when with ModScan you can connect and read the data correctly then switch to Node-Red.
If you have no experience with node-red, use the "ModBus-Read" bubble first, which is simpler and does not need to write code, then you can use "FlexGetter" if there is a need.
Then:

  • check the settings of your device (19200-E-1 - id.1)
  • check correct wiring
  • verification of communication with ModBus network scanner and correct data reception.
  • switch to experimenting with NodeRed
1 Like

Yes i have successfully connected this with MODSCAN. Also here i have attached the screen shot with Virtual Serial Port Driver.

Here with Modscan

Since this is talking with modescan it is clear that i have correctly configured my device parameters. 19.2K,Even,ID1 ,8

In order for data to pass from virtual COM4 to physical COM3 you need to link them (see manage ports tab) then you'll see data passing node-red > com4 > ELTIMA > com3 -> device > com3 > ELTIMA > com4 > node-red

1 Like

Dear Sir,
i think i have linked com 3 and com 4 successfully?

I don't know how to allow them. I think here only COM 4 is talking to node red and COM 3 is not yet successfully connected?

image

In com 3 it says Port closed :cold_sweat:

But when i connect to MODSCAN and mean time checking the port data it shows connected.

I use ModBus on extensive and complex networks, always on Tcp / Ip, today I tried for you to connect locally via ModBus-RTU to a Schneider EM3155 analyzer via a USB / RS485 converter, I confirm that the communication works correctly.

I'll post code that is working properly because it is field tested, if you still have problems I can't help you further because I suppose you have other types of system or configuration problems on your PC and I'm not a Node-Red specialist.

the fact that you see "connected" when you insert your USB converter does not indicate that the instrument is connected, but indicates that the converter is connected to Node-Red

I'll post two examples, one with "READ" one with "Getter" both tested and working.
you need to reset your ID and your correct communication parameters.

[{"id":"db602284.20652","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ea93bf78.d81f","type":"debug","z":"db602284.20652","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":250,"y":200,"wires":[]},{"id":"585f39dd.0983c8","type":"modbus-response","z":"db602284.20652","name":"","registerShowMax":20,"x":470,"y":40,"wires":[]},{"id":"8c864ace.14c698","type":"modbus-getter","z":"db602284.20652","name":"current","showStatusActivities":true,"showErrors":true,"logIOActivities":false,"unitid":"30","dataType":"HoldingRegister","adr":"3256","quantity":"2","server":"c4cbd2cf.8bc4f","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":true,"x":310,"y":80,"wires":[["585f39dd.0983c8"],["ea93bf78.d81f"]]},{"id":"d923b08b.12b84","type":"inject","z":"db602284.20652","name":"","topic":"","payload":"","payloadType":"date","repeat":"50","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":100,"wires":[["8c864ace.14c698"]]},{"id":"c4cbd2cf.8bc4f","type":"modbus-client","z":"","name":"","clienttype":"serial","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.65.135","tcpPort":"502","tcpType":"DEFAULT","serialPort":"COM15","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]

[{"id":"db602284.20652","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ea93bf78.d81f","type":"debug","z":"db602284.20652","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":450,"y":200,"wires":[]},{"id":"585f39dd.0983c8","type":"modbus-response","z":"db602284.20652","name":"","registerShowMax":20,"x":470,"y":40,"wires":[]},{"id":"9266b761.8f69f8","type":"modbus-read","z":"db602284.20652","name":"","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"30","dataType":"HoldingRegister","adr":"3256","quantity":"2","rate":"10","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"c4cbd2cf.8bc4f","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":250,"y":140,"wires":[["585f39dd.0983c8"],["ea93bf78.d81f"]]},{"id":"c4cbd2cf.8bc4f","type":"modbus-client","z":"","name":"","clienttype":"serial","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.65.135","tcpPort":"502","tcpType":"DEFAULT","serialPort":"COM15","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]
1 Like

Hi, at start you mentioned 3709 then I see you read 3907 on modscan with success, please check that you are trying to read right register (3709 or 3907), with Modbus try to read just one register for start ie if you need 3907 and it is without success try 3906 or 3908 then comparing with modbusscan you will know where your first of 2 integers is (for float)

1 Like

This is not something wrong with MODSCAN.But with node red modbus reading registors.