ModBus RTU Master

Topics about the Hardware of Revolution Pi
Post Reply
zairalm
Posts: 7
Joined: 26 Apr 2024, 14:28

ModBus RTU Master

Post by zairalm »

Good morning,

I hope you can help me with the configuration of my system, almost all of it is working an processing correctly the data, but I still have a problem with a Modbus connection.

My system consists of:

1 RevPi Connect 4 V1.0
2 RevPi AIO V1.5/4
1 RevPi DO V1.5
2 LucidIO modules
2 ModbusRTU Master Adapter V0.0

As I read the LucidIO modules from the RevPi itself (through Python code) they don't appear when I write piTest -d, but they work fine. The result of the previous command is:
Address: 0 module type: 136 (0x88) RevPi Connect 4 V1.0
Module is present
input offset: 291 length: 6
output offset: 297 length: 7

Address: 31 module type: 103 (0x67) RevPi AIO V1.5
Module is present
input offset: 202 length: 20
output offset: 222 length: 4

Address: 30 module type: 98 (0x62) RevPi DO V1.5
Module is present
input offset: 89 length: 70
output offset: 159 length: 18

Address: 29 module type: 103 (0x67) RevPi AIO V1.4
Module is present
input offset: 0 length: 20
output offset: 20 length: 4

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

Address: 65 module type: 24580 (0x6004) ModbusRTU Master Adapter V0.0
Module is present
input offset: 517 length: 101
output offset: 618 length: 73


For the physical configuration, all the RevPi modules are mounted in the same rail, connected between them through the bridges, and then there is a USBhub connected to one of the USB ports of the RevPi Connect 4 ( the other USB entry remains empty)

This USB hub has 4 new entrances, where the following devices are connected:
- LucidIO RTD4
- LucidIO RTD8
- USB to RS485 for Modbus connection with a PowerMeter (3)
- USB to RS485 for Modbus connection with a Heat Pump (4)
*none of them are connected between them, the wires go from each device to the USB hub.

All those devices previously mentioned are configured in PicTory (not the LucidIO), and I can access all the variables from them except to the last Modbus connection (Heat Pump).

For them (3)(4), I have configured two Modbus RTU Master (address 64 and 65 in the piTest -d command, shown before). To simplify I have change the name of the devices connected and now they are called /dev/PowerMeter and /dev/HP.

So, the first (64) Modbus RTU Master is linked with the /dev/PowerMeter, all the parameters configured, and inside the Extended Data it is defined that the Slave Addr. is 1. No problem at all with this one! I can read and send whatever I want.
Then I have the other (65) Modbus RTU Master, linked with /dev/HP. In this one I'm sure all the parameters are ok 'cause I have configured them in the slave:
Address: 002 Bound 9600, Parity Even, databits 8, stopbit 1 and inside the Extended Data I have tried various ways of writing the data:

opc 1: Action ID 1 Slave Addr. 2 Function Code READ_INPUT_REGISTERS Register Addr. 30009 Quantity of registers 1...

opc 2: Action ID 1 Slave Addr. 2 Function Code READ_INPUT_REGISTERS Register Addr. 8 Quantity of registers 1...

opc 3: Action ID 1 Slave Addr. 1 Function Code READ_INPUT_REGISTERS Register Addr. 30009 Quantity of registers 1...

But I can't read anything, I don't get any error, but I can't access any of the variables that I configured, and they have been read before with other system, so I think I have done something wrong in this configuration. Maybe the way to establish the slaves is different, I'm kind of lost with the error, I would really appreciate any help you can provide.

Thank you in advance.

Regards,

Zaira
User avatar
dirk
KUNBUS
Posts: 2174
Joined: 15 Dec 2016, 13:19

Re: ModBus RTU Master

Post by dirk »

Hello Zaira and welcome to the Revolutio Pi community! Thank you for your detailed picture of your setup and the error, that's great. Your hardware is challenging though. At the moment I think it makes sense to dismantle your setup and get it to a state that works.
In general, you can get everything up and running with a USB-RS485 adapter < $10 and free software.
You can see this clearly in the video tutorial with the RFC reader:
Tutorial 21 – Modbus RTU Master

Here are some similar instructions in that post i.e. the debugging options that you can use with the Modbus status registers:
viewtopic.php?p=15568#p15568
Post Reply