Electronic – Arduino Uno, weird characters sent to COM (SoftwareSerial)


I'm trying to send ASCII characters from Arduino UNO to a computer serial port. I'm using a cable with a male COM connector, attached to the computer's serial port, and three wires (TX, RX and Ground) on the Arduino side.
I used pins 12, 13 and Gnd as shown in the picture:

Arduino and COM interface

And I am running this piece of code to send a string every second on the serial port:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(13, 12); // RX, TX

void setup()  

void loop()
  mySerial.println("Hello world");

But, when I read that port (at the right 9600 speed), instead of "Hello world" I get strange characters instead:

enter image description here

I thought I had set the pin erroneusly, so I swapped RX with TX, but I get a different but still wrong output:

enter image description here

What am I doing wrong?

Best Answer

The Arduino UART produces TTL level signals, that is 5V for high and 0V for low. A PC's RS232 port expects full RS232 voltages which can be -9V to +9V and are inverted.

Either use a TTL level serial adapter (such as those from FTDI) to interface to the PC. Or use a level converter like the MAX232.