Making serial cable(RS-232)

userok's picture


This article is going to show how to make the RS-232 cable (com) with your own hands.

What is it for? As rule, nowadays the most mainboards don't have serial ports and a number of user devices that are using this interface, permanently decrease. But in some industrial devices like different controllers, in units that are for flashing chips, in commercial equipment like barcode scanners or fiscal registers, this interface is still used and not going to die by reason of its relative simplicity and also because of RS-232 standart has less stringent restrictions on cable length than USB.

If you still use this interface by any reason, probably you faced to the necessity of availability to have com-port in your PC. If for PC on sale there is various adapters like USB-COM, PCI-COM, as well as some motherboards still have this interface (as a 9-pin socket on theirs body) without Db9 jack on the rear panel, and without data cable, search which is now more of the headache, the RS-232 cable for sale almost impossible to find. The situation is aggravated by the fact that, for our purposes, often is required longer lengths than those rare instances that can be detected in the free market.

Often there is only one way - make it yourself only. If you have a soldering-iron, straight hands and the necessary jacks then it's not too difficult task. But before you will take a soldering-iron in your hands you should know the kind of jacks in which you need and numbering of contacts on them. Also it can be helpful to know which contacts are in use and ones that are not. The ignoring unused contacts can make your work a bit simplier.

DB9 pinout (table 1):

1 Carrier Detect (CD)
2 Received Data (RD)
3 Transmitted Data (TD)
4 Data Terminal Ready (DTR)
5 Signal Ground
6 Data Set Ready (DSR)
7 Request To Send (RTS)
8 Clear To Send (CTS)
9 Ring Indicator (RI)


Appearance and numbering pin is the front:



Appearance and numbering pin is the back:



Pay your attention that 9-pin jack is MALE and 9-contact hole jack is FEMALE.

If you need to receive a full comlete RS-232 functionality (generaly it used in modems) then you should connect the appropriate contacts one-to-one way. The first male contact must be connected to the first female contact, the second to the second, etc.

From the table above you can see the fact that just the 2nd,3rd and 5th(ground) contacts are used for sending/receiving the data. If you're going to use the cable to connect the receipt printer then these three ones will be enough. At end of article you can see the RS-232 cable made myself and the result of receipt printing.

It should be noted that although the most equipment uses just three contacts for data and the standart pinout pointed above, some manufacturers go their own way and they can use additional contacts for service purposes, since that you should read your equipment documentation before you begin your work.

Cable UTP(twisted pair) is very easy to use for our purposes. The using of heat-shrink tubing seems to be good for isolation the neighbor contacts.
Also you can apply screened cable to lengthen the distance for which you want to use up your cable( the RS-232 maximum cable length is determined as 15 meters).
To increase the distance you can also decrease serial port speed in its settings. In practice we managed making the cable to work in the distance 35-40 meters without any troubles. Likely this distance could be increased more, but we hadn't this necessity.

Attention!
Do not confuse RS-232 serial cable(MALE-FEMALE) with so-called null modem cable(FEMALE-FEMALE) which uses to manage different commutation devices from PC. Just in case, you can see the null modem cable pinout below.

(Table 2):

DB-9 FEMALE 1 pin DB-9 FEMALE 2 pin
2 3
3 2
5 5
7 8
8 7
9 9

In case of null modem cable the 2nd and 3rd contacts are swapped and the 6th and 7th are too, that logically follows from table 1.

Photos:
Two connectors: MALE and FEMALE with cases and the length of the twisted pair.



Ready-made cable (used contacts 2,3,5).



Successful printing on receipt printer:



Note that a POS-terminal manufacturer went his way: the terminal has two serial ports, but instead standart DB9 sockets, there are different sockets that look like RJ-45 sockets but unlike them they have ten(!) contacts. There were two adapters: first one connected to our ready-made cable that you can see on the photo and another one had been broken before. Second adapter could be ordered at the manufacturer but delivery time would be in a week or more. To connect the second printer we had merely bought an USB-to-serial adapter and began working in the same day. Having done this, we saved a lot of time and nerve cells. It is a good thing that the terminal has four USB-ports...

This article is published under Creative Commons Attribution ShareAlike license

Add new comment