Using the MAX3232 UART to RS232 Converter

A very common mistake with electronics is to thing that UART and RS232 are the same thing. Well, in some ways they are. They're very much like American English and British English. The words are the same, but the accent is different.

With UART and RS232 the data is the same, but the way it's represented electrically is completely different. UART uses a simple 0V and 5V (or 3.3V for 3.3V boards) to represent a logic 0 or 1, whereas RS232 uses a system called "Non-Return to Zero" (NRZ) whereby a negative voltage is used to represent a 1 and a positive voltage a 0. And that voltage can be around ±10V.

As you can imagine that kind of voltage being fed directly into a small microcontroller could be fatal (for the microcontroller, not you).

So you need to convert that signal to the right form, and that's where the MAX3232 comes in (there is also a MAX232 chip, but that only works with 5V, so we prefer the MAX3232 which works with 3.3V as well).

The operation is quite simple. Connect one side to your microcontroller, connect the other side to your piece of RS232 equipment, and give it the power it needs. For the MAX3232 that's just 3.3V or 5V, and it does the rest for you. It contains a pair of charge pump circuits. One doubles the power supply to around 6V to 10V, and the other inverts that voltage to -6 to 10 volts. No need to provide it with these extra voltages yourself.

Our modules are clearly labelled with which end of the board is the TTL (UART) end and which is the higher voltage RS232 end. The data direction is also clearly shown.

MAX3232 wiring

And that's really all there is to it. Just follow the arrows. The + on the RS232 side is the same as the + on the TTL side - the two are connected directly together, so you can choose which you feed the 3.3-5V into.