Author Topic: Selecting and driving transistors  (Read 2964 times)

0 Members and 1 Guest are viewing this topic.

Offline mcTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: scotland
Selecting and driving transistors
« on: January 16, 2018, 11:42:36 am »
Having started designing a new project, I've realised that transistor selection and circuit design is something I know very little about. In the past, I've just used common parts that happen to have the current capacity I need, and matched it with a commonly used resistor value to switch it.

I've had a search for tutorials that cover this, but all I've found so far are basic guides to how a transistor works.
Does anybody have any suggestions for any suitable tutorials?


For the specifics of my current project, I'm wanting to use a shift register to power a bank of relays. The relays will have 5V coils, and draw about 50mA.The shift register can drive about 20mA per pin, but is limited to a combine draw of around 70mA, so is limited to a useable 8mA per output.

So given those figures, I've currently picked a SOT-323 transistor capable of 600mA (I'd rather over spec, than under spec), but how do you actually calculate the resistor value for driving the transistor?
Simply use the 5V and 8mA, to get ~825ohm, then multiply that by the gain of the transistor, or do you have to make some allowance for volt drop across the transistor (Which I assume is where all the performance charts in the datasheet come in)?

The transistor I'm currently looking at is DiodesZetex MMST2222A-7-F (RS link - https://uk.rs-online.com/web/p/products/8233141/)
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19523
  • Country: gb
  • 0999
Re: Selecting and driving transistors
« Reply #1 on: January 16, 2018, 12:07:40 pm »
The base current needs to be high enough to pass the desired collector current. The ratio between the collector and base currents is the Hfe.

The Hfe specified on the data sheet is often given with a fairly high collector-emitter voltage. In the case of the MMST2222A, the highest gain is 100 to 300, with a base current of 150mA and a collector-emitter voltage of 10V. This is no good, because it doesn't leave any voltage left fro the load. When the collector-emitter voltage is 1V, the Hfe is only 35.

Ideally, the transistor should be driven into saturation, which is the point, where any increase in base current, will no longer result in an increase in collector current, which is solely dependant on the load. The general rule of thumb, is to make the base current 1/10 of the collector current.

In your case, make the base current 7mA. Assume the base-emitter voltage is 1V. You have 5V, so the voltage across the base resistor will be 4V. R = V/I = 4/0.007 = 571R. Use the nearest standard E12 or E6 resistor value 560R or 680R.

http://docs-europe.electrocomponents.com/webdocs/1321/0900766b81321d10.pdf
 
The following users thanked this post: mc, ratio

Offline mcTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: scotland
Re: Selecting and driving transistors
« Reply #2 on: January 16, 2018, 12:26:03 pm »
Thanks for that explanation Hero. It makes perfect sense.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Selecting and driving transistors
« Reply #3 on: January 16, 2018, 12:39:09 pm »
Alternatively, simply use a power shift register like the TPIC6C595.   Its logically equivalent to a 74HC595, but with open drain outputs rated for up to 100mA each at up to 30V, all on simultaneously, and it also has avalanche clamping on all outputs so no back-EMF protection diodes are required for most inductive loads.  It would drive your 5V 50mA relay coils directly with plenty of margin.   If you need more drive, look at the TPIC6B595 (150mA) or TPIC6A595 (350mA).

If you need to drive individual small transistors from 5V CMOS logic, look at the 2N7000 (2N7002 SMD) MOSFET.   Its gate can be driven direct from the logic with no resistors, and it will have an on resistance of a couple of Ohms when passing 50mA with 5V on the gate.   However it will require back-EMF protection diodes across the relay coils.

Another option would be the ULN2803A - eight 500mA, 50V Darlingtons + base resistors and back-EMF protection diodes connected to their collectors, all in a single 18 pin package suitable for direct connection to your shift register outputs.

No matter what you choose, if there is an unregulated higher voltage rail available, its preferable to use higher voltage relay coils, that draw less current, and run them from the unregulated supply, unless the voltage is inconvenient for sourcing suitable relays.   
« Last Edit: January 16, 2018, 12:57:33 pm by Ian.M »
 
The following users thanked this post: mc

Offline mcTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: scotland
Re: Selecting and driving transistors
« Reply #4 on: January 16, 2018, 12:47:56 pm »
Excellent!
That shift register is exactly what I'd been looking for, but my searches didn't turn any up with that current capability (or RS have them buried in a separate category from the normal shift registers..)

Many thanks for that, as it simplifies things a great deal.
 

Offline paulca

  • Super Contributor
  • ***
  • Posts: 4051
  • Country: gb
Re: Selecting and driving transistors
« Reply #5 on: January 16, 2018, 01:08:26 pm »
I did a bit of this kinda of learning recently.  I wanted to drive a fan from an Arduino digital pin.  The fan was 12V.  I wanted as little drop across the transistor as possible.  Hfe on my 3904s meant to saturate it I need something like 50mA but the ports are rated to something like 40mA.  If I put a resistor on the base to limit it to 40mA I got about 5V to the fan.  I ended up using a darlignton config.  So the first transistor switches in the extra current to drive the second into saturation.  In the end I could drop my base current down to under 10mA.

I'm not even sure I did it right, but it works I have a 2k2 on the base of the pair and the fan gets 11.xV and pulls an appropriate amount of mA, I think the 3904 is rated for 200mA and the fan pulls around 85, 120 if I ramp the voltage up to 15V.

I found a tutorial online, wish I had the link as it gave you the basic equations you needed and was plain and simple, not long tribes of theory and mathematics like a lot of EE tutorials.  Three pages of mathematical theory and then a paragraph which says something like, "99 times out of a 100 it actually simplify down to this simple 3 term equation."  I wish they would do that the other way around.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Selecting and driving transistors
« Reply #6 on: January 16, 2018, 01:26:06 pm »
If you've got free choice of transistors, a MOSFET (with Vgs threshold of less than half your logic voltage) is always going to be a better choice for minimum voltage drop.  However if you are stuck with using BJTs you have in stock, a Darlington pair isn't a great option as its Vce_sat will always be significantly higher than a single BJT.  A better choice is to make the driver an emitter follower, direct from the logic signal, and put the base resistor between it and the output transistor, with the load in the output transistor's collector circuit.   Simply subtract two Vbe drops from the logic '1' level and calculate the base resistor accordingly for 1/10 Ic into the base.

If you need fast turn-off it gets a little trickier, and you'll probably need a base pull-down resistor on the output transistor, or even a  Schottky baker clamp + a reverse biassed Schottky across the driver B-E junction so the logic signal can pull charge out of the output transitor B-E junction as it goes low.
 

Offline paulca

  • Super Contributor
  • ***
  • Posts: 4051
  • Country: gb
Re: Selecting and driving transistors
« Reply #7 on: January 16, 2018, 02:34:12 pm »
I googled "Emitter follower" but I got so many different answers I gave up.

Do you mean just chaining two transistors, so the first raises the current to drive the actual fan driving transistor into saturation?

Oddly that's what I would have done, but I thought a Darlington was a better approach.  I think the difference is just pulling the common collector link.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Selecting and driving transistors
« Reply #8 on: January 16, 2018, 02:52:16 pm »
Try this:   Rb2 is the base pulldown, and is needed for fast(ish) switching.   For simple design, first decide on Rb2, then add the current through it with 0.7V (Vbe) drop across it to the required Ib for Q2 of Ic/10 before calculating Rb1.   To calculate Rb1, use the desired current through it and the voltage across it, which will be the logic high output voltage minus two Vbe drops.

The digital output is only loaded by the current through Rb1 divided by the hFE of Q1.

N.B. the potential divider formed by Rb1-Rb2 must always give significantly more than 0.7V at its tap for the base if Q2 is removed, otherwise Q2 wont be saturated, may not even turn on, and the above simplified design calculation wont work.
« Last Edit: January 17, 2018, 05:28:56 am by Ian.M »
 

Offline paulca

  • Super Contributor
  • ***
  • Posts: 4051
  • Country: gb
Re: Selecting and driving transistors
« Reply #9 on: January 16, 2018, 03:58:05 pm »
Try this:   Rb2 is the base pulldown, and is needed for fast(ish) switching.   For simple design, first decide on Rb2, then add the current through it with 0.7V (Vbe) drop across it to the required Ib for Q2 of Ic/10 before calculating Rb1.

I read this about 6 times, it just leaks back out before I can understand it.  However looking at the schematic.  Q1 is driving Q2.  I can understand Rb1 will limit the current through Q1, less sure as to how that limits the current from the digital pin on Q1's base, but I'm sure there is a relationship.

I don't need fast switching at all.  Can I remove Rb2?

So if the gain is 30 at 100mA, I can have Rb1 set for 30 times the current I want from the digital pin?  Actually Rb1 is confusing as the base voltage will be 5V from the arduino, but the CE will be 12V from the main power rail.  How does that affect the calculation for Rb1 to limit Q1 base current?

I went back to the datasheet, but have left even more confused.  Transistor and op amp datasheets are the worst.  Nothing seems to make sense and when something does the next thing you read seems to contradict it.
https://www.onsemi.com/pub/Collateral/2N3903-D.PDF

Think I need to go back to transistor school.

OP: Sorry to hijack your thread.

I do have one mossfet spare, but it's a TO-220 brute rated for 40A, a little overkill for a 80-130mA fan.

If I was to buy a mosfet I could drive straight off the digital pin, to drive 12V@ max 130mA what would I got for?
« Last Edit: January 16, 2018, 04:09:51 pm by paulca »
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Online David Hess

  • Super Contributor
  • ***
  • Posts: 16616
  • Country: us
  • DavidH
Re: Selecting and driving transistors
« Reply #10 on: January 17, 2018, 04:39:54 am »
The MMST2222A has a minimum hfe (current gain) of 75 between a 10mA and 150mA collector current according to the datasheet.  This means that the 50mA load of the relay will require 0.66mA minimum base current and usually at least a factor of 2 is used for saturated switching so 1.33mA.  This is called operating at a "forced" beta or hfe of 35.  5 volts minus 1 Vbe of about 0.6 volts is 4.3 volts.  4.3 volts / 1.33mA is about 3.3 kilohms.  I would probably use 2.2 kilohms for 2 milliamps for some extra safety margin and a forced beta of 25.

If you use the transistors as emitter followers, then no base resistor is necessary but the roughly 0.6 volt base-emitter voltage drop will be in series with the relays.

Do not forget to place a diode across each relay to absorb the inductive flyback when it turns off.
 

Offline paulca

  • Super Contributor
  • ***
  • Posts: 4051
  • Country: gb
Re: Selecting and driving transistors
« Reply #11 on: January 17, 2018, 02:06:41 pm »
For my use case I just bought some 200mA mosfets with a 2.5V Vgs.  Seems to be the better tool for the job as I don't need any base current just a logic HIGH voltage signal.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Online David Hess

  • Super Contributor
  • ***
  • Posts: 16616
  • Country: us
  • DavidH
Re: Selecting and driving transistors
« Reply #12 on: January 17, 2018, 03:36:43 pm »
For my use case I just bought some 200mA mosfets with a 2.5V Vgs.  Seems to be the better tool for the job as I don't need any base current just a logic HIGH voltage signal.

MOSFETs still require current for charging and discharging the capacitance seen at the gate terminal which will be higher than the capacitance of a bipolar transistor.  In low frequency applications this is not a consideration but in high frequency applications, bipolar transistors may be competitive.

For saturated switching applications, bipolar transistors are less expensive because they require a smaller die for a given voltage, current, and saturated resistance.
 

Offline paulca

  • Super Contributor
  • ***
  • Posts: 4051
  • Country: gb
Re: Selecting and driving transistors
« Reply #13 on: January 17, 2018, 04:17:55 pm »
Yea I picked up on the capacitance thing from a Peter Oakes video, so I'll put a token resistor on the gate so I don't spike the digital pin with a micro current burst.  A 1k or something.

On price, I can't remember but I think the 3904s where like £0.18, the mosfets for the same mA rating where like £0.38.  If you are hoping to ship 10,000 products that's a major issue, but for a few hobby projects it's not at all.
« Last Edit: January 17, 2018, 04:24:46 pm by paulca »
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Selecting and driving transistors
« Reply #14 on: January 17, 2018, 08:26:43 pm »
A small signal MOSFET is likely to take total gate charge of the order of 1nC when driving the gate from 0 to 5V or visa-versa.   That's approximately equivalent to a  200pF load on the digital output (though there will be a plateau near the threshold voltage so its not strictly capacitive) and if the output can source or sink 10mA, it will drive the gate rail to rail in only 100ns.   

You don't actually need a gate resistor for small MOSFETs unless you need to control their slew rate to reduce EMI, however for larger MOSFETs with a lot more gate charge, its advisable to use a gate resistor as close to the MOSFET as possible to keep the transient current within the digital output's Abs.Max. ratings, reduce EMI and also prevent the MOSFET oscillating during the transition.   100R would be suitable for many applications.

If you are driving the gate direct from a MCU pin, you may need a 10K resistor between gate and source to keep the MOSFET fully off before the MCU firmware has set the pin as an output.
 

Offline paulca

  • Super Contributor
  • ***
  • Posts: 4051
  • Country: gb
Re: Selecting and driving transistors
« Reply #15 on: January 17, 2018, 09:10:53 pm »
If you are driving the gate direct from a MCU pin, you may need a 10K resistor between gate and source to keep the MOSFET fully off before the MCU firmware has set the pin as an output.

Gate and source?  Won't that just feedback the mosfet to latch on or worse put the 12V fan voltage to the MCU pin?

Gate to ground as a pull down would sound more practical to me, would it not?
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Selecting and driving transistors
« Reply #16 on: January 17, 2018, 09:50:46 pm »
When using a MOSFET to switch a load, its usual to put the load in series with the drain, and connect the source to a supply rail: Gnd for a N-MOSFET or +V for a P-MOSFET.    A resistor between gate and source will (in the absence of any other gate drive) bias any enhancement* MOSFET off.

If you put a resistor to ground on the gate of a P-MOSFET (with its source to +V) that would bias it on, so you cant just use a pulldown on the gate regardless of the MOSFET type.

Incidentally, there is one other occasion when you may want a larger value series gate resistor - to limit the current into the MCU pin to less than the Abs.Max. limit for that pin if the MOSFET gate oxide fails due to abuse.   You'll still have to replace the MOSFET, but can avoid other damage *IF* there is enough of a load on the MCU's Vcc rail to prevent its voltage rising excessively.

* Enhancement MOSFETs are the normal type - off when Vgs=0.   
 

Offline paulca

  • Super Contributor
  • ***
  • Posts: 4051
  • Country: gb
Re: Selecting and driving transistors
« Reply #17 on: January 18, 2018, 08:13:17 am »
Sanity check...

I got an N channel mosfet, so that's Vgs+ on gate to switch on, 0V is off?  Right?

I'm fairly sure, need to check, but the digital pins on the AVR chips sink at LOW.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Selecting and driving transistors
« Reply #18 on: January 18, 2018, 10:43:12 am »
Yes, I think you've got it, but I'll restate it anyway:  If you connect the N-MOSFET source to the AVR 0V rail,  and a digital output to the gate, logic '0' will set Vgs to near enough 0V and the MOSFET will be off.  Logic '1' will supply a Vgs of near enough to Vcc and if Vcc is significantly greater than the MOSFET's gate threshold voltage, the MOSFET will be on.   The load goes between a positive supply voltage (which may or may not be the same as Vcc) and the MOSFET drain.

Sourcing vs sinking for an IC's output pin is just the direction of conventional current flow, respectively: out of, vs in to, the pin. 
 

Offline paulca

  • Super Contributor
  • ***
  • Posts: 4051
  • Country: gb
Re: Selecting and driving transistors
« Reply #19 on: January 18, 2018, 11:13:57 am »
Thanks Ian.  I think I'm sorted now.

OP, sorry to borrow your thread, but I hope the dialog added something for you as well, if not, sorry again.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf