i'm using arduino uno r3 with rs485 and connect it to another arduino uno r3 with rs485 as master / slave .
i want to make each one become master /sleve , so i can send data from both of it and receive data on both of it is it possiable to do that and whats the code for that
and is it possiable for connect more than two
i'm using arduino uno r3 with rs485 and connect it to another arduino uno r3 with rs485 as master / slave .
i want to connect one or two more arduino and rs458
whats the code i can use it for
Your 2 topics on what is fundamentally the same problem have been merged
A multi master setup like you are suggesting is more difficult to implement as you have to deal with message collisions etc. A much simpler setup involves just 1 master and multiple slaves. The master simply queries each slave as and when it needs to.
so is there any way to make the one arduino master and slave in same time
so i can receive and send data from it
The concept of master and slave are unrelated to the ability to send and receive data.
For example in a master/slave setup, the master can send data to a slave or it can ask a slave for some data. How this is done is down to the protocol that is used over the RS485 link. You could for example send a packet of data from the master to the slave where the 1st byte of the packet is a slave address, the 2nd byte is a packet identifier (or command), bytes 3 to n are the payload.
If you want to ask the slave for some data, then your packet would have a specific command in byte 2 so that maybe 0x01 = send me temperature, 0x02 = read ADC 1 value etc.
Mr mrhareth
Does this sound like something you are trying to do?
Regards,
Josh
Maybe the choice of RS485 is the incorrect choice. What is the motivation to use RS485?
You can consider normal RS232 or you can consider RS422; it depends on the needs. And if you double the number of RS485 converters, you can have full duplex as well.
You can definitely run a RS-485 in a "peer" (all stations share control) network. For example, you can use addresses to define a message path, any station can send a message to another station by indicating its address in the message. The only catch, as mentioned above, is that without master control, two stations might decide to transmit simultaneously. You need to accommodate that somehow. Some systems that work this way, just detect errors caused by the data collision on the bus, and re-transmit until it succeeds.
You're asking if you can have more than two stations - this tells me you haven't done any research before coming here.
no actually not like that
thank you
i have only rs485 .
i think i ll double it
To connect two Uno R3s and have bidirectional communication, you don't need any adapter.
Just use hardware or software serial, and three wires. Serial Input Basics.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.