Hello all. I'm building a spreadsheet to calculate the base resistor value to be used when employing a transistor as a switch. I've selected a 2N3904 as an example. Collector current would naturally be dependent on the load being driven; my selection of 100ma is the high end rating for the 3904. The 'Base Signal Voltage' is what would normally be expected from an Arduino output. Vbe and Hfe were obtained from the manufacturer's data sheet Intelligent Power and Sensing Technologies | onsemi.
Below is the formula I used and the resulting calculations.
Is the formula correct and are my calculations correct for this device under the conditions given?
In my internet probing of this topic I've come across some suggestions that fudging various values (such as doubling Ic) ensures that the transistor is saturated. What are your suggestions, if any, regarding that?
Thanks - Scotty
Base resistance =
(Base Signal voltage – voltage drop aka Vbe(sat) / (Collector current / Beta aka Hfe)
Required Collector Current 0.1A
Base Signal Voltage 5v
Voltage Drop Vbe(sat) 0.65v
Beta (Hfe) 30
Ib 0.003333333A
That looks OK.
Having more than the required base current is not normally a problem. The only down side is that due to base charge storage it can take slightly longer to turn the transistor off.
Always use the minimum gain you see in a data sheet for you calculations, doubling or half as much again is a good thing to do normally.
When using a transistor as a switch, typically the base current drive provided is one-tenth of the collector current being switched. This is also the condition at which Vce(sat) is usually quoted on the datasheet. The 2N3904 datasheet gives:
VCE(sat) Collector-Emitter Saturation Voltage:
IC = 10mA, IB = 1.0mA -> 0.2V
IC = 50mA, IB = 5.0mA -> 0.3V
I wouldn't use a 2N3904 to switch more than 50mA, I'd use something with good hfe and specified Vce(sat) at higher current, such as BC327.
scottyjr:
(Base Signal voltage – voltage drop aka Vbe(sat) / (Collector current / Beta aka Hfe)
Required Collector Current 0.1A
Base Signal Voltage 5v
Voltage Drop Vbe(sat) 0.65v
Beta (Hfe) 30
Ib 0.003333333A
Base resistor value 1305 ohms
What you've calculated is the absolute maximum value of the resistor, ie. It can't be bigger than that.
It's not necessarily the correct value though. For a start you have to choose a standard resistor value and it should be easy to find. Most people would also put something a bit smaller to allow for variability in the components. In this case you could use 1k, 470 ohms...whatever's in your box.
The only disadvantage of using smaller resistors is that you're wasting a tiny bit of power*, ie. the extra current flowing from base to emitter.
(* ...unless you go too low and exceed the device ratings, in which case the transistor dies).
Isn't it an advantage to have smaller resistors for that?
No, the charge storage comes into effect when the transistor drive is removed, it takes time fro them to be swept out of the transistors base region. The base capacitance will not discharge through the drive resistor because it is a diode.
Isn't it an advantage to have smaller resistors for that?
No, the charge storage comes into effect when the transistor drive is removed, it takes time fro them to be swept out of the transistors base region. The base capacitance will not discharge through the drive resistor because it is a diode.
OK. I thought some of it would go out through the resistor when the Arduino pin goes low.
(I'm just a hacker. I'm not going to argue with somebody who describes himself as "grumpy" and knows all about transistor base capacitance...)
The typical approach is to determine the current you will need to switch. In this case, it is 100ma.
beta as specified in a datasheet is for linear applications and has no meaning for a switching application. Typically, people use a "beta" of 10 for switching application, to make sure that the transistor is saturating hard.
So you need a base current of 100ma / 10 = 10ma.
Between your pin's output (close to 5v but you can check the datasheet), the base resistor, and the Vbe of the transistor, you need to drop about 5v. That means the voltage drop on the base resistor is about 5 - Vbe = 4.3v (3.6v for a darlington).
330 or 390 or even 470ohm are good numbers in that they work for a variety of situations and are fool prove: they work for npn / led @ 5v / 3v, under 10ma or 20ma drive; they work for led @ 5v/3v under 4ma drive; they work for mosfet (slow speed); and you can short them safely, ...
They also work for high speed input too: their cut-off frequency with a typical avr pin is 70Mhz, far higher than most practical applications.
dc42:
When using a transistor as a switch, typically the base current drive provided is one-tenth of the collector current being switched. This is also the condition at which Vce(sat) is usually quoted on the datasheet.
Indeed this is usual for most medium-power switching transistors, but there are newer "superbeta" switching transistors around which fare a lot better (keeping high gain at high currents and getting much better saturation voltages at lower base drive) - ZTX851 is one I've used and this quotes min current gain of 100 at 2A collector current (for Vce=1V)... Also at 2A the Vce <= 0.15V if Ib=50mA (base current = 1/40th collector current).
Often this means for larger currents where you want 40mA base drive or more (too much for output pin) with a plain old switching transistor you can move to a super-beta device rather than a darlington and get much less voltage drop out (0.15V Vsat is very respectable at 2A, only 300mW dissipation)
[OK, 50mA is too much but with 30mA the device will drive 1A no sweat at all]
Sorry to dig this thread out of the grave but it seemed useful and It's 22 years since I last really delved into proper electronics so my discreet circuit skills are very rusty.
I believe my total current draw will be 1.5A
My supply voltage will be 12V
Going on the calculation above and trying to find the figures from the data sheet does this seem correct.
Required Collector Current 1.5A
Base Signal Voltage 5v
Voltage Drop Vbe(sat) 1.2v -- from data sheet
Beta (Hfe) 40 -- not sure taken from data sheet???
Calculated Base resistor 101Ohms So go for a 110Ohm Standard resistor.