0
\$\begingroup\$

I want to switch my RS-232 TX pin.For this I am using NPN transistor in between the TX line in such a way that the collector terminal is connected to controller side and Emitter to external side. The base is connected to a digital pin.

So, when the digital pin is high, the NPN transistor should close and TX line should send data from controller to external circuitry. But, in this case it was not sending data.

when I connect the serial line directly (without a NPN transistor), it was sending data properly.

I have also make sure that the NPN transistor is not faulty.

So, Why serial line is not switching by a transistor? Or is it not possible to switch a serial line like that?

enter image description here

\$\endgroup\$
  • 2
    \$\begingroup\$ What base-emmiter voltage drop do you expect when controlling the base with a digital signal? (BTW, your drawing has E and B swapped) \$\endgroup\$ – Huisman Mar 26 at 14:10
  • 1
    \$\begingroup\$ That will not work as you expect it too. When the digital pin is high the base current will bias both outputs high. Please provide information about the source and destination devices. \$\endgroup\$ – Kevin White Mar 26 at 14:22
  • \$\begingroup\$ @KevinWhite Here the TX pin is of RS232 IC. Initially I want to keep it open and close whenever I need to do data transmission. So how can I communicate in this case? Anything I should change so that I can switch the TX line? \$\endgroup\$ – Aakash Dey Mar 26 at 14:37
  • \$\begingroup\$ @Huisman, For me it is not possible to calculate the drop during signal transmission. But, I have connected a LED which is controlled by similar way. In this condition, the LED is drawing 7mA current and 600mV drop is found in this case. \$\endgroup\$ – Aakash Dey Mar 26 at 14:47
  • \$\begingroup\$ You mention an RS232 IC. Does it produce +/- voltage at its output? RS-232 (EIA-232) signaling voltage is not zero-referenced: logic 0 can be -3 ~ -15 volts, and logic 1 can be 3 ~ 15 volts. \$\endgroup\$ – AlmostDone Mar 26 at 15:17
1
\$\begingroup\$

The circuit configuration as shown won't work. But why?

Note that for a forward biased NPN transistor, the emitter voltage will be equal to the base voltage - 0.6V. That means the emitter voltage won't toggle when the transistor is on or off since it's effectively locked to the base. Even a MOSFET would not work here without some additional non-trivial circuitry.

I would normally suggest that a switch is unnecessary as the UART won't toggle when there is no data to send. But let's assume you really do want to be able to disable the UART output. I'm also going to assume that the signals are 0-VCC UART levels NOT bipolar RS-232 signals.

If you really do need to be able to disable it, here is another way: a different idea

When the base control voltage is high, the transistor turns on which pulls the output signal to GND. In this state no pulses make it out.

When the base voltage is low, the transistor is off and has no effect on the signal. Both R1 and R2 are mandatory.

\$\endgroup\$
  • \$\begingroup\$ Thanks. I am using MAX 232, its an bipolar IC. What can I do to switch its serial lines. \$\endgroup\$ – Aakash Dey Mar 27 at 5:14
  • 1
    \$\begingroup\$ I know this may seem antiquated, but have you considered using a SMALL relay. A semiconductor analog switch is going to require bipolar power supplies and probably is beyond what you're willing to do. \$\endgroup\$ – Randy Nuss Mar 27 at 19:45
  • \$\begingroup\$ A relay will also not work with Bipolar RS232. Am I right? \$\endgroup\$ – Aakash Dey Mar 28 at 6:25
  • \$\begingroup\$ A relay would work great for you. Remember that a relay is nothing more than a set of metallic contacts controlled by an electromagnet. For something like this you want something small. An SPST-NO (single pole single-throw normally open) reed relay would work. Take a look at the Littelfuse HE3621A0510. It's about a dollar on Digikey.com. Make sure to note the polarity of the built-in suppression diode across the coil. Connect your microcontroller control bit to pin 2 and pin 3 to gnd. \$\endgroup\$ – Randy Nuss Mar 29 at 13:50
  • \$\begingroup\$ OK. let me to test with relay. \$\endgroup\$ – Aakash Dey Mar 30 at 5:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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