Bidirectional communication from RS-232 to half-duplex RS-485 using arduino nano

Hello Mark,

Thank you for the reply and let me try to explain things little better.

This device would be stand alone passing data between 2 devices so there would not be need to connect example PC to HW serial port, ofcourse it would be nice have that connection during softaware development.

I was planning to use HW serial port, so what I mean with connect and disconnect was to use digital switch to connect only one tranceiver at any given time to HW serial port, like below:

  1. receive command from RS-232 -> connect rs-232 tranceiver to HW serial port and disconnect RS-485 tranceiver from HW serial port.
  2. send command to RS-485 -> connect rs-485 tranceiver to HW serial port and disconnect RS-232 tranceiver from HW serial port.
  3. receive response from RS-485 -> connect rs-485 tranceiver to HW serial port and disconnect RS-232 tranceiver from HW serial port.
  4. send response to RS-232 -> connect rs-232 tranceiver to HW serial port and disconnect RS-485 tranceiver from HW serial port.

After RS-232 device has sent command it will wait for reply or time out before sending new command so there is no need to worry about timing or syncronization

Baud rate will be quite slow probably 9600 and 38400 max, so it probably will better idea to use that SW serial port method, that way there is no need to switch between tranceivers.