Guys, I need help.
I want to connect several Arduinos with cable. There will be one master and several slaves. The distance between master and slave will be about 30 meters. I know that I can't use I2C, so I will use serial (RX & TX) and an RS485 communication (with MAX 485). Also, the slaves should read and write data to master, and master should read data from all slaves, and it should write data to every slave. The problem is that for example I want to send data to slave no. 2 but I don't want to send it to slave no. 3.
Is it possible to send data from the master to only one of several slaves? In I2C I could use an adress of the device, but I can't do this with RS485... Am I right?
Thanks guys.
I came up with an idea, that I can send data in specified format, for example if the target of the data sent by the master is the device 1 than te data should look like
dev1:data
Then, some logic in the device 1 uC will divide this to "dev1", ":", "data", and check whether the first element equals "dev1" (this will be specified for every device). If so, the data will be used.
Will this solution work?
If it will, will it be efficient? This will take several lines of code...
Depending on the importance of the data it's also common to add various checks and balances to detect errors. For example here's a frame format I'm currently working on
You probably don't need all that but a checksum would be a good idea.
Thanks, I've already done the schematic, now I'm going to write the code. I used the link given by antony1876 to attach some resistors.
Now there is another question. What sort of cable would you use? Is it a good idea to use a simple UTP cable? Should it be shielded or not? Will this cable work for a 200 meter connection?