Bidirectional Level Shifter without IC

level-shiftingraspberry pirs232

I'd like to connect R-Pi serial to PC's RS232 port without IC (such MAX3232), using only diode (thus block negative voltage to 0V), voltage divider resistors, and common BJT.

For TXD (RX from R-Pi perspective):
Using my USB-to-RS232 adaptor, measured voltage level for logic high is 7.5V, 6.85V after 0.65V diode voltage drop, so I'll use 270:220 ohm resistor for 3.07V (for 10 mA current) – 3.36V (no current, no voltage drop) divided voltage. Current is limited to about 10 mA with 490 (270+220) ohm resistance.

For RXD (TX from R-Pi perspective):
Borrowing power from DTR line, switch it using BC557 PNP transistor (DTR to collector; emitter to RXD) with base connected to R-Pi's TX in series with 680K resistor (for limiting drawn current to 0.5 mA).

Schematic

My question is: will this work? (I'm not sure whether impedance of the connected pins will affect this simple circuit). Thanks in advance for your response.

Best Answer

There are lots of issues with the circuit that you drew. I could go on at great length about what is wrong, but it doesn't matter because there is one fundamental issue: RS-232 levels are inverted from TTL signal levels. A binary '1' coming out of your PI is a high voltage level, but a binary '1' to your PC is -12 volts (ideally). Your circuit doesn't do the inversion.

Other issues that you have are: Modern RS-232 ports can't source much current. 10 mA is probably too much. RXD needs a pulldown resistor. The transistor might have problems switching correctly-- you can use an NPN to level shift AND invert.