Shop OBEX P1 Docs P2 Docs Learn Events
Transistor base resistor — Parallax Forums

Transistor base resistor

TCTC Posts: 1,019
edited 2014-06-27 04:50 in General Discussion
Hello all,

I have a small brushless DC fan that I want the prop to turn ON and OFF. The fan is 5V, and requires 200mA max of current. I am going to use a transistor to switch on and off the fan, and with the help from others on here, I think I have a grip on deciding what part I need and what base resistor I need.

But I want to make sure I am figuring things out right.

I need a DC gain of at least 13
200mA (LOAD CURRENT) / 15mA (BASE CURRENT)

Looking on DigiKey I found a transistor that is rated 800mA (cant hurt to have more than I need). It has a DC gain of 60 (Vce = 1V, Ic = 300)

So I would need a base resistor of 761Ω
3.3V (FROM PROP) * 60 (fHE) / ( 1.3(LITTLE WIGGLE ROOM) * 200mA)

I think the 2N2222 would work as well, and I might just use it. But I want to make sure I am right on my math.

Please let me know if I am right, or wrong.

Thanks
TC

Comments

  • evanhevanh Posts: 15,925
    edited 2014-06-24 05:47
    You've missed out the 0.7 volt lost to turning on the base.

    However, this is an excellent place to use a mosfet instead. There's no gate current when being used as a static switch like that.
  • TCTC Posts: 1,019
    edited 2014-06-24 06:00
    evanh wrote: »
    You've missed out the 0.7 volt lost to turning on the base.

    I completely forgot about that, Thanks
    However, this is an excellent place to use a mosfet instead. There's no gate current when being used as a static switch like that.

    I have never designed anything around a mosfet. How would I figure out what I should use, and what support parts do I need?
  • Mark_TMark_T Posts: 1,981
    edited 2014-06-24 06:53
    Transistor gain is a property of operation in the analog, linear region, not relevant
    for switching.

    In general to switch a BJT you need to fully saturate the device so that the voltage loss
    is down to 0.1V or so, which commonly is done by providing about 5% to 10% of the collector
    current to the base.

    So for a 200mA load 10 to 20mA of base current would be used, so a resistor in the range
    270 or 120 ohms would be appropriate. You allow 0.7V or so for Vbe (for a large high
    current BJT Vbe can be as much as 1.2V, though.

    You have to decide if high-side or low-side switching is appropriate for you. High-side
    uses a PNP transistor, low-side an NPN.

    If the supply is higher than the microcontroller supply (5V as opposed to 3.3V) then high-side
    switching will require level-shifting too. This makes low-side switching often easier to do.

    As for MOSFETs choose a logic-level device that has Rds(on) quoted for Vgs=3.3V - ignore
    the current rating and threshold voltage, choose a device with the Rds(on) low enough that
    the power dissipation is OK and you won't lose more than 0.1V across it.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-06-24 07:06
    The 2N2222 can easily handle 500ma and some versions go higher.

    While a MOSfet will work, I can't easily get the ones that will without importing to Taiwan and then they are all SMD devices -- no through-hole devices for the latest and greatest.

    So I would go with the 2N2222 and accept that the 5v output will drop to 4.3v by its insertion. At saturation, the PDF says that 15ma will deliver 150ma, and 50ma will deliver 500ma. So you may have to provide 20ma to the base to get what you want.

    A MOSfet would load the Propeller i/o pin much less that 20ma for full on.
  • Mark_TMark_T Posts: 1,981
    edited 2014-06-24 07:11
    So I would go with the 2N2222 and accept that the 5v output will drop to 4.3v by its insertion.

    Its NPN, thus it should be a low-side switch and the voltage loss across it should only be 0.1 to 0.2V.

    Gain is for linear region, forget gain and look at the Vce(sat) table in the datasheet for its switching performance.
  • TCTC Posts: 1,019
    edited 2014-06-24 07:49
    Mark_T wrote: »
    Transistor gain is a property of operation in the analog, linear region, not relevant
    for switching.

    In general to switch a BJT you need to fully saturate the device so that the voltage loss
    is down to 0.1V or so, which commonly is done by providing about 5% to 10% of the collector
    current to the base.

    So for a 200mA load 10 to 20mA of base current would be used, so a resistor in the range
    270 or 120 ohms would be appropriate. You allow 0.7V or so for Vbe (for a large high
    current BJT Vbe can be as much as 1.2V, though.

    The transistor I am calculating with has a Vbe of 1.2V (Vce = 1V, Ic = 300mA)

    So that would be (3.3V - 1.2V) * 60 / 230mA = 574Ω (just trying to get a handle on it)
    Am I correct?

    You have to decide if high-side or low-side switching is appropriate for you. High-side
    uses a PNP transistor, low-side an NPN.

    If the supply is higher than the microcontroller supply (5V as opposed to 3.3V) then high-side
    switching will require level-shifting too. This makes low-side switching often easier to do.

    I was planing to use a low-side switching.
    As for MOSFETs choose a logic-level device that has Rds(on) quoted for Vgs=3.3V - ignore
    the current rating and threshold voltage, choose a device with the Rds(on) low enough that
    the power dissipation is OK and you won't lose more than 0.1V across it.

    Would I use Ohms law to figure out if Rds is low enough? DigiKey's search is showing a list of different values ( 3mOhm @ 14A, 4.5V )


    The 2N2222 can easily handle 500ma and some versions go higher.

    While a MOSfet will work, I can't easily get the ones that will without importing to Taiwan and then they are all SMD devices -- no through-hole devices for the latest and greatest.

    I am looking for something that has both through hole and SMD. for testing I am going to use through hole. But the final design is going to be SMD.

    So I would go with the 2N2222 and accept that the 5v output will drop to 4.3v by its insertion. At saturation, the PDF says that 15ma will deliver 150ma, and 50ma will deliver 500ma. So you may have to provide 20ma to the base to get what you want.

    A MOSfet would load the Propeller i/o pin much less that 20ma for full on.

    I only picked the transistor I did, because I wanted to understand what values I needed. The 2N2222 is to easy to calculate.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-06-24 08:24
    The information I provided is for Vce(sat). Since the Propeller outputs a full 3.3VDC, the V exceeds the 1.2 at Vbe and the load is only 1.0volt.

    The situation is that the PDF provides information for ALL possible uses.
    A. small signal amplification applications
    B. switching applications (pretty much for digital signal transmission and reception)
    C. saturation loading

    So if you can't see the three different contexts, you get lost in the details.

    To make things a little harder, the column data doesn't provide answers for all situations -- just a few guide line values. Sometimes you have to read the graphs to get the information you desire.

    http://www.radio-electronics.com/info/data/semicond/bipolar-transistor-bjt/datasheet-specifications-parameters-definitions.php

    And then, you have to learn a completely different skill to read MOSfet specifications. They tend to omit the linear mode of small signal applicaitions, amplify by voltage control (not current control), and so on.

    ++++++++++++++
    You could just breadboard the fan and a 2n2222 and verify that it gets 200ma when a certain amount of ma turn on the base. Nothing wrong with some real testing.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-06-24 09:31
    It pays to be conservative with the power ratings of the transistor. I'm partial to the nice "e-line" transistors from Diodes Inc.. The ZTX1049A for example can handle large pulse currents and relatively high power, and as a superbeta transistor it requires far less current to drive into saturation. Why waste current from a Prop pin just to drive the base of the transistor?
    Screen shot 2014-06-24 at 9.17.34 AM.png
    ztx1049

    A mosfet doesn't have wasted base current. However even with a mosfet there is need for a couple of resistors, one Rgs to hold it OFF when it first powers up, and a small resistor in series with the gate as good practice to suppress oscillations that can sometimes occur as it transitions through the active region.

    And don't forget the kickback diode across fan, to protect the transistor.
  • JonnyMacJonnyMac Posts: 9,105
    edited 2014-06-24 10:28
    With either device, be sure you include a pull-down for the pin so the motor doesn't operate when the Propeller is booting up (pins are not yet defined, hence floating).
  • TCTC Posts: 1,019
    edited 2014-06-24 15:33
    Thank you everyone. Im sorry I could not respond sooner.
    The situation is that the PDF provides information for ALL possible uses.
    A. small signal amplification applications
    B. switching applications (pretty much for digital signal transmission and reception)
    C. saturation loading

    So if you can't see the three different contexts, you get lost in the details.

    Yea, tell me about it. I have found that out from a lot of datasheets I have seen.

    To make things a little harder, the column data doesn't provide answers for all situations -- just a few guide line values. Sometimes you have to read the graphs to get the information you desire.

    http://www.radio-electronics.com/info/data/semicond/bipolar-transistor-bjt/datasheet-specifications-parameters-definitions.php

    And then, you have to learn a completely different skill to read MOSfet specifications. They tend to omit the linear mode of small signal applicaitions, amplify by voltage control (not current control), and so on.

    I have noticed that about the graphs. Thanks for the link, it answered a couple questions. And offered A way for me to find more information. I'm just starting to get a grip on transistors, I think I will hold off on mosfets until I have transistors down pat.


    You could just breadboard the fan and a 2n2222 and verify that it gets 200ma when a certain amount of ma turn on the base. Nothing wrong with some real testing.

    I completely agree. I just want to try and understand the calculations behind my testing.
    It pays to be conservative with the power ratings of the transistor. I'm partial to the nice "e-line" transistors from Diodes Inc.. The ZTX1049A for example can handle large pulse currents and relatively high power, and as a superbeta transistor it requires far less current to drive into saturation. Why waste current from a Prop pin just to drive the base of the transistor?
    Screen shot 2014-06-24 at 9.17.34 AM.png
    ztx1049

    Haha... I have been playing with some ZTX651 for a few days now. I have fried quite a few 2N3906 experimenting. But so far, I have not fried a single one. I do like it though. with 5V for the fan, a 1kΩ pot, one leg going to ground, the other leg going to 3.3V, and the wiper going to base. I can adjust the voltage to the base, and see what happens. Right now I am seeing that 5mA on the base, will allow the fan to run at full speed.

    And don't forget the kickback diode across fan, to protect the transistor.

    I didnt think a brushless fan needed a kickback diode...... Am I wrong?

    JonnyMac wrote: »
    With either device, be sure you include a pull-down for the pin so the motor doesn't operate when the Propeller is booting up (pins are not yet defined, hence floating).

    Glad you said something, I know I would've forgot that.
  • jmgjmg Posts: 15,173
    edited 2014-06-24 16:15
    TC wrote: »
    I do like it though. with 5V for the fan, a 1kΩ pot, one leg going to ground, the other leg going to 3.3V, and the wiper going to base. I can adjust the voltage to the base, and see what happens. Right now I am seeing that 5mA on the base, will allow the fan to run at full speed.

    You should have a resistor in the wiper, (eg 90 Ohms) to prevent accidents of 3v3 direct to base => instant fried part.

    With that setup, measure Ib and also Vce(sat) and plot them on a simple graph.
    Check with a stalled fan, and see if you can measure the starting current.

    Try all the different transistors you have.

    Your hfe maths, only gives you a corner case, so is ok for a reality check, but not for Vce(sat) testing.
    The more important figure in all this, is the voltage drop across the transistor. or Vce(sat)

    Decide how much that should be 100mV ? 200mV ? 300mV ?, then find the Rb each transistor needs, for that.
    Avoid > 1V, at that is >~ 200mW loss in the transistor. Cool to touch is always better than hot.
  • TCTC Posts: 1,019
    edited 2014-06-24 17:37
    jmg wrote: »
    You should have a resistor in the wiper, (eg 90 Ohms) to prevent accidents of 3v3 direct to base => instant fried part.

    Yep... I figured that one out the hard way. How do you think I fried the 2N3904's I had? :innocent:

    Now all I do is not to turn the pot all the way. :smile:


    With that setup, measure Ib and also Vce(sat) and plot them on a simple graph.
    Check with a stalled fan, and see if you can measure the starting current.

    Did not think of using a graph. Mostly because I only have one meter, and it is a hassle to unhook the base, and put the meter in-line. then do the same thing for the fan. But I will have to do it, to get a better understanding.
    Try all the different transistors you have.

    Been doing that. I have also been pushing them to there breaking point, and seeing when/where that is. But I am not just hooking them up and turning the pot all the way up. just to watch them blow. I am using my meter to see what voltages/currents do what.
    Your hfe maths, only gives you a corner case, so is ok for a reality check, but not for Vce(sat) testing.
    The more important figure in all this, is the voltage drop across the transistor. or Vce(sat)

    I was not planning to use it as a replacement for testing, but only to confirm what I am testing. That is why I want to know if I am right with the math. Because I could be testing something that could be wrong, but the math is saying it's right.
    Decide how much that should be 100mV ? 200mV ? 300mV ?, then find the Rb each transistor needs, for that.
    Avoid > 1V, at that is >~ 200mW loss in the transistor. Cool to touch is always better than hot.

    Yep.... found that out the hard way... :lol:
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-06-24 18:33
    >Did not think of using a graph. Mostly because I only have one meter, and it is a hassle
    >to unhook the base, and put the meter in-line. then do the same thing for the fan.

    Not if you have a 100Ω resistor in series with the pot wiper like jmg suggested and also put a 1Ω resistor in series with the fan. Then you can simply measure the voltage across those resistors to determine the current and you don't have to unhook anything to make all the measurements with your one meter.

    > I didnt think a brushless fan needed a kickback diode...... Am I wrong?
    You're probably right about that, but I'd like to hear from people more knowledgeable about it. I've had the same question, because I too have a BLDC fan that is turned on and off with a transistor. It is a tiny 15mm Sunon blower, this one. It draws only 35mA. Here is what the signal looks like when the transistor turns it off (high side p-channel fet to 3.3V).
    sunon_off_pulses.png

    Yellow trace 1 triggers when the transistor turns the fan off, and you can see that there is no back kick, but there is fuzz. The orange trace B time-expands the fuzz and you can see that it a series of low pulses starting at about 0.7V and dying out. Those must be feedthrough from the windings as the motor continues to spin. The purple trace is the tachometer output, shifted over to show that it matches the pulses. It is a 6-pole motor running at 14000 rpm and the tach gives 6 pulses per revolution.
    640 x 480 - 8K
  • TCTC Posts: 1,019
    edited 2014-06-25 03:22
    >Did not think of using a graph. Mostly because I only have one meter, and it is a hassle
    >to unhook the base, and put the meter in-line. then do the same thing for the fan.

    Not if you have a 100Ω resistor in series with the pot wiper like jmg suggested and also put a 1Ω resistor in series with the fan. Then you can simply measure the voltage across those resistors to determine the current and you don't have to unhook anything to make all the measurements with your one meter.

    And see.... This is why I like to ask on here. There are so many wonderful, knowledgeable people on here. Measuring the voltage drop of a set resistor never crossed my mind. I think I might buy some =<1% resistors just for this kind of testing. Thanks.

    > I didnt think a brushless fan needed a kickback diode...... Am I wrong?
    You're probably right about that, but I'd like to hear from people more knowledgeable about it. I've had the same question, because I too have a BLDC fan that is turned on and off with a transistor. It is a tiny 15mm Sunon blower, It draws only 35mA. Here is what the signal looks like when the transistor turns it off (high side p-channel fet to 3.3V).
    sunon_off_pulses.png

    Yellow trace 1 triggers when the transistor turns the fan off, and you can see that there is no back kick, but there is fuzz. The orange trace B time-expands the fuzz and you can see that it a series of low pulses starting at about 0.7V and dying out. Those must be feedthrough from the windings as the motor continues to spin. The purple trace is the tachometer output, shifted over to show that it matches the pulses. It is a 6-pole motor running at 14000 rpm and the tach gives 6 pulses per revolution.

    I have to get an oscilloscope, so I can see stuff like this. I got the motor when the Dayton Hamvention was going on. I paid $1 for it (Beat that Erco :lol:), so I don't have any specs except what is on the sticker. I would assume it is a cheap china knockoff. I think I'm going to add the diode, and I think I am also going to add a 1.0µF cap to the fan, in hopes to filter out the noise coming from the fan.
  • lardomlardom Posts: 1,659
    edited 2014-06-25 07:19
    The transistor base is a diode while the mosfet gate is a capacitor. I would make the mosfet a separate project. I try to work with one unknown at a time.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-06-25 13:21
    I do have a diode in there now, but may not need it. The fan is so small, and I don't see any evidence on the 'scope of a kick as the fan turns off. Your motor may well be different, and without evidence to the contrary, it is safe to include the diode.

    The running of the fan here is very quiet. There is none of the kind of hash you can see on a regular motor with brushes that are making and breaking the contacts.

    I wouldn't classify the pulses after the fan turns off as noise. They are more like an interesting side effect, maybe an opportunity to measure the motor's speed without a tachometer. Here are a couple more screen shots. One shows the fan turning on and the gradual buildup in speed of the fan as shown by the tachometer. The second shows the fan shutting off. The tachometer no longer shows the speed because it no longer has power. But the pulses fed through from the motor still do reflect its speed. The fan actually keeps turning for much longer than the 'scope trace might suggest. It keeps turning for a little over a second after the power is off, good bearings. Who knows if your motor would do the same thing. but is probably not important and is just a curiosity. Oscilloscopes are indeed useful tools.

    sunon_acceleration.png
    sunon_deceleration.png

    purple = power to fan, and emf pulses
    red = fan tachometer
    640 x 480 - 7K
    640 x 480 - 7K
  • Mark_TMark_T Posts: 1,981
    edited 2014-06-25 15:56
    However even with a mosfet there is need for a couple of resistors, one Rgs to hold it OFF when it first powers up, and a small resistor in series with the gate as good practice to suppress oscillations that can sometimes occur as it transitions through the active region.

    Just an aside about this - I have an old MOSFET databook from Motorola (1985) from when MOSFETs were new and it
    explains the gate resistor thing. If you _parallel_ 2 or more MOSFETs then the inductance in the gate and source leads
    can interact with the various capacitances in the devices to make an oscillator - here gate resistors or ferrite beads reduce
    the Q and prevents oscillation. If you have a single MOSFET this mode isn't possible.

    A more obvious reason gate resistors are needed when paralleling devices is the large (1..2V) spread in
    plateau voltage between devices - this can cause very unequal current sharing during switch on and off.
    Resistors mean the gates can each be at their own plateau voltages during the switching. Of course
    driving the gates hard means switching time is short anyway so the duration of unequal current sharing
    is short.

    Driving a modern MOSFET from a MOSFET driver chip (output impedance perhaps 5 to 30 ohms) doesn't
    need a gate resistor except to reduce switching transients. Driving a MOSFET gate from a Prop pin
    requires a resistor to limit the surge current and protect the Prop pin (MOSFETs can have input capacitances
    as high as 20nF).
  • TCTC Posts: 1,019
    edited 2014-06-26 05:16
    lardom wrote: »
    The transistor base is a diode while the mosfet gate is a capacitor. I would make the mosfet a separate project. I try to work with one unknown at a time.

    Agreed. If I jump back and forth, I will not learn anything.

    I do have a diode in there now, but may not need it. The fan is so small, and I don't see any evidence on the 'scope of a kick as the fan turns off. Your motor may well be different, and without evidence to the contrary, it is safe to include the diode.

    The running of the fan here is very quiet. There is none of the kind of hash you can see on a regular motor with brushes that are making and breaking the contacts.

    I wouldn't classify the pulses after the fan turns off as noise. They are more like an interesting side effect, maybe an opportunity to measure the motor's speed without a tachometer. Here are a couple more screen shots. One shows the fan turning on and the gradual buildup in speed of the fan as shown by the tachometer. The second shows the fan shutting off. The tachometer no longer shows the speed because it no longer has power. But the pulses fed through from the motor still do reflect its speed. The fan actually keeps turning for much longer than the 'scope trace might suggest. It keeps turning for a little over a second after the power is off, good bearings. Who knows if your motor would do the same thing. but is probably not important and is just a curiosity. Oscilloscopes are indeed useful tools.

    sunon_acceleration.png
    sunon_deceleration.png

    purple = power to fan, and emf pulses
    red = fan tachometer

    Yea, I'm going to add a diode across the fan's input wires. It would be cheap insurance. Thanks

    Mark_T wrote: »
    Just an aside about this - I have an old MOSFET databook from Motorola (1985) from when MOSFETs were new and it
    explains the gate resistor thing. If you _parallel_ 2 or more MOSFETs then the inductance in the gate and source leads
    can interact with the various capacitances in the devices to make an oscillator - here gate resistors or ferrite beads reduce
    the Q and prevents oscillation. If you have a single MOSFET this mode isn't possible.

    A more obvious reason gate resistors are needed when paralleling devices is the large (1..2V) spread in
    plateau voltage between devices - this can cause very unequal current sharing during switch on and off.
    Resistors mean the gates can each be at their own plateau voltages during the switching. Of course
    driving the gates hard means switching time is short anyway so the duration of unequal current sharing
    is short.

    Driving a modern MOSFET from a MOSFET driver chip (output impedance perhaps 5 to 30 ohms) doesn't
    need a gate resistor except to reduce switching transients. Driving a MOSFET gate from a Prop pin
    requires a resistor to limit the surge current and protect the Prop pin (MOSFETs can have input capacitances
    as high as 20nF).

    As " lardom " suggested, I am going to work with one thing at a time. I have not got a 100% full grip on transistors, and it would be best for me to focus on one thing at a time.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-06-26 05:51
    I am constantly up against the trade off of what is the absolute best, versus 'What is best for this particular project?'

    Superbeta transistors are superior to the good old 2N2222, and MOSfets are likely even better. But many times, nothing but the 2N2222 is available locally and ordering from afar is both a time delay and added expense. SMD products are not easy for everyone to manage.

    So all the options mentioned above are valid. Much depends on what you have on hand and what you are willing to spend. Good luck to you.
  • TCTC Posts: 1,019
    edited 2014-06-27 04:50
    I am constantly up against the trade off of what is the absolute best, versus 'What is best for this particular project?'

    Superbeta transistors are superior to the good old 2N2222, and MOSfets are likely even better. But many times, nothing but the 2N2222 is available locally and ordering from afar is both a time delay and added expense. SMD products are not easy for everyone to manage.

    So all the options mentioned above are valid. Much depends on what you have on hand and what you are willing to spend. Good luck to you.

    Agreed! Thank you.
Sign In or Register to comment.