Simple TTL to RS232 adapter using bipolar transistors
When working in an electronics project there might be a time when you need to connect TTL level signals to a RS232 interface. Here is a circuit that does that job and a simple explanation of how it works. This circuit uses two complementary general purpose bipolar transistors, one diode, one capacitor, a few resistors and no other power supply than the simple +5V you use to power your application.
RS232 to TTL
This part is really easy. To adapt RS232 levels to TTL we just use a NPN transistor as a switch. When the output from the RS232 transmitter (TxD) goes positive the switch is turned on, when it goes negative the switch is turned on. When the base of the transistor sees the +12V from the TxD pin it turns on and pulls down it’s collector towards ground (the signal on the emitter) so the TTL RX signal is 0V (or at least very near to 0V). When TxD voltage goes negative the transistor turns off and the 1K resistor pulls the voltage up to +5V. Now the +12 to -12V RS232 has been converted to 0 and 5V TTL voltages. Now comes the tricky part… converting TTL levels to RS232.
TTL to RS232
RS232 voltage levels switch between +/-12V. When adapting TTL to RS232 levels the major problem is getting a negative supply to feed the -12V level back to the RS232 receiver input (RxD). To solve this problem this circuit steals that negative voltage right from the RS232 transmitter. The diode is arranged so that the negative voltage from the TxD is used to charge the capacitor. Note that the capacitor’s + pin is connected to ground. This capacitor will store the -12V needed to drive the RxD input to a negative voltage.
Now, to adapt TTL levels to RS232 we use a PNP transistor. This transistor will turn on when it’s base voltage is below it’s emitter voltage. The transistor turns on when the TTL transmitter outputs a logic 0 (0V). This pulls up the collector toward the emitter wich is tied to +5V, feeding +5V to the RS232 receiver (RxD). With a logic 1 (5V) the transistor is turned off and the 4.7K pulls the signal down to the negative voltage on the capacitor, feeding -12V to the RS232 receiver. The voltage levels at the RS232 side of the adapter, +5V and -12V, may not the conventional RS232 levels for 0 and 1 logic but are valid signal levels.

On the image TX and RX are the TTL transmitter and receiver, while TxD, RxD and Gnd are the RS232 transmitter, receiver and ground signals.
There are other solutions for adapting TTL and RS232 levels like the MAX232 or MAX233 ICs, but this adapter is easy to build and use low cost and easy to get parts, maybe parts you have around your workbench.
Happy prototyping!
4 comments

Good article. Expect more articles like this. Thank you.
— Luis Digital Tue, 28 Apr 2009
Hi: I've seen a reference to your blog in barrapunto.com (I am Spanish). It is difficult to find a blog with electronic schematics. I hope you will continue this type of posts. I saw a similar schema for a TTL-RS232 converter in an old Resistor magazine. The RS232-TTL path was like yours, with a npn transistor, but in the reverse path they used an operational amplifier in open loop as a comparator. One advice: take the .png schema to your favorite graphical editor and put a big "TTL" label on the left side and a "RS232" label on the right side. It will be easier to understand the circuit behaviour without read the explanation. One doubt: have you tested the circuit in a real application? The 10uF capacitor is capable to provide the -12V in all posible critical situations?. For example, you can emit a long sequence of RS232 0's (+12V) that not recharges the capacitor for the recepction circuit. Other doubt: what is the function of the 1K resistor connected between the pnp resistor and RXD pin? Thanks -- AlBundy
— AlBundy Fri, 1 May 2009
great article,it helped in clearing the concept, thanks a lot...
— tortuka Tue, 3 Nov 2009
Hi, i was wondering is there any other circuits that do the same as this ciruit. can please let me know, thanks
— Ray Fri, 15 Jan 2010