-1
\$\begingroup\$

I'm planning to send data from my laptop via Hyperterminal to Arduino's TX RX pins. Normally RS232 is around +12V -12V; but I will use a USB to RS232 converter as in the figure below:

enter image description here

And from a DB9 female end I will wire to Arduino TX RX pins. Eventhough the voltages at DB9 pins might be exceeding 5v, why cant I just use a Voltage divider and feed it to TX RX pins of Arduino?

\$\endgroup\$
  • 1
    \$\begingroup\$ While maybe feasible (with a diode as well) one issue is you won't be able to use the hardware UART on the AVR any more because TTL serial is inverted compared to RS232, so you'd need to use SoftwareSerial. \$\endgroup\$ – PeterJ Mar 9 '15 at 13:03
  • 3
    \$\begingroup\$ Apologies if I'm stating the obvious, but you do realize you can use the "programming" USB port on the Arduino for this type of communication? \$\endgroup\$ – Karl Bielefeldt Mar 9 '15 at 13:54
2
\$\begingroup\$

I have done this (not with an Arduino, but with something similar) recently. The voltage levels that RS232 uses (+12V, -12V) will break the Arduino. You need a MAX232.

The much better alternative is to skip the RS232 serial port and go straight to Arduino voltage levels with a USB-to-TTL cable:

USB-TTL cable

You can get these on Digikey, Adafruit, Sparkfun, etc... for roughly the same price as a USB-to-Serial cable, and then you don't need a 2-way converter. Much simpler if you don't really need the serial cable in the first place.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ i need rs232 to ttl because i will collect data from a device which only communicates with rs232. thats the goal. by the way i'm not sure if one uses a usb to rs232 converter one sees 12V. how can it be 12V when usb can only supply 5V? look at my diagram tne converter is powered from USB port. \$\endgroup\$ – user16307 Mar 9 '15 at 15:05
  • \$\begingroup\$ How does it communicate with RS232? If it's a generic USART line, then you can do this instead. RE: +12V, have you ever heard of a charge pump? If not, how do you expect the MAX232 to work off a 5V supply? \$\endgroup\$ – Greg d'Eon Mar 9 '15 at 15:26
  • \$\begingroup\$ im talking about this USB to RS232 converter. look at this link: encrypted-tbn0.gstatic.com/… \$\endgroup\$ – user16307 Mar 9 '15 at 15:37
  • \$\begingroup\$ so please tell me how can this output 12V when I send data from PC through USB port?? \$\endgroup\$ – user16307 Mar 9 '15 at 15:38
  • \$\begingroup\$ There is a decently sized enclosure attached to the RS232 end of that cable. There is a circuit in there that uses a 5V supply to produce +/- 12V for the RS232 outputs. \$\endgroup\$ – Greg d'Eon Mar 9 '15 at 15:45
2
\$\begingroup\$

Level translation needs to work in both directions. Think about the inputs and outputs you are dealing with.

Arduino --> PC
Bin   Ard. V   PC V   Notes
 0      0V     >+3V   Can't be done with a divider
 1      5V     <-3V   Can't be done with a divider

PC --> Arduino
Bin   PC V   Ard. V   Notes
 0    +12V     0V     Can't be done with a divider
 1    -12V     5V     Can't be done with a divider

You may find some one off way of doing this without a RS-232 level translator IC using discretes, but you won't accomplish this with simple resistive dividers.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ but usb to rs232 converter cannot output 12V. isnt it sending and receiving 5V? \$\endgroup\$ – user16307 Mar 9 '15 at 12:33
  • \$\begingroup\$ you mean arduino tx rx is 0V 5V? \$\endgroup\$ – user16307 Mar 9 '15 at 12:34
  • 2
    \$\begingroup\$ There is a difference between a USB-to-TTL serial converter and a USB-to-RS232 converter. Both exist, but they have different output levels. \$\endgroup\$ – M D Mar 9 '15 at 12:35
  • \$\begingroup\$ do you mean after USB-to-RS232 converter, i need a rs232 to ttl conveter since arduino recieves as TTL level on pins TX RX? is that why they use MAX232?? \$\endgroup\$ – user16307 Mar 9 '15 at 12:39
  • \$\begingroup\$ Do you own/have access to an oscilloscope? \$\endgroup\$ – M D Mar 9 '15 at 12:40
0
\$\begingroup\$

From the figure i can see you are using arduino uno. It has a inbuilt usb to serial converter so no need to use a rs232 converter just connect the arduino to your pc through its usb port. It will be detected as a serial port in your PC (I assume that you have the necessary drivers in your pc since you are burning program into the arduino with the same pc) .

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ i know im using arduino as a serial com source. in real i have another instrument which outputs TX RX. this is a model \$\endgroup\$ – user16307 Mar 27 '15 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.