Reference pinout diagrams for DB9 connector (sometimes known as DE9 connectors) for RS232 serial communication ports.
Note: For non-handshaking 3 wires RS232 serial communication wiring, you only need pin 2, 3 (Rx, Tx) and pin 5 (Gnd)
Male (D-Sub 9 pins)
The pin out of a RS232 male connector/socket, typically found on a computer terminal (DTE, Data Terminal Equipment)
Female (D-Sub 9 pins)
The pin out of a RS232 female connector/socket, typically on an electronic device (DCE, Data Communication Equipment)
RS232 D-Sub Connector Information
D-Sub 9 pins male connector for RS232 is typically used on a computer terminal device (master). D-Sub 9 pins female connector for RS232 is typically used on an electronic device (slave).
RS232 standard also implement using a D-Sub 20pins connector. Nowsaday is quite rare to use such big connector.
Modern computer system uses RJ45 modular plug for its RS232 data communication. A common IT terminal console cable is known as RS232 DB9 to RJ45. This is typically for accessing the terminal console of an IT equipment.
RS232 Max Length
The RS232 often uses a data baud-rate of 9600bps. This baud-rate is low and the cable length distance can be up to about 150 meters (about 500ft).
As the speed of data transmission increases on the cable, the physical signal of the data can easily coupled onto the adjacent wire. This induces noise onto the cable. The noise can be in the form of garbage data on the adjacent data wire. To reduce the effect of induced noise from the adjacent wire, the length is keep shorter. The insulation between wires is capacitance which high frequency signal can easily pass over. Shorter length will keep the capacitance lower which makes it harder for the higher frequency signal to coupled over to the adjacent cable.
The following table is a general guide to the cable length base on the baudrate. Please note that this is only a general guide. The material and the construct of the cable also plays a part in the length of the cable. To be safe, it is better to have a margin factor of 2. If you really want to stretch the cable length further, ensure that you get yourself a high quality RS232 cable and also use a better serial data protocol to detect data corruption and do the necessary data re-transmission.
RS232 Cable Length to Data Baud-rate table reference guide
You can easily do an experiment to see the effect noise induced on adjacent wire. Set up 3 wires (Tx, Rx, Gnd) of 30m to 50m distance between two RS232 devices (or computer). Have the wire twisted or tape up so that the gap between the wires are as small as possible. The best is no gap between the wires. Setup the baudrate to 19200bps (with hardware handshaking).
Transfer a string of bytes into the Tx wire and observed the garbage bytes returning from the Rx wire. These garbage data are signal from the Tx wire coupled onto the Rx wire. The disturbance noise triggered the receiver circuit thinking that a valid physical RS232 signal is received. These mis-triggered bytes received on the Rx channel are the noise induced from the Tx line. Change the baudrate lower to 9600bps. You will notice that the probability of these garbage generated is lesser or none. Increasing the baudrate will also increase the probability of noise induced.