Debugging - node-red-contrib-modbus - serial RTU

In you first post

image

but from the log you see that its trying to connect to default id 1

Can you set id 60 .. if its is id 60 .. in the modbus config also ? image

from your screenshots you seem to be reading address 35 but the voltage is in address 36

Well thats progress - you now have node-red running with the modbus node in debug.

Essentially that command you were giving it was starting a 2nd copy of NR - you are now past that.

Not sure what other flows you have as it talks at fsm in there (Finite State Machine) - which may be part of the Modbus node - not sure

It seems to try to start in 9600bps - not sure if that is then getting in the way

I do not have time to go through the whole log now - on the way out.

SUggest you have a look for another modbus node and give that a try and see if you have any more success

I will try and get back to this tonight

Craig

Thank you so much for your help until now. I really appreciate!

It seems that the 9600 come from an other Modbus-server setup, but not in use: Serial_9600_8_E_1
The nodes where this is assigned are disabled.

:frowning_face: :thinking: :zipper_mouth_face: As I am new here in this forum,
:frowning_face: :thinking: :zipper_mouth_face: I have reached my maximum number of replies
:frowning_face: :thinking: :zipper_mouth_face: and have to wait for 21 hours!
:frowning_face: :thinking: :zipper_mouth_face: ...before beeing able to write again!
:frowning_face: :thinking: :zipper_mouth_face: Sorry for the delay!
:grinning:

Therefore I add here what I can:

I believe this is coming from the default server id:

If you do not specify here, it says 1. I made it 20:

  contribModbus:core:client Client -> stop fsm on close 5c2c3186.30196 Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 20 +1ms
  contribModbus:core:client Client -> stopped Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 20 +1ms
11 Feb 00:12:37 - [warn] [modbus-client:5c2c3186.30196] Client -> stopped state without reconnecting Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 20
11 Feb 00:12:37 - [warn] [modbus-read:a16a70db.ede3f] Client -> resetIntervalToRead node a16a70db.ede3fundefined
  contribModbus:core:client Client -> close node 5c2c3186.30196 Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 20 +5ms
  contribModbus:config:client close node 5c2c3186.30196 +8ms
11 Feb 00:12:37 - [warn] [modbus-read:a16a70db.ede3f] Client -> close node a16a70db.ede3fundefined
  contribModbus:core:client Client -> Connection closed well 5c2c3186.30196 Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 20 +8ms

The Unit-Id of the Reading Node is still 60. The address is 35 as it starts counting with 0. Strange, but this is the way it is handled in the Modbus-protocol. Always take the address you want minus 1. :slight_smile:

I deleted all other flows and the 9600-server, only having one server (19200) left. Now only having one flow with two nodes (Modbus Read & Debug node):

~ $ systemctl stop nodered
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to stop 'nodered.service'.
Authenticating as: ,,, (pi)
Password:
==== AUTHENTICATION COMPLETE ===
pi@HeatingPi:~ $ DEBUG=contribModbus* node-red -v
11 Feb 00:50:06 - [info]

Welcome to Node-RED
===================

11 Feb 00:50:06 - [info] Node-RED version: v1.2.9
11 Feb 00:50:06 - [info] Node.js  version: v12.20.1
11 Feb 00:50:06 - [info] Linux 5.10.11-v7+ arm LE
11 Feb 00:50:08 - [info] Loading palette nodes
11 Feb 00:50:13 - [info] Dashboard version 2.27.0 started at /ui
11 Feb 00:50:14 - [info] Settings file  : /home/pi/.node-red/settings.js
11 Feb 00:50:14 - [info] Context store  : 'default' [module=memory]
11 Feb 00:50:14 - [info] User directory : /home/pi/.node-red
11 Feb 00:50:14 - [warn] Projects disabled : editorTheme.projects.enabled=false
11 Feb 00:50:14 - [info] Flows file     : /home/pi/.node-red/flows_HeatingPi.jso                                                                                                                                                             n
11 Feb 00:50:14 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

11 Feb 00:50:14 - [info] Starting flows
  contribModbus:queue:core queue serial lock command node undefined +0ms
  contribModbus:core:client Client -> new +0ms
  contribModbus:core:client Client -> initialized +2ms
11 Feb 00:50:14 - [info] Started flows
11 Feb 00:50:14 - [info] Server now running at http://127.0.0.1:1880/
11 Feb 00:50:31 - [info] Stopping flows
  contribModbus:core:client Client -> stop fsm on close 5c2c3186.30196 +17s
  contribModbus:core:client Client -> stopped +4ms
11 Feb 00:50:31 - [warn] [modbus-client:5c2c3186.30196] Client -> stopped state without reconnecting
  contribModbus:core:client Client -> close node 5c2c3186.30196 +5ms
  contribModbus:config:client close node 5c2c3186.30196 +0ms
  contribModbus:core:client Client -> Connection closed simple 5c2c3186.30196 +2ms
11 Feb 00:50:31 - [info] Stopped flows
11 Feb 00:50:31 - [info] Starting flows
  contribModbus:queue:core queue serial lock command node undefined +17s
  contribModbus:core:client Client -> new +24ms
  contribModbus:core:client Client -> initialized +1ms
11 Feb 00:50:31 - [warn] [modbus-read:a16a70db.ede3f] Client -> open node a16a70db.ede3fundefined
  contribModbus:core:client Client -> new +14ms
  contribModbus:core:client Client -> init +1ms
11 Feb 00:50:31 - [warn] [modbus-client:5c2c3186.30196] Client -> fsm init state after new
11 Feb 00:50:31 - [warn] [modbus-client:5c2c3186.30196] Client -> first fsm init in 500 ms Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1
11 Feb 00:50:31 - [info] Started flows
  contribModbus:core:client Client -> RTU buffered port serial Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +508ms
  contribModbus:core:client Client -> opened Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +23ms
  contribModbus:queue:core queue serial unlock command node undefined +549ms
  contribModbus:core:client Client -> time to open Unit 1 Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +1s
  contribModbus:core:client Client -> connected Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +2ms
11 Feb 00:50:33 - [warn] [modbus-client:5c2c3186.30196] Client -> fsm connected after state opened Get More About It By Logging Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1
  contribModbus:queue:core queue serial unlock command node undefined +1s
11 Feb 00:50:33 - [warn] [modbus-read:a16a70db.ede3f] Client -> startIntervalReading node a16a70db.ede3fundefined
  contribModbus:core:client Client -> connected Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +10s
  contribModbus:queue:core queue serial unlock command node undefined +13s
  contribModbus:queue:core queue serial unlock command node undefined +3ms
  contribModbus:core:client Client -> failed Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +3s
11 Feb 00:50:46 - [warn] [modbus-client:5c2c3186.30196] Client -> fsm failed state after connected Get More About It By Logging Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1
11 Feb 00:50:46 - [warn] [modbus-read:a16a70db.ede3f] Modbus Failure On State connected Get More About It By Logging
  contribModbus:core:client Client -> broken Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +6ms
11 Feb 00:50:46 - [warn] [modbus-client:5c2c3186.30196] Client -> fsm broken state after failed Get More About It By Logging Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1
  contribModbus:core:client Client -> activated Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +4ms
  contribModbus:read Timed out +0ms
11 Feb 00:50:46 - [error] [modbus-read:a16a70db.ede3f] Timed out
  contribModbus:core:client Client -> activated Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +18ms
  contribModbus:core:client Client -> reading Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +7s
  contribModbus:queue:core queue serial unlock command node undefined +10s
  contribModbus:queue:core queue serial unlock command node undefined +1ms
  contribModbus:core:client Client -> failed Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +3s
11 Feb 00:50:56 - [warn] [modbus-client:5c2c3186.30196] Client -> fsm failed state after reading Get More About It By Logging Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1
11 Feb 00:50:56 - [warn] [modbus-read:a16a70db.ede3f] Modbus Failure On State reading Get More About It By Logging
  contribModbus:core:client Client -> broken Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +4ms
11 Feb 00:50:56 - [warn] [modbus-client:5c2c3186.30196] Client -> fsm broken state after failed Get More About It By Logging Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1
  contribModbus:core:client Client -> activated Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +4ms
  contribModbus:read Timed out +10s
11 Feb 00:50:56 - [error] [modbus-read:a16a70db.ede3f] Timed out
  contribModbus:core:client Client -> activated Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +5ms
  contribModbus:core:client Client -> reading Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +7s
  contribModbus:queue:core queue serial unlock command node undefined +10s
  contribModbus:queue:core queue serial unlock command node undefined +2ms
  contribModbus:core:client Client -> failed Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +3s
11 Feb 00:51:06 - [warn] [modbus-client:5c2c3186.30196] Client -> fsm failed state after reading Get More About It By Logging Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1
11 Feb 00:51:06 - [warn] [modbus-read:a16a70db.ede3f] Modbus Failure On State reading Get More About It By Logging
  contribModbus:core:client Client -> broken Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +4ms
11 Feb 00:51:06 - [warn] [modbus-client:5c2c3186.30196] Client -> fsm broken state after failed Get More About It By Logging Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1
  contribModbus:core:client Client -> activated Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +3ms
  contribModbus:read Timed out +10s
11 Feb 00:51:06 - [error] [modbus-read:a16a70db.ede3f] Timed out
  contribModbus:core:client Client -> activated Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +5ms
  contribModbus:core:client Client -> reading Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +7s
^C11 Feb 00:51:13 - [info] Stopping flows
  contribModbus:core:client Client -> stop fsm on close 5c2c3186.30196 Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +591ms
  contribModbus:core:client Client -> stopped Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +2ms
11 Feb 00:51:13 - [warn] [modbus-client:5c2c3186.30196] Client -> stopped state without reconnecting Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1
11 Feb 00:51:13 - [warn] [modbus-read:a16a70db.ede3f] Client -> resetIntervalToRead node a16a70db.ede3fundefined
  contribModbus:core:client Client -> close node 5c2c3186.30196 Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +4ms
  contribModbus:config:client close node 5c2c3186.30196 +42s
11 Feb 00:51:13 - [warn] [modbus-read:a16a70db.ede3f] Client -> close node a16a70db.ede3fundefined
  contribModbus:core:client Client -> Connection closed well 5c2c3186.30196 Serial@/dev/ttyUSB0:19200bit/s default Unit-Id: 1 +26ms

If the modbus server is not in use .. can you delete its node instead of disabling it in case its conflicting with the Read node and keeping the serial connection open ? and restart node-red

Indeed that is true in some cases .. it depends on the manufacturer

OK - i think you need to start with a clean slate - delete all your nodes and defined modbus and servers from those nodes and then step through it again.

Once that is done then reboot the unit and post up the NR logs and the system logs

Craig

Now I believe there is something wrong with the RS485 bus. I can’t get a stable connection with the PC anymore. I think I have to check with an oscilloscope, which I do not have. The voltage between A & B is around 0.6 Volt and should be around 0.9 V, if I understood right. When I check the unconnected bus of the energy meter it has around 2.8 V. Do you have any an ideas?

This is totally strange. I used twisted pair and the length is only 50 cm. I used without termination. When I terminate with two times 120 Ohm on both ends, I have no voltage left on the bus left.

Thank you for your help. It seems the energy meter hung up. After power off of the device it is working again. I hope it stay like that. So in the long end it was a hardware issue and no problem with Node-RED or the Modbus-nodes. Sorry and thanks again!

1 Like

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