Reference pinout diagrams for DB9 connector (sometimes known as DE9 connector or D-sub connector) for RS232 serial communication ports. RS232 is a serial data communication signalling protocol. D-sub 9pins or 25pins connector is commonly use for RS232. These days RJ45 (or 8P8C) modular connector is also commonly used for RS232 purpose.
Note: For 3 wires RS232 serial communication (non-hardware-handshaking or asynchronous data communication) wiring, you only need pin 2, 3 (RX, TX) and pin 5 (Gnd)
Typically the TX pin of a RS232 D-sub connector represent data flowing out of the connector, flowing into the RX pin of its mating connector. This is a communication channel between two devices.
Male (D-Sub 9 pins)
The pin out of a RS232 male connector/socket, typically use on a computer terminal (DTE, Data Terminal Equipment)
Female (D-Sub 9 pins)
The pin out of a RS232 female connector/socket, typically used 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 was also implemented using a D-Sub 20pins connector. Nowadays is quite rare to use such big connector.
Another common type of cable where RS232 is found is the “USB to RS232 converter cable“. Modern computing hardware uses USB connection more, due to its size and plug-and-play feature. It is commonly used between modern computer and industrial devices that still uses the RS232 communication method.
Typical RS232 Wire Connection (D-sub 9 pins)
RS232 cable typical has two types.
Crossed RS232 cable
Straight RS232 cable
Click here for more wiring information on the Crossed or Straight RS232 cable.
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.