Send data via serial port to the PC [Solved]

Hello I have an Arduino MEGA and I am trying to send data from arduino to the pc.

Connect the serial port to pins 18 and 19 of arduino.

I set the baud rate in the setup, also I tried 9600

  Serial1.begin(115200);

And then I print well:

 Serial1.print ("hello");

The thing is I read the output on my linux terminal, running the following command:

 screen / dev / ttyUSB0 115200

And the output is (repeated many times because it is in a loop):

):�):�):�):�):�)�):�):�):�):�):�):�):�):)

I'm also trying to configure it with minicom and different parameters but nothing.

Hi.

I use linux too.

try this:

Serial.begin(38400); // slow down to 38400

...

Serial.println ("Hello");

Test on linux shell :

stty -F /dev/ttSXX 38400

cat /dev/ttSXX

I'm connecting the Tx and Rx ports arduino to the PC with TTL
Is that possible? :roll_eyes:

olimpo88:
Hello I have an Arduino MEGA and I am trying to send data from arduino to the pc.

Connect the serial port to pins 18 and 19 of arduino.

Hi.

On my mini-pro and uno I always use pin 0 an 1 ( digital ). Try it.
And you could again test with 115200 ( I got issue at this speed, but some times work fine )

No :neutral_face:
With port 0 and 1
And 115200

You arduino connected directly to the PC without TTL converter?

olimpo88:
You arduino connected directly to the PC without TTL converter?

internal RS232 port ( desktop ) <---> ttl converter ( old siemens adapter or max232 home-made based adaptor, )<---> arduino.

usb laptop <----> old nokia usb-to-ttl adapter <---> arduino

Always work fine on pin 0-1, at 9600 to 38400.

Are your usb to serial adapter ttl level or rs232 ?

I don't think anyone has mentioned that you need a GND connection as well as Rx and Tx.

If (as is likely) the PC serial port uses proper RS232 voltage levels you must convert them to TTL voltage levels or you will damage your Arduino.

...R

Hi

Did you connect GND from the converter to any GND pin on your arduino ?

I have a serial to usb adapter, but I'm not sure if it's a converter TTL.
Inside is electronic.
The GND es connect.

olimpo88:
I have a serial to usb adapter, but I'm not sure if it's a converter TTL.
Inside is electronic.
The GND es connect.

A serial to USB connector is completely inappropriate. That is for connecting a PC with a USB port to an accessory that needs a serial connection. USB works at a a very high speed that is quite incompatible with the Arduino pins.

What you need is Rs232 to TTL

...R

Hi

on ebay less than 2 usd.

Search for " usb to ttl "

like this one:

I use one very similar to send code to my arduino-pro:

Just connect TX RX GND on arduino pin.

arssant:
Search for " usb to ttl "

I may be wrong, but I don't think this is what the OP needs.

I think his PC has a genuine original serial port which he wants to use with an Arduino.

...R

Robin2:
I may be wrong, but I don't think this is what the OP needs.

I think his PC has a genuine original serial port which he wants to use with an Arduino.

...R

From the OP:

"screen / dev / ttyUSB0 115200
I have a serial to usb adapter, but I'm not sure if it's a converter TTL"

So is listening usbserial port on linux. And got a serial to usb.

But... on the second screen-shoot is listening /dev/ttyS0 that is a typical-genuine serial rs232.

I´m confused too.

So if his computer have rs232 port( usually DB-9 ), he need a serial232 to ttl converter.
If no rs232 ( DB-9), he need a usb to ttl adapter.

olimpo88:
Hello I have an Arduino MEGA and I am trying to send data from arduino to the pc.

Why don't you just send it over the USB cable to a standard terminal programme like RealTerm?

Such a radical move would lessen the chances of a line like

Serial1.begin(115200);

being the kiss of death.

I recognise that you are using Linux, but that should surely not make a difference.

arssant:
From the OP:

"screen / dev / ttyUSB0 115200
I have a serial to usb adapter, but I'm not sure if it's a converter TTL"

I understand where you are coming from. However when I quoted Reply #8 I discovered it had a link to this image which informed my response. I've just realized the image is not generally visible.

However the whol thing is very uncertain.

...R

Robin2:
I've just realized the image is not generally visible.

However the whol thing is very uncertain.

...R

Hi.

Your write, on my firefox cant see any picture/any broken link for this image, but over opera mobile I can see now a broken link.
I'm pretty sure his adapter is a usb to serial one ( not with ttl level ) I use one very similar to connect my laptop to some serial devices ), and he used a old mouse cable to get it connected to arduino TX-RX-gnd.
So, you are write too, when you say "What you need is Rs232 to TTL " if he have a genuine serial port on his computer ( I think he have: his print-screen. HP-COMPAQ-6000 pro.. a desktop computer with one serial port. any max232 or max3232 based adapter will work fine. Or as I say, less than 2usd: ebay usb-to-ttl adapter.

I already did this converter circuit:

Just replace the BC337 by other NPN transistor the BC545

But I keep going the same

Hi

Lest restart all stuff:

Your are using linux box with your arduino, Arduino Software running on linux to program the arduino.

Your linux computer have a DB9, serial port ? I saw some pics of hp-9000 pro, and it's look like.
if yes check on the BIOS computer if is activated.
check on linux, name of it: /dev/ttSXX
get rid of this chinese usb to serial adapter, and connect this ttl converter that you build directly to that BD9 port on your computer.

try again: " cat /dev/ttSXXX "

Still not working, get a usb-to-ttl adapter. Or an old nokia-siemens serial data cable and connect it to your DB9 serial computer port. Even a cheap based max232 rs232 to ttl converter will work.

Remember: arduino TX connected to RX on ttl converter, and RX on arduino to TX converter ttl. GND are GND. or even a cheap based max232 rs232 to ttl converter.

Connect the converter output to the serial port of the PC without ttyS0 and now works (without cable converter usb)

thx