0

I purchased multiple Arduino Mini Pros and MAX485 TTL boards and now I'm trying to make them communicate together, but the problem is that I need that everyone can send and receive when needed.

I mean, normally, the "Master" request something and then the right "Client" responds. But in my application everyone's master and everyone can send at anytime to anyone. Is there a library, that synchronizes the Read/Write between those Arduinos, so that when one is sending (at anytime) that the other ones won't send, until the transmission of the Arduino who's sending is over?

If there's no library, could I attach one more pin between all Arduinos that act like a PTT switch? When one want to send, it pulls the pin X high and if some other Arduino want to send, it checks for that high pin: If it's high, it will wait. Could that work too? Or maybe this isn't reliable?

Any suggestion or help are highly appreciated.

  • > everyone's master and everyone can send at anytime to the master... just think about that for a second and ask yourself if that makes sense. – dannyf Mar 6 '17 at 12:15
  • sorry about the redundancy... but I hope you got the point @dannyf :) – Fusseldieb Mar 6 '17 at 12:17
  • I tried to write a helpful answer but failed. Your PTT idea won't work, what happens when multiple devices pull it high at the same time? You do need some sort of co-ordination to prevent collisions, but apart from a central master device I can't think or how you could do it without writing a big protocol library. – Code Gorilla Mar 6 '17 at 13:01
  • I just wrote my own protocol in theory here, it should work. If it works, I'll answer my own question. Basically MODBUS, the only difference is that the client can send something without the Master requesting first. The client sends a request to talk to the line, then the master accepts it and at the same time the other Arduinos will know that they should "shut up" until the master says that the message was received. If the client requests to talk and it fail (the master don't reply accepting it), it will timeout (20-XXms) and try to request again. – Fusseldieb Mar 6 '17 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.