RS485 help needed for connecting 3 or more Arduino's

I need to use RS485 comms to connect 3 or more Adruino’s that will exchanging messages between all of the Arduino’s. I am not sure of the proper approach for the coding. The messages will be LED sensors reporting to all the other Arduino’s and then the Arduino’s that received the sensor signals will be reporting feddback and other instructions to the originating Arduino.

Any suggestions for coding would be appreciated.


Seeing as all nodes on the RS485 bus share a common differential pair, what is your intended network protocol?

what is your intended network protocol?

My suspicion is there is no plan.. RS485 is usually used in situation where there is 1 master (transmitter) and multiple slave (receptors) and a 1 way street (DMX) or as a query-response system RDM. Anyway the main thing gfvalvo is saying is, with one pair there can be only 1 transmitter at a time. It is actually a single lane of traffic (just looks like double one but that is just to increase the speed-length coefficient.

Probably you’d need the master to periodically poll the sensors. You’d assign the sensors a number (DIP switches, say) and they’d listen to the line for a ping telling them to report in. Not sure how you’d frame the messages - I’m sure there’s plenty of layer-2 protocols to choose from (I think it’s layer 2).

Any reason not to use i2c? It’s still only two wires, and there are libraries for it that support both master and slave mode. I suppose it’s a transmission distance issue - i2c is only short range.

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.,148850.0.html .

How far apart will the Arduino controllers be?
Any particular reason for RS485?
Have you looked at CanBus? link to CanBus Tutorial

Tom... :slight_smile: