8
\$\begingroup\$

I’m trying to switch 12V (max 30mA) with a signal from a MCU that I’d prefer to be active low (so the output voltage is 12V when the control signal is 0V, and 0V when the control signal is 5V).

Since I have plenty of bipolar transistors at hand, I’m looking for a solution using bipolar transistors. For an active high signal, I found an answer on this site which seems to work perfectly, and it seems this can be adapted to an active low signal by adding yet another PNP transistor:

schematic

simulate this circuit – Schematic created using CircuitLab

However, 3 transistors for what seems to be a fairly simple problem seems a bit excessive. Is there a better solution?

\$\endgroup\$
11
\$\begingroup\$

How about this for an idea.

With the input at 5V no current can flow through the zener (5 + 9 > 12). The output PNP transistor of held OFF by the base emitter resistors (= 4k7 + 2k2) and the output is 0. When the input is pulled down to 0V a small current will flow through the base and the 2k2 resistor. The junction of the two resistors will be a 9V (the zener voltage) and the base will be at 11.4V (assuming a 0.6V Vbe drop). The total current flowing through the base and zener (sink current) will be added (Kirchoff's current law). With values shown the base current will be 0.5mA and the resistor current 1.4mA giving a sink current of just under 2mA.

enter image description here

\$\endgroup\$
  • \$\begingroup\$ This is a good circuit; 5+9>11.5 therefore it should work. \$\endgroup\$ – Andy aka May 23 '13 at 9:37
  • 1
    \$\begingroup\$ It is better to draw schematics so the "flow" goes from left to right (inputs on the left, outputs on the right), i.e. a mirror image of what you have now. \$\endgroup\$ – tcrosley May 23 '13 at 10:14
  • 5
    \$\begingroup\$ @ tcrosley Convention wise you are correct but I was simply trying to show the circuit in the same way that it had been asked in the question to make the comparison clearer. As was pointed out to me a long time ago - Rules are for the abeyance of fools and the guidance of wise men. \$\endgroup\$ – JIm Dearden May 23 '13 at 10:30
  • 3
    \$\begingroup\$ +1 for a different approach, rather than attempting make every problem a nail for the transistor hammer :-) \$\endgroup\$ – Anindo Ghosh May 23 '13 at 10:58
  • \$\begingroup\$ So, how would I translate this to 18v instead of 12v? 5 + 9 < 18 and do I need to adjust the resistors to keep the junction of the two resistors at 9v? \$\endgroup\$ – ThatAintWorking Dec 12 '14 at 22:54
8
\$\begingroup\$

You can achieve this with two NPN transistors as shown below. As you can see, whenever a 0V signal is given, 12V is seen in the output, and whenever a 5V is given in the input, 0V is seen on the output.

Let's see how it works. First of all, let's start with the scenario where the input is 5V, or in other words, HIGH. This will turn Q1 ON and the voltage on the collector of Q1 will be almost equal to the voltage on its emitter, which is GND. Q2's base is connected to Q1's collector, so when there is 0V on Q1's collector, or in other words when Q1 is ON, Q2 is OFF. That is because Q2's base will be shorted to ground.

When the input is 0V, or LOW, Q1 will not turn ON and can be imagined as being not connected at all. So, the current passing through R1 will turn ON Q2.

The current of Q2 is limitied with its base current and hFE, as it can bee seen in the below equation;

\$I_{CQ2}=I_{BQ2}*hFE_{Q2} = \dfrac{12-0.6}{10*10^3}*300=350 mA \$

As it can be seen, maximum current that can pass through Q2 is about 350mA. But this highly depends on hFE of the transistor, which can vary anywhere from about 50 to 300. With a hFE of 50, the current can be maximum of about 60 mA, which is enough for your specs. Lowering R1 will increase the current that Q2 will pass.

enter image description here

\$\endgroup\$
  • \$\begingroup\$ Thanks for this solution! One constraint I did not mention in my question is that a high side switch would be much easier for me to deal with in the overall problem than this low side switch is. \$\endgroup\$ – microtherion May 23 '13 at 12:38
1
\$\begingroup\$

Here's an idea: -

enter image description here

Two NPNs and a PNP for the output stage. Resistor R is optional but some folk like to see one there. Make it 4k7.

With a logic 1 drive from the MCU, the middle transistor's base is shorted to ground and so collector current won't flow and therefore the output transistor will be off.

\$\endgroup\$
  • \$\begingroup\$ How could the PNP's base current ever be non-zero without R? \$\endgroup\$ – avakar May 23 '13 at 8:02
  • \$\begingroup\$ @avakar I did say it was optional but if i were being picky i'd say that with no collector current from the middle npn there will be no base current into the pnp. \$\endgroup\$ – Andy aka May 23 '13 at 9:34
  • \$\begingroup\$ @Andyaka, could you explain why this is an improvement over my original circuit? From my naive perspective, the component count of the two approaches is pretty much identical. Is the problem that my circuit would not work in practice? \$\endgroup\$ – microtherion May 23 '13 at 12:34
  • 1
    \$\begingroup\$ @microtherion good point - I re-read your question and now realize that you'd added the extra transistor for the inversion. OK to be a little petty is not my nature but, my circuit doesn't need a +5V connection and will work down to a MCU input of approximately 1V. Yours will still need the 5V connection and your input needs to go between 0V and this voltage (although it could be 3v3 or less). Your input does need to swing up to close the the MCU power rail to properly operate whereas mine needs to swing close to 0V to operate. Swings/roundabouts etc.. \$\endgroup\$ – Andy aka May 23 '13 at 13:06
  • \$\begingroup\$ @Andyaka, my bad, I read "no R" as "R=0" instead of "R=infinity". With the latter it makes sense :) \$\endgroup\$ – avakar May 23 '13 at 16:52

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.