In addition to the audio, video, network and USB connectors, the Raspberry Pi also has 26 GPIO pins. These pins also include an UART serial console, which can be used to log in to the Pi, and many other things. However, normal UART device communicate with -12V (logical “1”) and +12V (logical “0”), which may just fry something in the 3.3V Pi. Even “TTL level” serial at 5V runs the same risk.
So in this short tutorial, I’ll show you how to use a MAX3232CPE transceiver to safely convert the normal UART voltage levels to 3.3V accepted by Raspberry Pi, and connect to the Pi using Putty. This is what you’ll need:
- Raspberry Pi unit
- Serial port in your PC or USB to serial -adapter
- MAX3232CPE or similar RS-232 to 3.3V logic level transceiver
- 5 x 0.1 uF capacitors (I used plastic ones)
- Jumper wires and breadboard
- Some type of female-female adapter
The last item is needed to connect male-male jumper wires to RaspPi GPIO pins. I had a short 2×6 pin extension cable available and used that, but an IDE cable and other types ribbon cable work fine as well. Just make sure it doesn’t internally short any of the connections – use a multimeter if in doubt!
The connections on Pi side are rather straightforward. We’ll use the 3.3V pin for power – the draw should not exceed 50 mA, but this should not be an issue, since MAX3232CPE draws less than 1 mA and the capacitors are rather small. GND is also needed, and the two UART pins, TXD and RXD.
Using MAX3232CPE for 3.3V UART
The MAX3232CPE is very much like it’s 5V sister model, MAX232. It uses a few capacitors to deliver true +-12V RS-232 signalling on one end, and 3.3V signalling on the other. I’m not going to cover the internals in detail this time, please either refer to the datasheet or my previous tutorial discussing this same chip.
Above you can see one rather compact way to wire the MAX3232. The orange, white, green and black wires come from Raspberry Pi and provide power and data lines. The red, brown and blue wires go to the RS-232 port – see the illustration on right for connections on this side.
Update: The RS-232 connection diagram is from the side you’d solder the wires from (“back side” of the connector), and wired so you can connect a PC USB serial adapter to Raspberry Pi. If you’d like to talk to serial peripherals from Pi instead, RX/TX wires need to be reversed.
Before you connect the Pi, check with a voltmeter that GND from Raspberry Pi and GND from RS-232 do not differ from each other too much (a few millivolts is usually OK), otherwise you may risk a ground loop and damage to your equipment!
Using Putty to connect to Raspberry Pi
After you’ve made all the connections, double check the connections once more, maybe even check the this full sized photo. If everything looks OK, power up the Pi and plug in the RS-232 cable.
Now all you need to do is to fire up Putty, change connection type to “Serial”, enter your serial COM port, and then access the “Serial” settings (red highlight on the right image).
In the serial settings, make sure you have 8 bits, 1 stop bit, no parity and no flow control before you connect. I initially had XON/XOFF flow control and got nothing but garbage, so don’t forget this step!
For more detail: Raspberry Pi Serial Console With MAX3232CPE