RS232 - Arduino Uno

Hello Users,

I am a newbie to Arduino. Last week I got my first Arduino Uno, using the board I want to establish Serial Communication (RS232) between my Arduino and an External Hardware device with SubD9 plug and should communicate using RS232. But I am not successful in doing so.To me it seems that it is not able to find the device.

As if I write something on the serial monitor, I can see my Debug sentence being displayed.

Can anyone among you be kind enough to provide me with some hints like is the code wrong or do I need some extra Hardware to achieve so.

Attached you will find the code I am trying to use.

Thanking you in anticipation.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(0, 1); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  mySerial.println("Hello, world?"); // for Debugging purposes

void loop()
  mySerial.write("idn?"); // Should answer to command "idn?"
  mySerial.println("written"); // for Debugging purposes

Which Arduino did you get? UNO? Did you also get a TTL-RS232 converter?


I got UNO. And I haven’t get TTL-RS232 Converter.

As seen in the attached image, I am providing 12 volt through an external source and TD/RD from UNO

Is TTL-RS232 necessary?



Don’t use software serial on the hardware serial pins; pick two other pins and use those; looking at your sketch, you can just as well use Serial instead of software serial.

If you want to keep the hardware serial port to debug using the serial monitor, use two other pins for software serial as I indicated above.

As mentioned by adwsystems, you need a TTL-RS232 adapter; signal levels are wrong and the signals are inverted (0V / 5V <-> +12V / -12V).

RS-232 is a bi-polar signal using -12 and 12V. The UNO only outputs 0 and 5. Attaching the -12/12V signal direct to the RX pin of the UNO risks damaging it.

The TTL (0-5V) converter to RS-232 is required. Additionally, your end device likely cannot see the 0-5V signals as it wants -12/12. Luckily it should not be damaged by the lower voltage.

Thank you all.

I will get TTL/RS232 Converter and try again.

The following diagram may be helpful to asses what additional hardware components you might require to establish communication between your UNO and a remote computer using Software Serial Port (UART). The diagram also has depicted the detailed (tested) circuital connections of the MAX232 chip which contains built-in 5V/PM10V converter.

1. Power down the UNO Board.
2. Place the MAX232 chip on the breadboard.
3. Complete the circuit around it (MAX232) placing the 1uF capacitors (the polarity must be correct!).
4. Connect 5V and GND of UNO with the corresponding Vcc and GND pins of MAX232. Do not connect the STX and SRX (DPin-6, DPin-7) with the MAX232.

5. Apply power to the UNO.
6. Use DVM and measure DC voltages at Pin-2; the reading should be around +10V (+6V to +10V acceptable). Measure voltage at Pin-6 of the MAX232; the readng should be around -10V (-6V to -10V acceptable).

7. Power down the UNO. Short Pin-12 of MAX 232 with Dpin-6 of UNO. Short Pin-11 of MAX232 with DPin-7 of UNO.
8. Get the RS232 to USB Converter Cable and take the 9-pin side. Now. short the following pins together (difficult job!):
Pin-5 with GND pin of MAX232 and UNO.
Pin-4, 6, 1.
Pin-7, 8.
Pin-2 with Pin-14 of MAX232.
Pin-3 with Pin-13 of MAX232.

9. Connect the USB side of the converter cable with any available USB port of your second computer. (Not the Computer with which your UNO is connected.)

10. Install the device driver of the converter cable and check that the PC has recognised the cable at some COMX port (Virtual COM Port).

Now, your turn to write the communication software! Post your codes so that we can participate in the development.

Good Luck!

BTW: Once you have finished the hardware, you need two software routines for testing the network:
(1) For PC1 rut-1.ino. This program will receive a command/character (say 5) from PC2; the charcater will be shown on Serial Monitor of PC1. This program will also allow you to send command to PC2 via Serial Monitor. Hopefully, you can develop this program. See examples of the IDE.

(2) For PC2, rut-2 program. If you like, you can use this GUI Program of Baud Rate:4800. From this GUI Program, you click on the menu Click to Roll Call; in response, character 5 will appear on the Serial Monitor of PC1. From the Serial Monitor of PC1, you enter 6 (and then click on send button); in response this message (MicroTalk-8085/80c86/8051 is Ready…!) will appear on the Input/Output Box of rut-2 of PC2.