USB to serial and Arduino

Hi Guys,

I'd like to connect a usb to serial cable (converter actually) to tx/rx pin of my arduino.
Usb on one end, DB9 male on the other end.

Since I can not attach dupont wires to my db9 end (pins too close, too big...), I connected a DB9 female to it with loose wires at the end of it.

My problem is that I cannot identify wires.
I believe I found 4 wires to be active.
when I connect them by pairs i get either 6v for some pairs, 13v for some other pairs, and 0v.
My voltmeter could be a bit off I guess and these are probably 5v and 12v.
I can identify which one is positive voltage and which one is negative voltage.

Would you know a way to clearly identify which are TX, RX or GND?
Is 5v ok on my arduino : no risk to fry it?

Regards,
Erwan

Search google for "db9 serial pin out".

For 9 pin RS232, pin 2 is Rx, pin 3 is Tx and pin 5 is gnd.

If this cable converts USB to serial, and you want to attach the serial output to your Arduino, you will damage it. The Arduino is not compatible with either the voltages on RS232, nor is it compatible with the signal polarity.

Do you not have access to normal USB cable?

Yep I found that.
But once I connect my db9 female to use the loose wires at the end of it, no more way to identify wires.

Thx.
Erwan

BillO:
For 9 pin RS232, pin 2 is Rx, pin 3 is Tx and pin 5 is gnd.

If this cable converts USB to serial, and you want to attach the serial output to your Arduino, you will damage it. The Arduino is not compatible with either the voltages on RS232, nor is it compatible with the signal polarity.

Do you not have access to normal USB cable?

the 5v voltage wont do it you mean?
what do you mean with the polarity? tx + gnd wire should give me 5v, same for rx + gnd not? and i thouht that then the rx or tx should be my positive wire and gnd my negative wire? or am I completely wrong?

Thx,
Erwan

erwanl:

[quote author=James C4S link=topic=151227.msg1135511#msg1135511 date=1361978402]
Search google for "db9 serial pin out".

Yep I found that.
But once I connect my db9 female to use the loose wires at the end of it, no more way to identify wires.

Thx.
Erwan
[/quote]

Did you not use different color wire for each pin?

erwanl:
the 5v voltage wont do it you mean?
what do you mean with the polarity? tx + gnd wire should give me 5v, same for rx + gnd not? and i thouht that then the rx or tx should be my positive wire and gnd my negative wire? or am I completely wrong?

Thx,
Erwan

RS232 signals are not normally 0V to 5V, they usually range from -10 to 10 (or more). Also, what I mean by polarity is that RS232 uses a -negative or low voltage to represent a '1' and a high positive voltage to represent a '0'. The Arduino will expect 0V for '0' and between 3.5V-5V for '1'.

BillO:

erwanl:

[quote author=James C4S link=topic=151227.msg1135511#msg1135511 date=1361978402]
Search google for "db9 serial pin out".

Yep I found that.
But once I connect my db9 female to use the loose wires at the end of it, no more way to identify wires.

Thx.
Erwan

Did you not use different color wire for each pin?
[/quote]

it does pc->usb->db9 male->db9 female->cut cable exposing lose wires , hence me not being to identify wires at this end

BillO:

erwanl:
the 5v voltage wont do it you mean?
what do you mean with the polarity? tx + gnd wire should give me 5v, same for rx + gnd not? and i thouht that then the rx or tx should be my positive wire and gnd my negative wire? or am I completely wrong?

Thx,
Erwan

RS232 signals are not normally 0V to 5V, they usually range from -10 to 10 (or more). Also, what I mean by polarity is that RS232 uses a -negative or low voltage to represent a '1' and a high positive voltage to represent a '0'. The Arduino will expect 0V for '0' and between 3.5V-5V for '1'.

oki indeed it seems my converter is RS232, not TTL (http://www.rakuten.com/prod/belkin-f5u257-usb-to-serial-cable-adapter-serial-usb-serial/222544783.html).
this converter uses a prolific 2303 chipset. (googling around, ttl is mentionned thus with this chipset).
I was misled by the fact I could measure around 6v on some pairs.

thanks for pointing me back to the right direction !

I intend to experiment some projects around serial in the coming days and i was not started it right :slight_smile:

/erwan

erwanl:
Yep I found that.
But once I connect my db9 female to use the loose wires at the end of it, no more way to identify wires.

Use your multimeter as an ohmmeter and map out each wire on the female cable.

was indeed the best way to identify my wires...
i now have identified DTR/PIN4, RXD/PIN2, GND/PIN5, TXD/PIN3.

about voltages
dtr+txd=13v
dtr+rxd=6v
dtr+gnd=6v
this above is wierd? not sure dtr is of any use to me anyway...

rxd+txd=0v : normal behavior i assume ?
gnd+rxd=0v : is this normal behavior? rx is low by default?
gnd+txd=6v : normal behavior i assume? tx is high by default?

now question how can i assert for sure whether this is rs232 or ttl?
6.x volts seems too high to be ttl and defo too high for my arduino.

Erwan

That cable is almost certainly RS232 as that is what it is sold for. It seems funny that DTR is 13V while RX and TX are 6V. All signals are usually the same. Were these measurements made during operation (port open) or while it was just plugged in? If the port was not opened, the signals might not be at their operating levels.

Also, RS232 specifies a negative swing for 'Mark' (logic 1). A lot of equipment made today is happy with 0V, but to be truly compatible with all RS232, it should swing negative.

Even if the voltages could be made to be withing the tolerance of teh ATmeg328 on the Arduino, the polarity of the data will be wrong. You could build a simple RS232 to TTL converter like this for less than a couple of dollars --> avrprogrammers.com -.

DTR, if also converted, can be used to control the Arduino reset.

Again, I'd suggest that an ordinary USB cable would be your best bet, or is that not possible for some reason?

BillO:
That cable is almost certainly RS232 as that is what it is sold for. It seems funny that DTR is 13V while RX and TX are 6V. All signals are usually the same. Were these measurements made during operation (port open) or while it was just plugged in? If the port was not opened, the signals might not be at their operating levels.

Also, RS232 specifies a negative swing for 'Mark' (logic 1). A lot of equipment made today is happy with 0V, but to be truly compatible with all RS232, it should swing negative.

Even if the voltages could be made to be withing the tolerance of teh ATmeg328 on the Arduino, the polarity of the data will be wrong. You could build a simple RS232 to TTL converter like this for less than a couple of dollars --> avrprogrammers.com -.

DTR, if also converted, can be used to control the Arduino reset.

Again, I'd suggest that an ordinary USB cable would be your best bet, or is that not possible for some reason?

i measured voltage with the cable connected.
no operations during that step.

usb on my arduino is fine indeed : i tested a few skeches already reading/writing from/to serial either thru the arduino IDE or thru some delphi applications.
i was just willing to experiment serial communication for some later projects, started to discover rs232 vs ttl in the process.
i now will go back to basics as i feel i have some lackings there (to say the least...).

anyway, thanks a lot to everyone in this thread for that shared knowledge.

this cable by the way comes from my work place to interface routers, switches, etc.

/Erwan