MAX232 RS-232 transceiver

The MAX232 turns a board's 5 V UART into RS-232 line levels for a PC or instrument serial port, and back.

Aliases: MAX232, MAX232A, MAX232N, MAX232CPE, MAX202, SP232, ICL232, RS-232 level shifter, TTL to RS-232.

An old PC's COM port, a lab instrument or a CNC controller speaks RS-232: about -7 V for a 1 (the idle line) and +7 V for a 0. Wiring that straight to an Arduino pin damages it, and the board's 0 V and 5 V do not reach a PC's receiver thresholds the right way around. The MAX232 sits between them with two drivers and two receivers, and makes its own plus and minus supplies from 5 V with a charge pump and four 1 uF capacitors. It needs no library: it carries whatever Serial or SoftwareSerial sends.

Pins

Pin What it does
C1+, C1- The first pump capacitor (1 uF), the voltage doubler.
C2+, C2- The second pump capacitor (1 uF), the inverter.
VS+ The pump's positive output, about +9 V. A 1 uF capacitor to VCC or GND.
VS- The pump's negative output, about -9 V. A 1 uF capacitor to GND.
T1IN, T2IN Driver inputs, TTL: from the board's TX. Open reads high.
T1OUT, T2OUT Driver outputs, RS-232 levels: to the far side's receive line.
R1IN, R2IN Receiver inputs, RS-232 levels: from the far side's transmit line.
R1OUT, R2OUT Receiver outputs, TTL: to the board's RX.
VCC 5 V (4.5 to 5.5 V).
GND Ground, shared with whatever is on the far end of the cable.

What the model gets right

Both directions invert. A TTL high (a UART's idle) is a negative line and a TTL low a positive one; the receivers turn them back. So two MAX232s, T1OUT of each to R1IN of the other, carry a UART between two boards the way a null-modem cable does.

The levels. A driver puts out about +-7 V into the 3 to 7 kohm of a receiver (the TI sheet's typical 7 V into 3 kohm), behind 750 ohm, so a short to ground passes about 12 mA. A receiver is 5 kohm to ground, switches at 1.7 V going up and 1.2 V going down (0.5 V of hysteresis), and an open input reads as a mark: its output high.

The capacitors matter. The model looks for C1 between C1+ and C1- and C2 between C2+ and C2-. Without C1 the positive rail is only about 4.3 V; without C2 there is no negative rail at all, and a mark is 0 V instead of -7 V, which a real PC port may not accept. The chip shows no C1/C2 when it runs without them.

Delays. A receiver's output follows half a microsecond after its input crosses, and a driver's edge lands a quarter of a microsecond late (half of its 30 V/us slew across the swing). At 115200 baud a bit is 8.7 us.

What it does not model

The charge pump is its averaged output, not a switching circuit: no ripple, no start-up time, and the drivers' load does not pull VS+ and VS- down. What sits between the pump pins is not checked, only that both are wired and not shorted together, and the two reservoir capacitors on VS+ and VS- are not required. The supply current is not drawn from VCC, the 120 kbit/s rate limit is not enforced, and nothing is damaged by +-30 V on an input or a long short on an output. Below 4.5 V the chip is off: the MAX3232 is the 3.3 V part, and it is not simulated.

Common mistakes

Wiring T1OUT to a board pin. It is -7 V when idle: on a real board that is a damaged pin. RS-232 levels only go to RS-232 inputs.

Forgetting the ground between the two ends of the cable.

Mixing up the directions: TxIN takes the board's TX, RxOUT goes to the board's RX.