Electronic – Color code for DB-9 Connecter

connectorrs232

I have an old DB-9 connector (Male-to-Female). I cut it in half, to find 6 wires inside. 5 Had colored insulators and one was a strand of naked wires.

First question: isn't it supposed to have 9 wires instead of 6?
Second question: which pins do those wires corresponds to? Is there a universal color code for this?

I have the colors yellow, green, white, red and black.

Best Answer

The original serial connectors were 25 pins, with some/many/most of the pins used. The DB-9 RS-232 connector just takes the nine most popular pins from the DB-25 connector. In either DB-25 or DB-9 connector, which pins are actually used depends on the hardware/software implementation of the serial protocol. At minimum, for two-way serial communication you need just three pins:

  • RX (Receive) - connected to TX on the other end. Pin 2 on standard DB-9 and DB-25
  • TX (Transmit) - connected to RX on the other end . Pin 3 on standard DB-9 and DB-25
  • GND (Signal ground) - Pin 5 on standard DB-9 and pin 7 on standard DB-25

(Note that sometimes particular serial cables are wired in non-standard way, but this is very rare. Indeed, there is a number of possible serial connectors). If your serial communication is one-way then you might only use two pins: TX/RX and GND.


The particular cable you have connects the six most popular lines. Cables that connect only some of the DB-9 serial lines are widely available, though do not assume that the same six pins are connected on all DB-9 cables. Depending on your needs, the six connected pins may or may not be sufficient. If you know which pins your hardware/software needs, then you would look for a cable that has those pins actually wired. For most modern needs (if "modern" can be used to apply to serial port in 2013) six wires is sufficient.


Unfortunately, there is no standard for color coding serial lines. You might hope that signal ground is black/brown, though often it is green, or some other random color. TX/RX are often yellow and green, but again you cannot count on this. The only way to know which color is connect to what pin is to test with a multimeter.