Part

RS-232 transceiver, MAX232

Turns a 5 V UART into inverted +-7 V RS-232 levels and back, two channels each way, from one 5 V supply with its charge pump.

See every part
  • 16 pins
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
At a glance

The RS-232 transceiver, MAX232 in brief

What it is, and where it sits on the bench.

The MAX232 is the chip between a microcontroller’s 5 V serial port and a real RS-232 port, the kind on old PCs, lab instruments and CNC controllers. RS-232 uses roughly -7 V for a 1 and +7 V for a 0, the opposite sense and many times the swing of a board’s logic. The MAX232 builds its own positive and negative supplies from 5 V with a charge pump and external capacitors, then gives two drivers that turn logic into line levels and two receivers that turn them back. In Mokxi both directions invert as they should, a driver puts out about 7 V either way behind 750 ohms, and a receiver switches with half a volt of hysteresis and reads an open input as idle. The model checks that both pump capacitors are wired; take one out and the chip says no C1/C2 and its output can no longer go negative.

Family
Clocks and links
Pins
16
Pins

16 pins

Named as the editor names them, so a wire lands where you expect it.

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

How to connect an Arduino to RS-232 with a MAX232

In the loopback project the Uno’s TX, pin 1, feeds T1IN, and R1OUT comes back to pin 8, which the sketch reads with SoftwareSerial. VCC goes to 5 V and GND to ground. Two 1 µF capacitors make the charge pump work: one across C1+ and C1-, the other across C2+ and C2-. A jumper from T1OUT to R1IN is the loopback plug a technician pushes into a port to test it.

Every second the sketch prints "ping" and a count on Serial. The byte leaves through the driver at RS-232 levels, crosses the jumper, comes back through the receiver at logic levels and arrives on pin 8, where the sketch prints what came back. When you connect a real device instead, T1OUT goes to its receive line, its transmit line comes into R1IN, and the grounds are joined.

Pull the jumper and nothing returns: R1OUT stays high, because an open RS-232 input counts as idle. Remove C2 and there is no negative rail, so a mark is 0 V instead of -7 V.

Part pin
Board pin
T1IN
Pin 1 (TX)
R1OUT
Pin 8
T1OUT
R1IN (the loopback jumper)
C1+ and C1-
A 1 µF capacitor
C2+ and C2-
A 1 µF capacitor
VCC
5 V
GND
GND

The MAX232 is off below 4.5 V, so a 3.3 V board needs the MAX3232 instead, which is not on the Mokxi bench; on a 5 V board the wiring is the same as here.

Arduino Uno: RS-232 loopback through a MAX232live0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
Reading the loopback, from the RS-232 sketch
#include <SoftwareSerial.h>

SoftwareSerial back(8, 9);   // RX on pin 8 from R1OUT

void setup() {
  Serial.begin(9600);        // TX goes out through T1IN
  back.begin(9600);
}
Common errors

Common RS-232 transceiver, MAX232 errors and fixes

What goes wrong
The fix
An Arduino pin is wired to T1OUT or T2OUT.
Those outputs sit at about -7 V when idle, which damages a real board’s pin. RS-232 levels only go to RS-232 inputs; the board connects to TxIN and RxOUT.
The chip shows "no C1/C2" and the far end reads nothing.
A pump capacitor is missing. Put 1 µF across C1+ and C1-, and another across C2+ and C2-.
Bytes reach the PC as garbage or not at all.
The two ends need a common ground through the cable. Without it there is no reference for either side’s levels.
Nothing comes back on the board’s RX.
Check the directions: the board’s TX goes to T1IN, R1OUT goes to the board’s RX, and the device’s transmit line comes into R1IN.
Questions

Questions and answers

Why does RS-232 look upside down compared with a UART?

Because the standard defines it that way: an idle line, a logic 1, is a negative voltage, and a 0 is positive. The MAX232 inverts in both directions, so the bytes come out unchanged.

How many capacitors does a MAX232 need?

The real chip wants four 1 µF capacitors, two for the pump and two to hold its plus and minus rails. The simulation needs the two pump capacitors, C1 and C2, to make its rails.

Can two Arduinos talk through two MAX232 chips?

Yes. Cross T1OUT of each to R1IN of the other, as a null-modem cable does, and join the grounds; each board then sees the other’s bytes at its own logic levels.

Should I use a MAX232 or a MAX485?

Use the MAX232 to reach a device that already has an RS-232 port, point to point. Use the MAX485 for a long run or several devices on one twisted pair.

How it is modeled

What is true about the RS-232 transceiver, MAX232, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

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.

Not modeled

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.

From MAX232 RS-232 transceiver, in full.

Projects

See the RS-232 transceiver, MAX232 in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the RS-232 transceiver, MAX232 in it.

Libraries

Arduino libraries for the RS-232 transceiver, MAX232

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

Wire up the RS-232 transceiver, MAX232

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.