15
\$\begingroup\$

I have a circuit that converts 5V RS-232 polarity signals (logical 0 = +5V, logical 1 = -5V) to 3.3V TTL polarity (logical 1 = 3.3V, logical 0 = 0V) using a BC548 transistor.

It forms a NOT gate so that when the RS-232 output is high, it pulls the output low and vice-versa.

For reference, the RS-232 device (a GPS receiver) is transmitting at 9600bps and is connected to a Raspberry Pi's UART.

My circuit looks like this:

However, this configuration results in the transistor seeing a voltage of -5V across the base-emitter junction due to the negative voltage of the RS-232 input. The BC548 has a maximum Vbe of -6V, but I'd like to protect the transistor by minimizing any negative voltages across the base-emitter junction.

After some searching I came across a post on the Raspberry Pi forums that suggests the following circuit to protect the transistor from negative voltage:

I've constructed the circuit and it seems to be successful: the lowest Vbe voltage is around -0.5V. My digital multimeter only updates about 5 times per second and I don't have an oscilloscope to see things more clearly, but it previously showed the lowest Vbe voltage at around -5V.

My questions are this:

  1. Why is the diode placed where it is? If I interpret things correctly, it means that the lowest Vbe would be the same as the diode's forward drop and that there would be a current flow from ground through the resistor R1 into the negative voltage RS-232 pin. Would it not make more sense to place the diode between the RS-232 input and R1, or between R1 and the transistor Q1, so as to block any current flow into the pin?

  2. The schematic says to use a 1N4148 high-speed diode, which I have used. Is there any disadvantage to using a 1N4001 instead of a 1N4148? 9600bps means each bit is about 100us long and the 1N4001 has a typical reverse recovery time of 2us. The 1N4148 has a typical reverse recovery time of 4ns -- clearly the 1N4148 is faster at switching but does it really make a difference in this context?

\$\endgroup\$

1 Answer 1

13
\$\begingroup\$

The diode is in the best position, and is of an appropriate type.

It conducts when the input is negative, the same as the transistor base conducting when the input is positive. The 47K resistor is about 1/10 of a normal RS-232 load. One could also block the voltage, but then a -100V spike (ESD say) could break down the 1N4148 and break down the E-B junction, causing irreversible damage.

Also, a 1N4148 is an appropriate diode for this application. It's a "switching diode", low capacitance and fast reverse recovery. A 1N4001 would also likely work okay, at least at slow baud rates. The 200mA rating means that even if a very high voltage were to appear at the input the transistor is fully protected, at least up until the resistor arcs over,.

\$\endgroup\$
5
  • \$\begingroup\$ Excellent. Thank you. Would there be any disadvantage of putting a second 1N4148 ("D2") between the RS-232 input and R1, so as to prevent the transistor from seeing any negative voltage at all? If D2 were to fail in the situation you describe, then D1 would still be able to supply current to the RS-232 pin via R1. Wouldn't this also protect the transistor? \$\endgroup\$
    – heypete
    Feb 23, 2014 at 16:36
  • \$\begingroup\$ It could conceivably be a bit of a disadvantage if the cable were long and the baud rates high because the cable capacitance will get charged to -5 or -10 instead of -0.5, but other than that, it's certainly a reasonable approach. Since RS-232 idles at '1' (-V), it could save power at the transmitter end. \$\endgroup\$ Feb 23, 2014 at 16:43
  • \$\begingroup\$ The total cable length is about 10m and the baudrate is only 9600bps, so hopefully cable capacitance will not be an issue. If it doesn't work, no big deal, but I wanted to make sure I wouldn't create a situation that might result in a catastrophic failure (such as the ESD scenario you mentioned for the voltage-blocking diode by itself). \$\endgroup\$
    – heypete
    Feb 23, 2014 at 16:58
  • 1
    \$\begingroup\$ Addendum: with D2 installed things seem to work fine and the Vbe is either zero or positive according to my meter. Thank you again for your help. \$\endgroup\$
    – heypete
    Feb 23, 2014 at 17:10
  • 1
    \$\begingroup\$ Further addendum: there exist chips that perform the RS-232-to-TTL conversion in a better, more controlled way and are inexpensive and small. A MAX3232, for example, requires only a few small external capacitors and solves the issue quite elegantly. \$\endgroup\$
    – heypete
    Jan 10, 2017 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.