G
G
gmg2017-02-28 13:48:22
Arduino
gmg, 2017-02-28 13:48:22

Arduino how to implement data reception so that they do not mix over RS485?

Good afternoon. I connect 5 arduins via RS485, 1 master, 4 slaves. You need to implement the following. On a single request from the master, for the slaves to send their statuses (on the network). Data is being mixed now. In the future, I plan to make about 30 slaves per master.
What do you advise, maybe rs485 is not suitable for such things at all?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Armenian Radio, 2017-02-28
@gbg

Since February 08, nothing has changed - as before, Modbus drives
"simultaneously" you will not succeed, only one by one.

A
Alexander Skusnov, 2017-03-02
@AlexSku

Simultaneously possible via other networks, e.g. CAN.

V
Vasily F, 2017-03-10
@Vasilii_B2

There is such a thing as addressing! This article https://geektimes.ru/post/282176/#first_unread partially describes your case

B
Borys Latysh, 2019-04-30
@nava2002

I seem to have figured it out.
Modbus is a good solution. Here is a simple listing that helped me a lot.

https://habr.com/ru/post/249043/
You will need a USB-RS485 to communicate with a PC.
Here is the library on which I actually succeeded. The archive contains excellent examples, everything is simple and clear.
https://github.com/smarmengol/Modbus-Master-Slave-...

The idea is this: There is an array, usually 16 cells (but as I understand it, you can make it much larger). In each, you can put a number 2 bytes long.
Addressing such: Master ALWAYS number "0". All the rest are Slaves with addresses from 1 to 247. (i.e. slaves can be made 247 - maximum). Addresses 248-255 - system reserve.
To write to the cells of the array, maybe both the Slave and the Master here you need to make sure that everyone has their own cell.
The initiator of the survey is ALWAYS the Master. Each Slave puts his data in the desired cell and takes the data he needs from another cell. The master, upon request, takes its array from the slave and updates its own (the central array, taking into account new data). So in a circle, the master polls all network participants. Everything works quite slowly (for me).
And you will be happy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question