RevPi Connect SE and Modbus RTU

Topics about the Hardware of Revolution Pi
Post Reply
frodes-bre
Posts: 6
Joined: 19 May 2023, 08:06
Answers: 0

RevPi Connect SE and Modbus RTU

Post by frodes-bre »

Hello,
I'm trying to connect a weather station to my RevPi Connect SE via Modbus RTU.
I'm a bit confused when following this guide:
https://revolutionpi.com/tutorials/modb ... rtu-master
On the picture in this, there is a Revpi Core. Do I still need to add the virtual device on the RevPi Connect? (As it have a connection built in for rs485? )
I've tried to add it like in the documentation, opened extended data and added:
Slave addr. 1, read holding register, register address 40001, quantity 40, interval 1000, device value Input_Word_1
Here is the output from piTest -d:
piTest -d
Found 2 devices:

Address: 0 module type: 105 (0x69) RevPi Connect V1.0
Module is present
input offset: 0 length: 6
output offset: 6 length: 5

Address: 64 module type: 24580 (0x6004) ModbusRTU Master Adapter V0.0
Module is present
input offset: 11 length: 101
output offset: 112 length: 73

And here is the output from piTest -1 -q- r Input_Word_1:
piTest -1 -q -r Input_Word_1
0

It doesn't look quite right?

Also, I would rather use Node-RED and the node-red-contrib-modbus node to collect my Modbus data. Should I do anything with regards to activation of Modbus Master in services on the RevPi web page and in Pictory then, or should all those settings be disabled when using Node-RED directly?

- frodes-bre
User avatar
dirk
KUNBUS
Posts: 1948
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: RevPi Connect SE and Modbus RTU

Post by dirk »

Hi frodes-bre, there you have all the necessary steps to get a Modbus RTU server up and running - bravo.

Please follow the steps of the RS485 checklist for the commissioning of the RS485 interface
https://kunbus-gmbh.atlassian.net/servi ... 2463268865

Thanks for the hint with the wrong picture in the documentation. That helps us to get better here.

Take a look at the following documents for commissioning the Modbus-RTU interface

https://kunbus-gmbh.atlassian.net/servi ... 1782681492
https://revolutionpi.com/tutorials/modb ... r-turorial

Especially the following registers are your friends in troubleshooting
  • Modbus_Master_Status
  • Master_Status_Reset
  • Modbus_Action_Status_[1 … 32]
  • Action_Status_Reset_[1 … 32]
frodes-bre
Posts: 6
Joined: 19 May 2023, 08:06
Answers: 0

Re: RevPi Connect SE and Modbus RTU

Post by frodes-bre »

Hi dirk,

Thanks!

Will the values of the Modbus_Master_Status and those be visible directly in the web page in Pictory?

I've also tried a second Modbus device, but I am not able to get values from that either.
Here is the output from the modbus-master log:
Sep 08 09:17:43 RevPi81183 systemd[1]: Started Revolution Pi Modbus master.
Sep 08 09:17:43 RevPi81183 piModbusMaster[3816]: piModbusMaster started
Sep 08 09:17:43 RevPi81183 piModbusMaster[3816]: No modbus master configuration found in config file
Sep 08 09:19:31 RevPi81183 piModbusMaster[3816]: RTU Master got serial device:/dev/ttyRS485
Sep 08 09:19:31 RevPi81183 piModbusMaster[3816]: modbus rtu action timeout: 0 s 500000 us
Sep 08 09:19:31 RevPi81183 piModbusMaster[3816]: modbus rtu minimal time between telegrams: 0 s 250000 us
Sep 08 09:19:34 RevPi81183 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/110/-112345568
Sep 08 09:19:35 RevPi81183 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/110/-112345568
Sep 08 09:19:36 RevPi81183 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/110/-112345568
Sep 08 09:19:37 RevPi81183 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/110/-112345568
Sep 08 09:19:39 RevPi81183 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/110/-112345568
Sep 08 09:19:40 RevPi81183 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/110/-112345568
Sep 08 09:19:41 RevPi81183 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/110/-112345568

With regards to the Node-RED question; Will I have to remove the Modbus device in Pictory and disable the Modbus Master service if I were to try to connect to the Modbus device via Modbus nodes in Node-RED?

Thanks again!

- frodes-bre
User avatar
dirk
KUNBUS
Posts: 1948
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: RevPi Connect SE and Modbus RTU

Post by dirk »

Hi frodes-bre,
> Will the values of the Modbus_Master_Status and those be visible directly in the web page in Pictory?
No, unfortunately not. Take a look at the wonderful functions of the RevPiCommander:
https://revpimodio.org/quellen/revpicommander/

Okay so you have examined the log which is great. So here you can see that the action leads to a failed communication:
> Sep 08 09:19:41 RevPi81183 piModbusMaster[3816]: modbus rtu action device: /dev/ttyRS485, slave address: 1 function: 0x03, address: 1 failed -1/110/-112345568

But what could be the reason? The wiring, the communication parameters, etc.

>With regards to the Node-RED question; Will I have to remove the Modbus device in Pictory and disable the Modbus Master service if I were to try to connect to the Modbus device via Modbus nodes in Node-RED?
Yes, sorry I skipped that question in your first post. That is precisely what you have to do. You have to protect the RS485 bus from being used by more than one application.

The easiest way to commission Modbus-RTU is, in my opinion, just via qModMaster and a USB-RS485 dongle. Take a look at video tutorial #21 Modbus RTU Master
https://revolutionpi.com/tutorials/video-tutorials#VT21
The qModMaster software can give you an immediate feedback and, furthermore, can produce some debugging output what's on the line.

The best way is - use an oscilloscope or a logic analyzer and take a look at the bits on the RS485 bus.

Good luck
frodes-bre
Posts: 6
Joined: 19 May 2023, 08:06
Answers: 0

Re: RevPi Connect SE and Modbus RTU

Post by frodes-bre »

Hi dirk,
Thanks again!
You've confirmed that my thinking was correct. Will try the qModmaster and see if it can help with the debugging.

- frodes-bre
User avatar
dirk
KUNBUS
Posts: 1948
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: RevPi Connect SE and Modbus RTU

Post by dirk »

Hi frodes-bre, thank you for your positive feedback
Post Reply