question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ModeBus with serial interface

See original GitHub issue

Hello

This is not a bug but a question seeking help as I could not find them in documents.

I am trying to use this module to connect to a battery that supports Modbus and read data. Using the software that came with battery is working so my connections and battery are working, but I am not able to configure the different parameters.

I am always getting timeout when trying simple getter as below

[{"id":"88deba32.459178","type":"tab","label":"Flow 1"},{"id":"7443f003.00d78","type":"modbus-getter","z":"88deba32.459178","name":"","showStatusActivities":true,"showErrors":true,"unitid":"38","dataType":"Coil","adr":"4096","quantity":"1","server":"e71eb878.ef5e08","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":340,"y":80,"wires":[["ae00dbc8.95ef18"],[]]},{"id":"73612a54.d8e954","type":"inject","z":"88deba32.459178","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":140,"y":40,"wires":[["7443f003.00d78"]]},{"id":"ae00dbc8.95ef18","type":"debug","z":"88deba32.459178","name":"","active":true,"console":"false","complete":"true","x":530,"y":40,"wires":[]},{"id":"e71eb878.ef5e08","type":"modbus-client","z":"88deba32.459178","name":"battery1","clienttype":"serial","bufferCommands":true,"stateLogEnabled":true,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"COM3","serialType":"RTU","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":38,"commandDelay":10,"clientTimeout":1000,"reconnectTimeout":2000}]

From the document of the battery, I concluded the following

BMS code switch value range 0~15,The BMS communication base address 38,BMS communication address is sum of code switch value and communication base address. UnitId = 38

RegId for voltage is 0x1000 so I used Address 4096

and I used quantity 1.

Is my conclusion correct about the different settings, is their a definition of what is UnitId, Address, RegId

Thanks

  contribModbus:core:client Client -> {"info":"queue read msg","message":{"value":1517841108577,"unitid":"38","fc":1,"address":"4096","quantity":"1","messageId":"5a786ad41c82fb1d1c27e4f0"},"state":"EMPTY","queueLength":1} Serial@COM3:9600bit/s default Unit-Id: 38 +1ms
  contribModbus:getter {"topic":"7443f003.00d78","payload":{"value":1517841108577,"unitid":"38","fc":1,"address":"4096","quantity":"1","messageId":"5a786ad41c82fb1d1c27e4f0"},"_msgid":"d053c53f.5f1068","queueNumber":0,"queueUnit":38} +19ms
  contribModbus:core:client Client -> {"state":"QUEUEING","message":"dequeue command serial","delay":10} Serial@COM3:9600bit/s default Unit-Id: 38 +15ms
  contribModbus:core:client Client -> {"type":"queue check","unitid":38,"sendAllowed":true,"queueLength":1} Serial@COM3:9600bit/s default Unit-Id: 38 +0ms
  contribModbus:core:client Client -> {"type":"serial sending and wait","unitid":38,"queueLength":0,"sendAllowedForNext":false,"delay":10} Serial@COM3:9600bit/s default Unit-Id: 38 +3ms
  contribModbus:core:client Client -> {"info":"read msg","message":{"value":1517841108577,"unitid":"38","fc":1,"address":"4096","quantity":"1","messageId":"5a786ad41c82fb1d1c27e4f0"},"unitid":38,"timeout":1000,"state":"QUEUEING"} Serial@COM3:9600bit/s default Unit-Id: 38 +3ms
  contribModbus:core:client Client -> {"info":"queue response activate sending","message":{"value":1517841108577,"unitid":"38","fc":1,"address":"4096","quantity":"1","messageId":"5a786ad41c82fb1d1c27e4f0"}} Serial@COM3:9600bit/s default Unit-Id: 38 +1s
  contribModbus:core:client Client -> event: activate old: QUEUEING new: ACTIVATED Serial@COM3:9600bit/s default Unit-Id: 38 +3ms
  contribModbus:core:client Client -> event: queue old: ACTIVATED new: QUEUEING Serial@COM3:9600bit/s default Unit-Id: 38 +4ms
  contribModbus:core Remove Message In:<5a786ad41c82fb1d1c27e4f0> Out:<5a786ad41c82fb1d1c27e4f0> +2m
  contribModbus:getter Timed out +1s
  modbus-serial modbusErrorHandling:Timed out +15s
  contribModbus:core:client Client -> {"state":"QUEUEING","message":"dequeue command serial","delay":10} Serial@COM3:9600bit/s default Unit-Id: 38 +12ms
  contribModbus:core:client Client -> {"type":"queue check is not a unit","unitid":null} Serial@COM3:9600bit/s default Unit-Id: 38 +3ms

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
yaacovcommented, Feb 7, 2018

Hi, all The battary software message is not pure modbus syntax, but does look like ascii modbus:

~ delimiter (in ascii modbus the delimiter is : )
25 UnitID
01 Read Coil Status (FC=01)
46C2 The Data Address of the first coil to read.
0000 The total number of coils requested.
FD99 should be LRC

My 2 cents are:

  1. the software use some proprietary dialect that is not pure modbus.
  2. try to use ascii modbus.
  3. try also UnitID 25, it seems to work for the dialect the battery software use 😃
1reaction
shahbourcommented, Feb 7, 2018

I will test that today when I reach office

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction to Modbus Serial Communication | Precision Digital
Modbus is a way for two devices to communicate digitally. Modbus "provides client/server communication between devices." This means that Modbus allows two or ......
Read more >
Modbus Serial Interface for Anybus CompactCom 40-series
CompactCom Modbus Serial Interface is a very simple way to connect your Modbus host applications to advanced industrial networks.
Read more >
Modbus RS-232 and RS-485 for Serial Interface Monitoring
Modbus via RS-232 sends data in the form of a time-series of bits. It is a standard for communication between data terminal and...
Read more >
MODBUS SERIAL VS MODBUS TCP/IP - AutomationForum
This is a type of MODBUS communication protocol that uses ASCII characters to do serial communication. This type of communication protocol ...
Read more >
Modbus TCP/IP to Modbus Serial Communication Module
ProSoft Technology's Modbus® TCP/IP to Modbus® Serial communication gateway allows high-speed bi-directional data transfers between Modbus® TCP/IP-enabled ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found