If you’re into microcontrollers like me, you should have an FTDI breakout board or the more handy FTDI TTL-232R-3V3 cable. This cable integrates an FTDI USB-to-serial chip and terminates into a 6-pin header, with TTL in/outputs, ready to be interfaced to any microcontroller.
Recently I had to talk to an RS232 port. The voltage used by the RS232 port is anywhere from 7 to 15V (typically), and uses both positive and negative voltages, which cannot be directly interfaced with TTL. Most of my university friends who took microcontroller class previously bought an RS232-to-USB converter, since that’s what the trainer board (evaluation board) uses, but not me. So what should I do now?
Using a MAX232 (actually a HIN232) chip and 5 capacitors, I followed the recommended application circuit to build a level shifter. I laid out the circuit on a veroboard with a 6-pin header on one end for the TTL-232R-3v3 cable, and a 2×5 header for the RS232 port.
Since I ripped out many old computers with those serial port headers I decided to use it. The pinout for the RS232 port header is available in many motherboard manuals, including mine. The only pins (usually) of interest are circled. The pins are 2, 3 and 5 for receive, transmit and ground, respectively.
Notice the motherboard has a shrouded header – some connectors will have a notch at the top to match this orientation. For my converter board, I designed it such that the header pins are slightly recessed so the connector must be inserted with the notch facing upwards. If you try to insert it the other way round, the notch is obstructed by the board and cannot be fully inserted.
The pinout shown here is from the perspective of the PC. Since the device I’m connecting to will be a terminal (like a PC), I need to swap the TX and RX pins. To mate both ends (our connector and the PC), I bought a tiny gender changer since both ends are males.
The converter board is powered by the 5V coming from the FTDI cable, so no additional power supply is required.
The layout is pretty straightforward. If you notice near the top of the underside of the board, I’ve wired the pins from the HIN232 directly to the 6-pin header. This convenience is due to the layout of transceiver pair #2, which has the in pins on one side of the IC, and out pins on the other (for the pair). I have left transceiver pair #1 unused as all 4 pins are on the same side, thus more work to wire up.
And here’s the converter plugged into the target device. It should be quite easily guessable what that device is.
If I have time in future, I will build a smaller version of the converter board, probably to be embedded in a RS232 connector shell or something.