Simultaneous RS-232 transmission-reception

Hi all,

I am looking for a solution to translate one RS-232 protocol on 9600 baud to another RS-232 protocol on 19200 baud simultaneously

For example:

Port 1 listens on 9600bd and reads a numerical value from that data
Port 2 sends out the same value, but other protocol at 19200bd

My questions are:

  • Which Arduino may be suitable for this? I need it to be as small as possible.
  • If it would not work on one and the same Arduino, can I read the value from Serial1, send it by I²C to another Arduino and then send it out on the Serial1 of the second Arduino?

Or am I missing some other, more elegant solutions? :slight_smile:

Thanks!

“RS-232 protocol”
What protocol are you talking about?

Most Arduinos could do this.

Quote: Port 1 listens on 9600bd and reads a numerical value from that data
Port 2 sends out the same value, but other protocol at 19200bd
unquote.

Why do you care about a numeric value? Why not just send each byte out as soon as it is read?

Paul

Ok my question may use some clarification:

Device 1 sends this telegram over RS232:
<"21">

Device 2 needs to read the temperature value from Device 1 but only understands a telegram when offered in this format:

@temp=21

So I will need to extract the value "21" from the protocol of device 1 and need to send it out in an other protocol (and other baud rate) to Device 2.

Thanks!

Hello ON3WVS

I suggest you read Robin2's excellent tutorial about the basics of using serial ports:

Serial basics

PerryBebbington:
Hello ON3WVS

I suggest you read Robin2's excellent tutorial about the basics of using serial ports:

Serial basics

Hello Perry,

My question is not how the data handling will be done, my question is to find the right hardware for the job. So my questions still stand: What Arduino type would suit the best? What hardware is able to receive data on 9600bd and is able to (almost) simultaneously transmit this message in another format at 19200bd?

Best regards,

My question is not how the data handling will be done, my question is to find the right hardware for the job. So my questions still stand: What Arduino type would suit the best? What hardware is able to receive data on 9600bd and is able to (almost) simultaneously transmit this message in another format at 19200bd?

Any Arduino with at least 2 spare serial ports. Serial port 0 is normally used for the serial monitor, so you need one with at least 3. There is no 'best' for the job, there are ones with enough serial ports and ones that don't have enough serial ports.

Have a look at the product comparison page
Look under the column 'UART'. All serial ports on all Arduinos are capable of the 2 different speeds you want. The software requirement is trivial, well within the capability of any of them.

As long as the transmission direction is fix, output is faster than input, and there exist known gaps in the input, it's possible to buffer a record from the slow input, switch to fast baudrate, output the buffer, then switch back again. Half duplex transmission also offers this solution, if the input direction can be controlled by the Arduino. Then stop input while outputting the buffer.

Also SoftwareSerial may be usable for the slow input, and hardware Serial for the fast output.

No problems at all with multiple UARTs, maybe internal (Mega: 4) or added externally. Dunno about other Arduino supported chips, maybe some ATtiny may have 2 hardware UARTs?

Dear Perry & DrDietrich,

Thank you for your replies. The Arduinos which have > 1 UART are rather big. Could it work if I connect two Arduino Pro Mini's by I²C so that one Pro Mini acts as receiver and the other Pro Mini acts as a sender?

Yes

You are worried about size when you need TWO RS-232 to TTL converters? One for each direction.

Paul

Well, there’s this: SerialMunger | Hackaday.io
I never did build one and test it - I think I couldn’t find my max232s...

Theoretically programmable with drAzzy’s Microcore...
You’ll need flying leads for isp programming...

DrDiettrich:
Also SoftwareSerial may be usable for the slow input, and hardware Serial for the fast output.

I'd be inclined to use hardware Serial for the 9600 baud input and SoftwareSerial for the 19200 baud output even though the latter is a higher bit rate.

My understanding of the SoftwareSerial library code is that it includes a blocking delay of one character transmit period. This delay will be shorter at the higher baud rate. Also the hardware receive will tolerate not being serviced by the processor for up to two character periods without dropping data should the asynchronous serial input coincide with serial transmit.