Need help with using a NPN as an inverting power switch.

Started by alparent, February 14, 2011, 02:13:55 PM

Previous topic - Next topic

alparent

I'm building something using a Arduino.
I want to control a 9v source using the 5v pin from my Arduino.
I'm using a 2N3409 NPN. What I need to learn is how to calculate the values of the resistor between the +9v and the transistor so I get the max voltage from the 9v but that everything else is safe from harm.
I'm presently using a 10k but I would like to know how to calculate it and not just take 10k as a default.
Or is 10k OK and I'm trying to complicate things again?

Basically I'm making a transistor inverter and I need to know how to calculate the best value for the resistor going from the Arduino pin (+5v) to the base of the transistor and the value of the resistor going from my +9v to the collector of the transistor to feed 9v to the control pins of a CD4066.

I'm using the example and the bottom of this page http://www.kpsec.freeuk.com/trancirc.htm

R.G.

Quote from: alparent on February 14, 2011, 02:13:55 PM
I'm building something using a Arduino.
I want to control a 9v source using the 5v pin from my Arduino.
I'm using a 2N3409 NPN. What I need to learn is how to calculate the values of the resistor between the +9v and the transistor so I get the max voltage from the 9v but that everything else is safe from harm.
I'm presently using a 10k but I would like to know how to calculate it and not just take 10k as a default.
Or is 10k OK and I'm trying to complicate things again?
It depends. Are you switching the negative side of the 9V supply, or the positive side?

NPN switches are most useful for switching the negative side of a power supply, as it's easy to drive their base-emitter that way from the minus side. Trying to use an NPN to switch the positive ("high side") is much harder with NPNs or N-channel MOSFETs because you have to generate a signal higher than the high side of the power supply to run the base/gate.

It is simpler to switch the low (most negative) side with an NPN or N-channel, and switch the high side with a PNP or P-channel.

However, if you are using the NPN to switch the low side and want to know what base limiting resistor you need, there's another set of considerations.

You need to know how much current the NPN will be pulling through its collector. And you need to decide how little voltage you will sacrifice to the voltage across the collector-emitter when the switch is closed.

A bipolar transistor can never achieve zero volts between collector and emitter when used as a power switch. They can get down to the 50mV range for low currents and hard base drive. What matters is the current gain of the transistor and the degree to which the transistor doping can give a very low collector emitter voltage. As illustration, look here: http://www.fairchildsemi.com/ds/2N/2N3904.pdf

Under "Absolute Maximums" note that the maximum voltage it can switch is 40V with no current flow, and the maximum current is 200ma. Operation outside those limits may kill the device.

Under "Electrical Characteristics" and "On Characteristics", observe the collector-emitter satuation voltage, which is given as 0.2V with Ic=10ma and Ib=1ma, and also as 0.3V with Ic=50ma and Ib=5ma. If you divide Ic by Ib in these examples, you get a current gain of 10. But immediately above that, HFE is given as 30 to 300, never as low as 10. What gives?

When a bipolar transistor saturates, you can force it to saturate harder by driving in more base current. A 3904 may go down to 0.8V if the collector current is, say, 100ma and the base current it 1ma, effectively a current gain of 100. If you force in more base current, say, 10ma, the collector voltage will drop further, to maybe 0.4V. It's a better switch.

So when you're trying to switch current, the gain is even more a variable than it is in linear circuits. You have to pick how hard you want it to switch on, then provide that much base current. If you're providing current from 5V (i.e. the Arduino output) and the base-emitter voltage may rise to as much as 0.8V or more with the extra current you're driving in. Then the resistor to make, say, 10ma of base current flow is (5V-0.8V)/10ma = 4.2V/0.01 = 420 ohms! If you only needed ma of base current, you'd only need a base limiting resistor of 820 ohms. But 10K is a distant memory.

For switching, the amount of current into the base and the "gain" get decoupled.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

familyortiz

Alparent,
 Are you using the npn to switch the 9v supply to source power or just inverting the a signal to send to the control inputs only, of the 4066?
The current drive requirements of the second case are way lower.

alparent

I'm using it to supply >6v to the control pins of the 9v powered CD0466.
The inversion is just a side effect of using this method.
I think the voltage is more important then the current to drive CMOS (If I'm understanding all of this correctly?)

R.G.

Quote from: alparent on February 14, 2011, 06:24:10 PM
I'm using it to supply >6v to the control pins of the 9v powered CD0466.
The inversion is just a side effect of using this method.
I think the voltage is more important then the current to drive CMOS (If I'm understanding all of this correctly?)
Oh. Sorry - ignore that treatise on switching power with transistors. You're switching 9V as a signal. That's different in many ways.

First, the CMOS inputs are very nearly open circuits, at least as far as the NPN transistor is concerned. They need so nearly zero current that you can ignore them.

When I switch CMOS input signals this way, I often use 100K pullup resistors to 9V. This will pull the CMOS input to 9V reliably, and not pull significant current through the NPN. Anything from about 1K up to 1M works fine. For the base resistor from the controller output, you can be even looser. 100K is fine, 10K is fine. The base current will be 5V from the Arduino, minus about 0.5V base-emitter, divided by the series resistor. This resistor can be up to 100 times the collector resistor because the current in the collector is so small. Between 10K and 100K should work fine.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

alparent

Quote from: R.G. on February 14, 2011, 06:35:24 PM
Oh. Sorry - ignore that treatise on switching power with transistors. You're switching 9V as a signal. That's different in many ways.

I don't think so! All this great information! No way I'm ignoring this.
Might not apply to this situation.......but learning is always good.

And I've just learned to be more specific when I'm asking for help!  ;D