RS-232 — The Voltage Standard Behind Serial Ports
RS-232 is the electrical standard behind classic serial ports on PCs, PLCs, laboratory instruments, barcode scanners, modems, and many industrial devices. It does not replace UART framing. It defines the voltage levels, connector conventions, and control signals used to carry asynchronous serial data over a point-to-point cable.
Learning Objectives
By the end of this lesson, you should be able to:
- distinguish TTL UART from RS-232 electrical signaling;
- explain why RS-232 logic is inverted and uses positive and negative voltages;
- identify the common DB9 pins used in embedded links;
- choose a level converter such as a MAX232-class transceiver;
- debug wiring, baud-rate, ground, and polarity problems.
RS-232 Is Not a Packet Protocol
UART describes the bit timing: idle line, start bit, data bits, optional parity, and stop bit. RS-232 describes how those bits appear on a cable.
The byte format can be exactly the same on both sides. The electrical representation is different.
Voltage Levels and Inversion
RS-232 uses a negative voltage for logic 1 and a positive voltage for logic 0.
| Signal state | TTL UART level | RS-232 level |
|---|---|---|
Idle / logic 1 / mark |
VCC |
-3 V to -15 V |
Start bit / logic 0 / space |
0 V |
+3 V to +15 V |
| Undefined region | between thresholds | -3 V to +3 V |
This inversion is the reason a microcontroller UART pin cannot be wired directly to an RS-232 connector. The voltage could exceed the MCU pin rating, and the logic polarity would be wrong.
UART Frame on RS-232
A simple 8N1 frame still has one start bit, eight data bits, no parity, and one stop bit. The difference is that the RS-232 waveform is inverted around the cable voltage levels.
title "TTL UART versus RS232 polarity"
time start=0 end=10 unit=bit divisions=10
TTL: square label="TTL TX 8N1 idea" low=0 high=3.3 duty=50 cycles=2 unit=V color=#2563eb
RS232: square label="RS232 TX inverted" low=-9 high=9 duty=50 cycles=2 phase=180 unit=V color=#dc2626
marker START at=1 label="start"
marker STOP at=9 label="stop"
The waveform is illustrative, not a decoded byte. Real RS-232 drivers have finite slew rate, load limits, and cable-dependent edges.
DB9 Pins You Actually Use
The DE-9 connector, often called DB9, has nine pins. Full modem links use several handshaking lines, but many embedded links use only three.
| DB9 pin | Name | Direction on a PC DTE port | Purpose |
|---|---|---|---|
| 2 | RXD | Input | Data received by the PC |
| 3 | TXD | Output | Data transmitted by the PC |
| 5 | GND | Reference | Signal ground |
| 7 | RTS | Output | Request to send |
| 8 | CTS | Input | Clear to send |
| 4 | DTR | Output | Data terminal ready |
| 6 | DSR | Input | Data set ready |
| 1 | DCD | Input | Carrier detect |
| 9 | RI | Input | Ring indicator |
Always check whether the equipment is wired as DTE or DCE. A straight-through cable works for DTE-to-DCE. A null-modem cable crosses TXD and RXD for DTE-to-DTE links.
Level Conversion
A MAX232-style IC performs three jobs:
- converts MCU logic levels to RS-232 voltage levels;
- converts RS-232 levels back to MCU logic levels;
- inverts the logic polarity in both directions.
Many versions generate positive and negative RS-232 rails internally using a charge pump and external capacitors. Use a 3.3 V-compatible part for a 3.3 V MCU.
Worked Example: Connecting an MCU to a PLC Serial Port
Suppose a 3.3 V MCU must exchange 9600 baud 8N1 data with a PLC DB9 RS-232 port.
- MCU
TXDconnects to transceiver TTL input. - Transceiver RS-232 output connects to PLC
RXD. - PLC
TXDconnects to transceiver RS-232 input. - Transceiver TTL output connects to MCU
RXD. - Signal ground is shared through DB9 pin 5.
- Firmware configures
9600,8 data bits,no parity,1 stop bit.
The MCU never sees negative voltage. The PLC never sees 3.3 V TTL levels.
Cable Length and Speed
RS-232 is point-to-point and intended for modest speed over moderate cable length. A common practical rule is about 15 m at lower baud rates such as 9600. Shorter cables can run faster; long, noisy cables should run slower.
Important checks:
- use a shielded cable in noisy industrial environments;
- avoid running serial cables beside motor or mains wiring;
- connect signal ground, but consider isolation when equipment grounds may be far apart;
- keep baud rate and frame settings identical at both ends.
RS-232, RS-485, and USB-UART
| Feature | TTL UART | RS-232 | RS-485 |
|---|---|---|---|
| Electrical type | single-ended logic | single-ended cable | differential cable |
| Typical voltage | 0 V to VCC | positive and negative | A/B differential |
| Devices | two pins on a board | two devices | many nodes |
| Distance | very short | about 15 m typical | up to about 1200 m at low speed |
| Inverted | no | yes | transceiver-dependent |
A USB-UART adapter with bare TX, RX, and GND pins is usually TTL-level, not RS-232. A USB-to-RS-232 adapter has a DB9 connector or a built-in RS-232 transceiver.
Common Mistakes
- Connecting an MCU pin directly to a DB9 RS-232 pin.
- Forgetting that RS-232 idle is negative voltage.
- Crossing TX/RX twice, or not crossing them when needed.
- Matching baud rate but forgetting parity or stop-bit settings.
- Omitting signal ground.
- Assuming all DB9 ports use the same DTE/DCE pin direction.
- Using a TTL USB serial adapter when the equipment expects RS-232 levels.
Practical Debugging
- Measure the idle RS-232 TX pin; it should usually be negative with respect to signal ground.
- Use a known-good USB-to-RS-232 adapter and terminal program.
- Start with a slow baud rate and send repeated plain text.
- If characters are unreadable, check baud, parity, stop bits, and inversion.
- If nothing is received, swap TX/RX once and document the final cable.
- If communication fails only on site, check cable routing, grounding, and isolation.
Summary
RS-232 is UART-style serial data carried with inverted positive and negative cable voltages. It is reliable for point-to-point links when the correct transceiver, cable, ground reference, and serial settings are used. Never treat a DB9 RS-232 port like a raw MCU UART header.
Further Reading
- Texas Instruments, RS-232 transceiver application notes and datasheets.
- Analog Devices, RS-232 interface design notes.
- TIA/EIA-232 standard summaries from connector and transceiver vendors.
- Saleae, asynchronous serial analyzer documentation.