RS485 Master and Slave using Modbus

Mike Dale's picture

Offline

Joined: Oct 09, 2020

Replies: 3
RS485 Master and Slave using Modbus
October 9, 2020 - 1:54am

I am trying to find a simple example of using Modbus to link several Arduino Boards, simply sending digital and analogue signals from the Master to each Slave.  Modbus seems overkill but the application involves large distances outdoor lighting.  I have worked through the tutorials:

Long Distance Wired Serial Communication with Arduino using RS485 and CAT Cables

I have made this work but this only works for one Slave

RS-485 MODBUS Serial Communication using Arduino UNO as Slave

RS-485 MODBUS Serial Communication with Arduino as Master

Both of these involve a link to a computer and I can't work out how to adapt them to Arduino to Arduino.

Any assistance will be gratefully received

 

PS.  The tutorials are very good with full detail.

Mike

Debashis Das's picture

Offline

Joined: Dec 02, 2019

Replies: 97
Hi Mike
October 9, 2020 - 8:50am

You can google for long-distance serial communication between two or more Arduino boards, I think it will redirect you to the sollution that you are looking for.

Mike Dale's picture

Offline

Joined: Oct 09, 2020

Replies: 3
Long distance communication between two or more Arduinos
October 13, 2020 - 3:24pm

Hi Debashis

i appreciate your response.  I have tried this and all the responses I can find illustrate for two only.  I do not understand how to do this for more than one slave.  Any ideas?

regards

mike

Sourav Gupta's picture

Offline

Joined: Feb 12, 2018

Replies: 308
Hiii
October 9, 2020 - 12:05pm

Use two RS485 module in two different arduinos. Make one slave and other one as master. It will work.

Mike Dale's picture

Offline

Joined: Oct 09, 2020

Replies: 3
Long distance communication between more than two Arduinos
October 13, 2020 - 3:26pm

Hi Sourav

i appreciate your response.  I agree it works for master and one slave but I do not understand how to do this for more than one slave.  Any ideas?

regards

Mike

Sourav Gupta's picture

Offline

Joined: Feb 12, 2018

Replies: 308
Hiii
October 13, 2020 - 4:28pm

For multiple slaves, you need slave adresses unique for each slaves and by using the slave address you could communicate with each of them one by one. Hope this help.

Mike Dale's picture

Offline

Joined: Oct 09, 2020

Replies: 3
RS485 communication with multiple slaves
October 14, 2020 - 6:54pm

Hi Sourav
Thanks for the response. I am sure you are correct. The trouble is I do not know how to code that!

Regards
Mike.