Driving high current load using transistors - Page 1
Forum section: electronics / beginners

author: m.elsayed
author_rank: Contributor
timestamp: June 15, 2023, 11:18:59 am
content: Hello,I am trying to control a 10w (12v at 800mA) load using a microcontroller(STM32), so first I tried to use a single transistor but I did not get enough current, so I have used another transistor connected to the GPIO to be able to source more current to the driving transistor.I am using 330 ohm resistor to limit the maximum current from the GPIO to 10mA.So far it worked however I am not sure of a few things:1. What is wrong with this circuit?2. Is there a way to limit the maximum current that goes through the load using a transistor connected to the base?3. Are the transistors in saturation mode?4. I do not know how to calculate the optimal switching frequency, but I am using 2kHz.These are the relevant information of the two transistors I am using:9014=====Maximum Emitter-Base Voltage |Veb|: 5 VMaximum Collector Current |Ic max|: 0.1 ATransition Frequency (ft): 150 MHzCollector Capacitance (Cc): 3.5 pFForward Current Transfer Ratio (hFE), MIN: 60c2655======Maximum Emitter-Base Voltage |Veb|: 5 VMaximum Collector Current |Ic max|: 2 ATransition Frequency (ft): 100 MHzCollector Capacitance (Cc): 35 pFForward Current Transfer Ratio (hFE), MIN: 70

author: Circlotron
author_rank: Super Contributor
timestamp: June 15, 2023, 12:06:26 pm
content: Just use a single mosfet. The exact type is not critical for your application as long as it has a high enough current rating. It will draw zero current from the GPIO but probably good practice to use a 100R series resistor between it and the mosfet gate.

author: wasedadoc
author_rank: Super Contributor
timestamp: June 15, 2023, 12:07:23 pm
content: That circuit can never work. Q2 has both base and emitter at the same voltage (ground).

author: m.elsayed
author_rank: Contributor
timestamp: June 15, 2023, 12:19:01 pm
content: Thank you, but I have already destroyed 2 mosfets, so I thought I would try with transistors since they are more tolerant.but is there a way to limit the current that the mosfet/transistor can source?

author: m.elsayed
author_rank: Contributor
timestamp: June 15, 2023, 12:22:04 pm
content: Quote from: wasedadoc on June 15, 2023, 12:07:23 pmYou are correct, I did actually connect the base to the collector of the first transistor.Though I assume it is still wrong, since it's basically creating a short circuit between the collector and the emitter.

author: madires
author_rank: Super Contributor
timestamp: June 15, 2023, 12:34:28 pm
content: The most simple way to limit the current of an LED is a series resistor. Of course you could also add a shunt resistor plus transistor to limit the current via Q2. But this will need also some additional care to prevent oscillation of the control loop. Q1 should be in saturation mode (rule of thumb: I_B >= 3 * I_C_max / hFE). If you're going for a MOSFET please choose a logic level type (lower V_GS, check datasheet!).

author: m.elsayed
author_rank: Contributor
timestamp: June 15, 2023, 12:42:05 pm
content: Quote from: madires on June 15, 2023, 12:34:28 pmThat is awesome, this is the first time I see this equation, and it does make calculations way easier.The problem with a series resistor is that it needs to be a beefy one and will dissipate a lot of heat, and I am trying to make the circuit moderately efficient.

author: Terry Bites
author_rank: Super Contributor
timestamp: June 15, 2023, 12:44:59 pm
content: Q1 will short out when base bias is applied, if its not dead yet it will be very soon.Q1 lacks a collecor resistor to generate any voltage to drive Q2.Veb isn't a very important transistor parmameter in most applications. Ic, Vce and current gain Hfe are more pertinent.D1 has no current limiting resistor and again, if Q1, Q2 and D1 have not died you have been very lucky!Assuming the LED has no current limiting of its own. (You need to provide more info on your LED).When Q2 is full on, the voltage from collector to emitter (ground) is about 0.2V , your supply voltage is 12V the voltage across your 10W LED is Vf. The LED current is 800mA.So you can work out R3= (12-Vf-0.2)/0.8Lets say Q2 has a current gain ( Hfe or Beta) of 100 @1A. To switch 800mA, it will need a base current of 800/100 mA or 8mA. In reality you want more than this maybe 5 times to get Q2 to Be fully on. Say 40mA. Supply the collector resistor for Q1 from the 12V supplySo here is a possible remedy, Add the collector resistor for Q1 and the curent limiting resistor for Q2Alternatively combine Q1 and Q" into a "Darlington Pair" configuration.It will have a current gain of hfe(Q1)*hfe(Q2)Lets give them 100 each, so a current gain is now 10000. There's no free lunch. When fully on, the voltage across it is about 1V. Now you ned to caclulate R3 as (12-Vf-1)/0.8Lastly work out the power wasted in R3, =(I^2)R and in the transistor Vec*I . Is the resistor power rating suffcient, can the transistor safely run at this power?This is not a good soultion to his problem. Ideally you want to use a MOSFET for Q2, note that its a lot easier to drive.:

author: MrAl
author_rank: Super Contributor
timestamp: June 15, 2023, 01:00:31 pm
content: Quote from: m.elsayed on June 15, 2023, 11:18:59 amHere is a typical circuit for this.R3 value depends on the forward voltage spec of the LED.Also, you should be aware that some LEDs are not made for use with PWM.R1 is adjusted to make sure the big transistor saturates.R2 is adjusted for the big transistor max collector base leakage current.R3 is adjusted according to the nominal forward voltage of the LED.A switching frequency of 2kHz should be ok as long as the LED is spec'd for use with PWM.

author: madires
author_rank: Super Contributor
timestamp: June 15, 2023, 01:18:42 pm
content: Quote from: m.elsayed on June 15, 2023, 12:42:05 pmYou would have the same problem with limiting the current by controlling Q2, i.e. Q2 would dissipate the excess power. For a power efficient solution you'd need an LED driver with a PWM input (current controlled DC/DC converter).

author: m.elsayed
author_rank: Contributor
timestamp: June 15, 2023, 04:24:35 pm
content: Quote from: Terry Bites on June 15, 2023, 12:44:59 pmThank you so much, this is very comprehensive and a very good start.I guess the combination of luck, using PWM and a fool-proof development board was enough to not kill all the components in the circuit.I know it's a bad idea not to use a current limiting resistor in series with the LED, but I was thinking that if I use a duty cycle between 10-80% and a heatsink, it will not get hot enough for the Vf to drift so much.

author: m.elsayed
author_rank: Contributor
timestamp: June 15, 2023, 04:37:00 pm
content: Quote from: MrAl on June 15, 2023, 01:00:31 pmThank you so much, this is exactly what I was hoping to get in the first place, so if I understand correctly the combination of R1 and R2 work like a voltage divider to provide Q2 with (3v - the voltage drop across Q1) while also limiting the current to Q2 to ~30mA?Or this is just to so I do not have a short circuit?

author: m.elsayed
author_rank: Contributor
timestamp: June 15, 2023, 04:43:16 pm
content: Quote from: madires on June 15, 2023, 01:18:42 pmI have considered that and I think it is the best and most efficient solution, but so far it's really beyond my knowledge especially with the huge number of buck/boost converters out there.

author: MrAl
author_rank: Super Contributor
timestamp: June 16, 2023, 11:11:30 am
content: Quote from: m.elsayed on June 15, 2023, 04:37:00 pmHi,Well, it's not so much a voltage divider effect as it is a current control where we control the current getting to Q2.R1 sets the amount of current we need to drive Q2 into saturation, and R2 makes sure Q2 turns off in order to get the PWM to work right. Q2 should turn all the way on (R1) and it should turn all the way off (R2). R2 cannot be too small though or else Q2 won't get enough current to drive it properly when it has to turn on.Bipolar transistors also have a little bit of a pesky problem with collector to base leakage current, which can keep them turned on when we don't want them to stay on. R2 shunts that current to ground so the leakage current cannot keep Q2 turned on, and it also sweeps the charge carriers out of the base region so Q2 turns off as fast as possible using this drive method.R3 is there for a different reason. If the LED is a normal LED, it will have a somewhat low forward voltage, like perhaps around 3.5v, but i don't think you said what it really was yet (that would help decide on what the value should really be). If it is around 3.5v, then you don't want to bang it with 12v when Q2 turns on, even if it is for a short time period. What you would want to do is bang it with a current that is less than the maximum peak current for that LED. For example, if the peak current rating was 1 amp (i don't know what it really is though because i don't think you mentioned this yet) then you don't want to go higher than maybe 0.9 amps. With a 12v source and 3.5v LED that means there will be 12-3.5=8.5v across the resistor. If the resistor R3 was 10 Ohms, then the max current would be 0.85 amps which would be pretty good. With no resistor for R3 though then the current could go too high and possibly damage the LED.What would be a good idea now is if you can find out what the nominal forward voltage for your LED is and what the max current rating is, and if it is ok to be used with PWM. Either that or maybe provide a part number for the LED so we can look the data sheet up on the web to find the specs.Note that if the nominal voltage of the LED was 12v (some have built in resistors) then R3 would not be required and could be just a short. That's why it is important to know the specs. If you don't know the specs and can't find them, then we would have to make a measurement of the forward voltage and use the 10watt spec as the guide to the max current rating.

author: Zero999
author_rank: Super Contributor
timestamp: June 16, 2023, 01:19:18 pm
content: Quote from: m.elsayed on June 15, 2023, 12:19:01 pmA MOSFET is a transistor.What frequency is the PWM?Where the MOSFETs rated to pass the desired 800mA, with a low voltage drop with a gate volage of 3.3V?Does the LED have a suitable resistor, or current regulator circuit?My guess the the MOSFET blew because it didn't turn on hard enough, due to lack of gate drive, causing it to dissipate too much power: volts*amps. Either choose a MOSFET which is capable of passing 800mA, with a voltage drop of less than a couple of hundred mV and a gate volage of 3V, or use a gate driver to put 12V into the gate.

author: m.elsayed
author_rank: Contributor
timestamp: June 17, 2023, 02:24:47 am
content: Quote from: MrAl on June 16, 2023, 11:11:30 amHi,That makes sense, so R2 was the reason why I was not able to dim the LED enough even with <1% duty cycle, in addition to the LED not being PWM-capable.Even though I know R3 is very important my goal was to avoid it altogether because it will dissipate a lot of heat, then I learned that Q2 will pay the price for this.I have read somewhere that in general PWM does not work well with LED's since they take time to turn on and off and we just keep them somewhere between fully on and fully off, so the best way to drive them is by controlling their current/voltage.I am not sure about the Vf of the LED, but my guess would be 9v, since it starts illuminating at 9v (it's arranged as 8 small LEDS each 4 in series), so if we use the 10W as a guide then the Vf would be 12v(3v for each small LED) and a current rating of 0.8A.Overall I learned a lot specifically the things that I did not know I did not know.So now I can try a current-controlled buck converter with PWM capability and see how it goes.

author: m.elsayed
author_rank: Contributor
timestamp: June 17, 2023, 03:18:36 am
content: Quote from: Zero999 on June 16, 2023, 01:19:18 pmYes, I agree but I still can not make much sense of the graphs in the datasheet (Vds, Vgs, ...etc) so I will need to do my research.I have tried 2kHz --which made hissing sound if the breadboard is close to a speaker--, and then 30kHz to avoid this.I have decided to use BJTs since I have heard that they can take a lot of abuse --which is the case here, giving that I have short-circuit them--.Initially I have used 0.68ohm/2W resistor to limit the current, but then thought why bother I can use PWM so the LED would not get hot enough and drift, which is a bad idea.I have tried two (N-channel) mosfets TK5A50D with 3.3v and 2SK3918 with 12V at the gate which I guess within their specs, then after a few tries all leads became shorted.```TK5A50D========Maximum Drain-Source Voltage |Vds|: 500 VMaximum Gate-Source Voltage |Vgs|: 30 VMaximum Gate-Threshold Voltage |Vgs(th)|: 4.4 VMaximum Drain Current |Id|: 5 A2SK3918=======Maximum Drain-Source Voltage |Vds|: 25 VMaximum Gate-Source Voltage |Vgs|: 20 VMaximum Drain Current |Id|: 48 A```so can I use a BJT to drive the mosfet (enhancement mode I guess)? would something like this circuit even work?I can create a voltage divider at the gate of Q2 if necessary.

author: ArdWar
author_rank: Frequent Contributor
timestamp: June 17, 2023, 06:39:36 am
content: R3 is unnecessary here. Depends on the value you might even risking Q2 not fully turned off.You don't need to look that deep into MOSFET datasheet curves as long as you're not doing something too fancy with it. Here you just need to make sure VDSrating well above your supply voltage, VGS(TH)within acceptable range that can be achieved by your gate drive, and RDS(ON)low enough that RDS(ON)* ILoad(max)is well within package cooling capacity. Disregard Max drain current or Max power dissipation ratings, they're outrageously too high compared to what the MOSFET couldrealisticallydeliver. You shouldn't ever operate anywhere near those values on most designs.

author: Zero999
author_rank: Super Contributor
timestamp: June 18, 2023, 08:44:51 am
content: The MOSFETs listed are too big to drive with a single BJT, at 30kHz. They have too higher gate charge to turn on and off that quickly with such a simple driver circuit.LEDs require a constant current, rather than voltage power supply. The LED in question just has a nominal forward voltage of 12V at 800mA. It will require a higher voltage power supply to driver properly, unless a boost converter is used.

author: MrAl
author_rank: Super Contributor
timestamp: June 18, 2023, 09:32:19 am
content: Hi,MOSFETs used for driving LEDs really need a decent mosfet driver anyway. You can get away with more using bipolar transistors. To turn on and off fast a mosfet has to have a driver capable of at least 500ma peak for both on and off modes, and preferably 1 amp peak for both modes, and even higher sometimes. That's why they make special chips just for driving mosfets.You can use a dual transistor bipolar mosfet driver but it wont be as good as a mosfet driver chip.Mosfets that turn on and off too slow get too hot. Mosfets that turn on and off too fast can generate a lot of EMI, so sometimes the turn on and turn off modes are controlled a little more carefully.