Multiple MODBUS devices to Arduino

Hello Everyone, Greetings!

I want to use 10 different types of water sensors that communicate over MODBUS. And I wish to connect all of these devices to my Arduino MEGA. I have some queries regarding the connections though:

  1. Do I need to use 10 different RS485 modules to communicate with these sensors or all of these 10 sensors will be connected to one one single RS485 module and that module goes to my Mega?

  2. If I have to connect 10 sensors to my single RS485 module then, how the connection should be? A goes into A and B goes into B? with GND made common?

  3. If I have 10 sensors connected on a single RS485 module then how Mega will know which data belongs to which sensor? In the examples I have seen so far I came across two types of examples the one which uses address speaks in terms of read/write registers and the other one simply reads the data directly on the serial port. Which one I should be using? any direction using links would be really helpful.

Thanks in advance :slight_smile:

Nobody can answer those questions without links to the data sheets of the sensors.

This is a typical RS485 topology

You only need a single RS485 module for the Mega

In order to talk to ten different sensor, the MEGA would have to "address" each device, like talking to ten different person, you have to "call" them by their name, and that particular person responds. The sensors themselves must have some form of addressing configurable.

Thank you for the reply. Your reply made all of my confusion go away!

Can you direct me to which library I should be using, please? There are lot of different libraries out there. I have used the ModbusRTU library in some other project so I'm familiar with it, but it operates on those read/write type of registers and coils

Unfortunately, I can't help you with that as I don't use Arduino libraries for my projects.

1 Like

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