RS-485 communication on multiple Arduino boards

Hi all,

I have an architecture (see attached picture) including a Master (Arduino Uno) and Clients (Arduino Mega) connected by RS-485 using RS-485 to TTL adapter.

The Clients suppose to send data to the Master. I have the following questions:

  1. How many Clients can be connected to the Master? I guess the quantity is limited by RS-485 topology and it is 32. Is this correct?
  2. What library shall I use for communication?
  3. Can the Clients send data to Master simultaneously, or only one Client can communicate at a time?

I'll appreciate if anyone can answer my questions.

Thanks in advance.

32 clients max on RS485 communication bus.

Typically, RS485 is HALF-DUPLEX across a shared single pair of twisted wires (A+B). All devices are simply connected to the same pair of wires. Therefore only ONE device can TRANSMIT at a time... and all the other devices must be listening (receiving).

There can be no simultaneous communications... otherwise the 2 transmitters would fight each other on the shared wires and no data would be correctly received by any device.

Basics-of-the-RS-485-Standard.pdf (222 KB)

  1. Most modern 485 transceiver chips are 1/8 UL (Unit Load), therefore they allow up to 256 on a bus.
  2. One of the guys here has a tutorial (maybe even a library), but I can't remember who right now.
  3. No, one at a time.

look here for a good protocol implementation...I use it. but I like the mudbus TCP for Ethernet more.
https://forum.arduino.cc/index.php?topic=176142.0

for simple modbus....
ONE arduino rs485 master....with sketch..
#include <SimpleModbusMaster.h>

and several arduinos with Slaves to report to the master
#include <SimpleModbusSlave.h>

also a master implementation here...

or
http://playground.arduino.cc/Code/ModbusMaster

actually address 0 is reserved for broadcast writes. VALID slave addresses are 0-247. Repeaters can extend the network to multiple 32 node segments.

oops i meant VALID slave addresses are 1-247

You dont use a special library for it. You can just use Serial.write() and Serial.print() for the communication

Grazie per le buone risposte, utile.
defraggler alternative