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
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.
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:
- 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.
- 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.
- 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
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
Cheapest PCB Prototype: Only $2 for 10pcs 10×10cm PCBs, 24 hours Quick Turn, DHL Delivery in 3 Days