Skip to content
Tutorials

DB9 Pinout Guide: DE-9 RS-232 Signals, Wiring and Null Modem

12 min readBeginner

The 9-pin D-shaped connector everyone calls DB9 (its proper name is DE-9) is the classic RS-232 serial port. Three of its nine pins do almost all the work: pin 2 receives, pin 3 transmits and pin 5 is ground. This guide shows every pin, which cable you need, why you must never wire it straight to an Arduino or ESP32, and how to prove your wiring works in two minutes with a loopback test.

Image pending: Photo: a male DE-9 plug and a female DE-9 socket side by side, front view, pins visible

DB9 pinout: the nine pins

This is the standard PC-style (DTE) assignment. Most serial gear follows it, but always confirm with the manual of your device.

PinSignalDirection (seen from the PC)What it does
1DCDinData Carrier Detect: modem says a link is up
2RXDinReceive data
3TXDoutTransmit data
4DTRoutData Terminal Ready: PC says it is alive
5GNDn/aSignal ground (the common reference)
6DSRinData Set Ready: device says it is alive
7RTSoutRequest To Send: PC asks permission to send
8CTSinClear To Send: device says go ahead
9RIinRing Indicator: a modem sees an incoming call

The only pins you need for a simple link are 2, 3 and 5. The other six are handshake and status lines for modems and older software.

Diagram: DE-9 male and female pin order seen from the mating face, with all nine signals labelled

Male, female and the mirror trap

Male has pins and is what you find on a PC. Female has sockets and is what you find on a modem or on most cables and adapter modules. Gender only tells you the shell type, not whether the device is DTE or DCE.

A pinout drawing can show the front of a connector or the back (solder side), and the two are mirror images. This is the number one reason homemade cables work backwards. Use this routine before you solder anything:

  1. Find the tiny numbers moulded beside the pins on the connector. They beat any drawing.
  2. Note that on a male connector seen from the front, pins run 1 to 5 left to right along the top.
  3. Remember that the female front view is the mirror (5 to 1).
  4. Check the finished cable with a multimeter in continuity mode, unpowered.

TX, RX and the cable you need

Every RS-232 device is either DTE (Data Terminal Equipment, such as a PC, controller or PLC) or DCE (Data Communication Equipment, such as a modem). A DTE sends on pin 3 and listens on pin 2. A DCE does the opposite, so a straight cable (pin 2 to 2, 3 to 3) joins them correctly.

If both ends are DTE, both would talk on pin 3 and listen on pin 2, so nothing arrives. A null-modem cable crosses the lines so one device's TXD meets the other's RXD.

Diagram: straight-through, 3-wire null-modem and handshake null-modem DB9 cable wiring

Null-modem cables come in several flavours. The 3-wire version crosses only pins 2 and 3 and joins pin 5. Fuller versions also cross RTS/CTS and loop back DTR/DSR/DCD, and the exact loops differ between makers. Do not trust a cable's name: read its drawing or test continuity.

RS-232 is not UART logic

A microcontroller UART is TTL: 0 V for a 0 and 3.3 V or 5 V for a 1, idle HIGH. RS-232 is an electrical standard that uses both polarities and inverts the logic: a 1 (called mark) is a negative voltage and a 0 (space) is a positive one. Drivers swing about ±5 V to ±15 V, receivers need at least ±3 V, and anything between −3 V and +3 V is undefined.

TTL UART (Uno, ESP32)RS-232 (DB9)
Logic 13.3 V or 5 V−3 V to −15 V
Logic 00 V+3 V to +15 V
Idle levelHighNegative
Typical useBetween chips and modulesCables up to a few metres to PCs and equipment
Safe on a GPIO?YesNo: negative and high voltages can damage it

Plugging a DB9 pin directly into an Arduino or ESP32 sends the wrong polarity and too much voltage into the pin. The fix is a level converter chip such as the MAX3232. It contains charge pumps that make the ± voltages from a single 3.3 V or 5 V supply, and it converts levels and polarity in both directions.

So to connect an Arduino, ESP32 or any other microcontroller to a DB9 port, use a MAX3232 breakout module between them. Choose one that runs from 3.3 V for 3.3 V boards such as the ESP32.

Animated chart: the letter A (0x41) sent as a TTL UART frame and as an RS-232 signal

Flow control and serial settings

After the wiring is right, both ends must agree on the framing: baud rate, data bits, parity and stop bits. "9600 8-N-1" means 9600 bits per second, 8 data bits, no parity, 1 stop bit. It is a common default, not a law, so check the device manual. A wrong baud rate looks exactly like crossed wires.

Loopback test: to check a serial port on its own, connect pin 2 to pin 3 with a jumper wire, open a terminal on that port and type. If your characters appear back on screen, the port, driver and settings work. If not, the fault is in the port, not in the device you were about to connect.

Hardware flow control uses RTS and CTS (sometimes DTR and DSR) so a receiver can say "slow down". If your software has it switched on but the cable carries only pins 2, 3 and 5, the port opens and then nothing useful happens. Either wire pins 7 and 8 (and 4, 6 if needed) or turn flow control off at both ends.

Is every nine-pin D connector RS-232?

No. The shape is shared by several unrelated interfaces, and plugging in the wrong one can damage equipment.

Interface on a DE-9Common pinsNotes
RS-2322 RXD, 3 TXD, 5 GNDThe layout in this guide
CAN (CiA 303-1)2 CAN_L, 3 CAN_GND, 7 CAN_HPins 5, 6 and 9 are optional shield, ground and power
RS-485Varies by makerNo universal assignment: read the product manual
Other (joysticks, proprietary)VariesIdentify the interface before connecting anything

Label what you build: write RS-232, TTL UART or CAN next to every connector, plus the viewing side and pin 1.

Flowchart: DB9 serial troubleshooting, from loopback test to flow control

Troubleshooting

SymptomLikely causeFix
Nothing receivedWrong COM port, TX and RX not crossed, wrong cable typeRun the loopback test, then check DTE/DCE and use a null-modem if both ends are DTE
Garbage charactersBaud, parity or stop-bit mismatchSet both ends to the same framing
Port opens but stallsRTS/CTS flow control on with no wiresTurn flow control off or wire pins 7 and 8
Works in one direction onlyOne data wire open or swappedContinuity-test pins 2, 3 and 5 end to end
MCU resets or pin diesRS-232 voltage reached a GPIORemove power and place a MAX3232 between the two
No output from the moduleNot powered, or wrong supply for the logic levelCheck VCC, and use 3.3 V with an ESP32

Always test cables unpowered with a multimeter. Never probe an unknown connector with a microcontroller pin.

Quick answers

Is DB9 the same as DE-9? Yes. DB9 is the popular name, DE-9 is the correct one (the "E" shell size holds 9 pins).

Can I connect DB9 straight to an Arduino? No. RS-232 levels are inverted and swing above and below 0 V. Use a MAX3232.

Which pins do I need? Pin 2, pin 3 and pin 5 for a basic link.

Why does my USB-to-serial adapter have TX/RX pins instead of a DB9? It is probably a TTL adapter. That goes straight to an MCU; a DB9 RS-232 adapter does not.

How long can an RS-232 cable be? The original standard allowed about 15 m at low speeds; shorter is safer at high baud rates.

Sources

Connector gender, pin arrangement and signal assignment can differ from product to product, so confirm against your device's manual.