The DB9 connector (officially DE-9, sometimes called D-Sub 9) is the standard physical connector for RS232 serial communication in industrial equipment, legacy computers, PLCs, and scientific instruments. Despite USB taking over for consumer electronics, the DB9 RS232 interface remains ubiquitous in Indian industrial and automation environments. This guide provides complete pinout information, wiring diagrams, and cable-making instructions.
Table of Contents
- DB9 Connector Basics
- DB9 Pin Numbering Diagram
- RS232 DB9 Pinout: Male and Female
- Signal Description: Each Pin Explained
- Straight-Through Cable Wiring
- Null Modem Cable Wiring
- Connecting DB9 to Arduino or ESP32
- Frequently Asked Questions
DB9 Connector Basics
The DB9 connector has 9 pins in a D-shaped metal shell. Despite being called “DB9”, the technically correct name is “DE-9” (D-subminiature, E size shell, 9 pins). The confusion arose because the original DB connector had 25 pins, and the 9-pin variant was introduced as a compact alternative for serial ports.
- Male (plug): Has protruding pins. Typically found on the cable or DTE (Data Terminal Equipment — computers, microcontrollers)
- Female (socket): Has holes to receive pins. Typically on the equipment port or DCE (Data Communications Equipment — modems, instruments)
- Locking: Two screws (4-40 UNC or M3) secure the connector to the mating connector or panel
DB9 Pin Numbering Diagram
DB9 Male Connector (front view, pins facing you):
1 2 3 4 5
6 7 8 9
DB9 Female Connector (front view, holes facing you):
5 4 3 2 1
9 8 7 6
Note: Pin 1 is always in the top-left corner when facing the mating surface.
The numbering goes left-to-right in the top row, then left-to-right in the bottom row.
For MALE: top-row pins are 1-5, bottom-row pins are 6-9.
For FEMALE: counting is REVERSED left-right from male view.
RS232 DB9 Pinout: Male and Female
| Pin | Signal | Direction (from DTE) | Function |
|---|---|---|---|
| 1 | DCD | Input | Data Carrier Detect |
| 2 | RXD | Input | Receive Data |
| 3 | TXD | Output | Transmit Data |
| 4 | DTR | Output | Data Terminal Ready |
| 5 | GND | Common | Signal Ground |
| 6 | DSR | Input | Data Set Ready |
| 7 | RTS | Output | Request To Send |
| 8 | CTS | Input | Clear To Send |
| 9 | RI | Input | Ring Indicator (modem use) |
Signal Description: Each Pin Explained
- Pin 1 DCD: Indicates an active communication link. Modem asserts DCD when carrier signal detected from remote modem. Rarely used in modern equipment.
- Pin 2 RXD (Receive Data): Data input to the DTE device. This is where incoming serial data arrives. Connect to MCU RX pin via level converter.
- Pin 3 TXD (Transmit Data): Data output from DTE device. This is where you send serial data. Connect to MCU TX pin via level converter.
- Pin 4 DTR (Data Terminal Ready): DTE signals it is powered and ready to communicate. Many instruments require DTR to be asserted before accepting commands.
- Pin 5 GND: Signal ground reference. Must be connected in all RS232 cables.
- Pin 6 DSR (Data Set Ready): DCE device signals it is ready. Pair with DTR for handshaking.
- Pin 7 RTS (Request To Send): DTE requests to send data to DCE. Used for hardware flow control to prevent buffer overflow.
- Pin 8 CTS (Clear To Send): DCE signals it is ready to receive data. Companion to RTS for hardware flow control.
- Pin 9 RI (Ring Indicator): Modem asserts RI when telephone ring detected. Not used in non-modem applications.
Straight-Through Cable Wiring
A straight-through RS232 cable connects pins 1-1, 2-2, 3-3… between both ends. Used to connect DTE (computer) to DCE (modem, industrial instrument with DB9 socket).
Straight-Through RS232 Cable:
Device A (male DB9) Device B (female DB9)
Pin 1 DCD ─────── DCD Pin 1
Pin 2 RXD ─────── RXD Pin 2
Pin 3 TXD ─────── TXD Pin 3
Pin 4 DTR ─────── DTR Pin 4
Pin 5 GND ─────── GND Pin 5 (REQUIRED)
Pin 6 DSR ─────── DSR Pin 6
Pin 7 RTS ─────── RTS Pin 7
Pin 8 CTS ─────── CTS Pin 8
Pin 9 RI ─────── RI Pin 9
Minimum required connections (for simple 3-wire RS232):
Pin 2 RXD ─────── TXD Pin 3 (cross!)
Pin 3 TXD ─────── RXD Pin 2 (cross!)
Pin 5 GND ─────── GND Pin 5
Note: For DTE-to-DTE, TXD and RXD must be CROSSED
For DTE-to-DCE (straight cable): TXD connects to TXD (straight)
because DCE internally crosses them
Null Modem Cable Wiring
A null modem cable connects two DTE devices (e.g., computer to PLC, Arduino to PC) without a modem in between. It crosses the TXD/RXD lines and provides handshaking signal loopbacks.
Null Modem Cable (Full, with hardware flow control):
Device A (male DB9) Device B (male DB9)
Pin 2 RXD ─────── TXD Pin 3
Pin 3 TXD ─────── RXD Pin 2
Pin 5 GND ─────── GND Pin 5
Pin 4 DTR ─┬───── DSR Pin 6
└───── DCD Pin 1
Pin 6 DSR ─┐
Pin 1 DCD ─┴───── DTR Pin 4
Pin 7 RTS ─────── CTS Pin 8
Pin 8 CTS ─────── RTS Pin 7
Simple Null Modem (3-wire, no handshake):
Pin 2 RXD ─────── TXD Pin 3
Pin 3 TXD ─────── RXD Pin 2
Pin 5 GND ─────── GND Pin 5
(Tie DTR-DSR-DCD together on each end to self-assert handshake)
Connecting DB9 to Arduino or ESP32
Arduino and ESP32 operate at 3.3V/5V TTL UART logic levels. RS232 operates at ±3V to ±15V. A level converter IC is required:
Using MAX232 (5V Arduino) or MAX3232 (3.3V ESP32):
Arduino UNO (5V):
Arduino Pin 0 (RX) → MAX232 R1OUT
Arduino Pin 1 (TX) → MAX232 T1IN
MAX232 T1OUT → DB9 Pin 3 (TXD)
MAX232 R1IN → DB9 Pin 2 (RXD)
GND → DB9 Pin 5 (GND)
VCC (5V) → MAX232 VCC
4 x 1uF capacitors: C1-C4 as per MAX232 datasheet
Software (Arduino):
Serial.begin(9600);
Serial.println("Hello from Arduino via RS232");
For direct connection to equipment requiring DTR/RTS:
Also connect:
Arduino GPIO → MAX232 T2IN → DB9 Pin 7 (RTS)
DB9 Pin 6 (DSR) → MAX232 R2IN → Arduino GPIO
Frequently Asked Questions
Is DB9 and RS232 the same thing?
Not exactly. RS232 is the electrical standard (voltage levels, signal definitions). DB9 is the physical connector most commonly used for RS232. RS232 can technically use other connectors (DB25 was the original), but DB9 is the de facto RS232 connector in modern equipment.
Why does my RS232 device not respond to my Arduino?
Most common reasons: (1) No level converter — TTL 5V UART is NOT RS232, will damage RS232 input stage or not register as valid. (2) Wrong baud rate settings — must match exactly (8N1 is standard: 8 data bits, no parity, 1 stop bit). (3) TX/RX crossed correctly? DTE-to-DTE connection requires TX-to-RX crossover. (4) Handshake lines not asserted — some instruments require DTR=high before responding.
Where can I buy DB9 connectors and cables in India?
DB9 connectors (male and female, solder type) are available at SP Road Bengaluru, Lamington Road Mumbai, and Palika Bazaar Delhi for Rs 10-30 each. RS232 straight-through and null-modem cables are available at IT accessory shops for Rs 80-200. USB-to-RS232 adapters (CH340 chip) are available online for Rs 150-300.
Add comment