Serial communication

hello experts,
i am doing project with hobby, and need your guidenance

i am working on serial communication (RS485)
1 Mega and 2 Nanos
A & B (RS485) of Nano_1 Serial to A & B (RS485) Mega Serial1
A & B (RS485) of Nano_2 Serial to A & B (RS485) Mega Serial2
all serial communications are fine

now i connected A & B (RS485) of both Nanos into A & B (RS485) Serial1 of Mega
its working and leaving serial2 blank for other use
i am identifying data coming from which Nano, via coding in Mega, no issue

it is OK or it will make problem in future ?
any schematic idea or issue ?

TIA

If you have a question about wiring, post a picture of a hand drawn wiring diagram, with parts, pins and components clearly labeled.

Be sure to include power and ground connections.

Electrically it's not a problem. RS485 is designed to have several devices share the same A & B wires.

However, Nano_1 no longer has exclusive use of the datalink to the Mega, just as Nano_2 no longer has exclusive use of the datalink to the Mega.

You need to develop a way of communicating such that only one of Nano_1, Nano_2 or Mega transmits at any one time. At all other times, each device configures its RS485 interface for receive, as only one device can transmit at any one time otherwise you can/will get corrupted messages.

You could structure your setup such that the Mega sends a query message to each Nano in turn asking for whatever data the Nano may have. This called polling, more specifically a polling message.

If your Nanos send data very infrequently, you could adopt an ad-hoc approach and simply just send the data when needed and utilise an acknowledgement from the Mega to indicate that the message got through. You would need to handle retries if a Nano failed to receive an ACK back.

Describe your setup/project in more detail and I'm sure you will get some useful responses.

3 Likes

Thanx for your kind reply
i do not have any wiring or connection issue
i am sending byte to Nanos from Mega and taking unsigned integer as timer back on trigger
everything is working fine

i am doing a modification
i connected A & B (RS485) of both Nanos into A & B (RS485) Serial1 (only) of Mega

i am asking, whether there will be any issue or not
for long term

What happens when you have a power fail and power restored on any of the devices?

To quote Wikipedia on the subject of RS485:

RS-485 supports inexpensive local networks and multidrop communications links

You should be fine as that's what RS485 is used for.

Your question is best answered with "Google RS485 network".
However, here's a reading assignment:

Some items of note.

  1. many, many RS485 drawings omit one thing - a common reference, "ground", connecting the various devices on the network. Don't forget it.

  2. The very common, dirt cheap RS485-TTL adapters from Amazon and elsewhere have a 120 0hm resistor across the A-B terminals. As it should be, for a two device network. However, when you start adding more devices, you MUST remember to remove those 120 ohm resistors on all but the two end nodes.

  3. Many RS485 sketches out there show the connections "free form", and I've even seen one or two that show it as a "Star" connection. Don't do that. Ensure your nodes are all connected in a straight line, electrically, with any 'T' leg for connection minimized. RS485 is intolerant of free-form connection arrangements.

Agree, an astonishing number of misleading connection diagrams are posted on the web. RS485 is a three-wire connection, which includes the required ground.

Sometimes RS485 communications will work if only the two data wires are connected, which considerably adds to the confusion.

1 Like

Sadly, it's not because the information isn't out there. There are many good reference guides for RS485, from both the 'design' side and the 'product world' side. I believe it's just that those who promulgate poor information either are 'in a hurry', aren't interested in reading design reference material, or are incapable of digesting same.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.