Simple RS232 to logic level converter for PIC microcontroller

The circuit shown will convert logic level voltages to and from RS232 serial voltages levels.

For basic serial comms between a Microchip PIC and a PC or other device you generally only need to connect the Gnd, Txd and Rxd lines.

This little circuit will work with a supply voltage of 3.3v to 5v making it ideal for interfacing with a PIC 

logic level converter

It derives the negative supply for the RS232 transmit data from the serial RS232 receive data line in a parasitic fashion.  This means that the device it’s connected to must use voltage levels within the RS232 specification. You can’t for example connect two of these back to back since nothing is supplying the negative voltage.

The RS232 physical specification gives a logic 1 at the receiver input as -3 to -25 volts and logic 0 as +3 to +25 volts.  You may find that the reliable transmission over long cables, especially in electrically noisy environments with a 3.3v supply is not possible.

We’ve successfully used this circuit to transfer a 1.6Mb Linux kernel to a router at 115Kbs using a 3.3 volt supply without any errors through several metres of cable.

Operating notes

The 100nF capacitor is used to generate the -12V supply for transmitting data back to the host.  It is charged from the host computers transmit signal coming into the adapter via the 1N4148 diode. 

This can cause a few issues:

  1. If data is being transmitted and received simultaneously, the voltage on the 100nF capacitor may drop below the minimum required by the RS232 standard and this will cause problems receiving data sent from the adapter to the host.
  2. Since the capacitor is connected via the diode directly the hosts transmit signal, at high bit rates the 100nF capacitor may cause the signal to be distorted to such an extent that it can’t be received correctly, in which case try changing the 100nF capacitor to a 47nF or even 22nF.  If communication is strictly half-duplex you may not need the capacitor at all.
  3. If the host transmits a lot of zero (null) data in a stream, the capacitor will discharge because in RS232 zero bits are sent as a positive voltage and ones as a negative voltage.  Since the circuit needs the negative voltage to charge the capacitor, this will also cause problems when transmitting data back to the host.

For many applications this is a quick and simple way to interface to an RS232 port, however it isn’t a universal solution, therefore if it works for you all’s well and good, if not time for a MAX232 or a similar.


For more detail: Simple RS232 to logic level converter for PIC microcontroller

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us: