I am trying to control some power LEDs using a microcontroller. For this I plan to use a transistor based constant current source to protect the LEDs from getting damaged and PWM on the base of the transistor to control the brightness.

enter image description here

The circuit is set to obtain 300mA across the LED. The transistor is 2n2222 NPN.

Problem: The Vin is 12V. The LED consumes only 3V. This leaves about 9V that drops across the transistor and the resistance in series. The power consumed by the transistor is high enough to burnt it. After a few seconds of working it gives up and the current in the circuit increases to about 1A before it burns out.

I want to understand what can be done to stop this from happening. I also tried using a 5V zener in series to consume 5V before the transistor. This did the job somewhat but the zener got extremely hot (enough to melt plastic) and that can't b good for the life of product.

Some help here will be highly appreciated.


  • I cannot use a voltage regulator to decrease voltage as there is absolutely no space left on the PCB.
  • I cannot change the power source from 12V to something less.


So inspired by @indraneel answer down below, I understood I had to either utilize the remaining voltages in an efficient way or make sure the extra wattage was dissipated in a dafe manner.

What @indraneel suggests is very efficient as you get to actually make use of the extra wattage you have after the first LED and this also won't give too much heat. But it just wasn't the right solution for me as the LEDs are quite expensive. But, this inspired me to understand that the only way is to consume this power. So I decided to use a 5V zener in series. Obviously, the zener diode will heat up too much to dissipate this power. For that I placed the zener on the aluminium PCB where all my LEDs are. That acted as a heat sink for the zener. Now obviously the aluminium PCB does get warm but it neither affects the LEDs, nor does the transistors get burnt/damaged.

I hope this post helps someone. :D


So earlier I thought that using zener in series was a good way to drop some voltages but it is in fact a bad idea. Eventually the zener gives up, in a day or two maybe. THE SOLUTION WAS TO FINALLY MAKE SPACE FOR AN LM2596 BASED BUCK CONVERTER TO GET RELIABLE STEPPED DOWN VOLTAGE AND VERY LESS HEAT.

  • 7
    \$\begingroup\$ It's not clear if you understand that whatever you use to "drop" that extra 9V is going to be dissipating 2.7W as heat (assuming 12V supply and 3V & 300mA for the LED). Whether it's a resistor, a transistor, a zener, or some combination doesn't matter. \$\endgroup\$
    – brhans
    Commented Jan 9, 2019 at 20:29
  • 1
    \$\begingroup\$ Can you, instead of adding a Zener diode in series with the LED, add one or two more LED's in series? Then reduce the current correspondingy for approximately the same amount of total light. \$\endgroup\$
    – user57037
    Commented Jan 9, 2019 at 21:32
  • 3
    \$\begingroup\$ @Indraneel, you have failed to understand the circuit. It is a current sink circuit. The current will not be 3.95A. Your calculation is not applicable to the actual circuit shown by the OP. As current starts to flow, the emitter voltage rises until it is approximately one diode drop below the base voltage. So it will be around 0.65V/2.2 Ohms = about 300 mA as OP said. But the power dissipation will be let's say 0.3A * 8.4V = 2.5W. Which is way too much. \$\endgroup\$
    – user57037
    Commented Jan 10, 2019 at 4:18
  • 3
    \$\begingroup\$ I'm voting to close this question as off-topic because of unrealistic expectations... \$\endgroup\$
    – brhans
    Commented Jan 10, 2019 at 16:56
  • 1
    \$\begingroup\$ @brhans. For me, having unrealistic expectrations is not a valid reason for closing the question. The OP may be of good faith and just doesn't understand the problem. \$\endgroup\$
    – Blup1980
    Commented Jan 10, 2019 at 20:38

4 Answers 4


The max current should be based on the max dissipation by the transistor. 2N2222 is inadequate for this job due to too much dissipation. A BD139 can be used instead of the 2N2222.

Alternately, 2 more LED in series will dissipate only 0.65W in the transistor. Still too high for a TO92, but maybe some kind of heatsink or active cooling can be used, or LED operated below 50% duty cycle. TO92 should usually handle 300mW ok.

However, I don't understand the problem. You are using PWM already. Why are you trying to limit max current to 300mA? These LEDs (I'm assuming 1W) work fine for a few seconds even at upto 24V. So 12V should not be a problem. The average current through the LED should not exceed 280mA, or 330mA with good heatsinking. You can easily do this with PWM.

To regulate with PWM, you need to first change the transistor to something better (probably TIP122, but probably not BD139) and then set the resistor accordingly (probably 3R3 as it limits max current to 2.6A). Make sure the resistor can handle the power dissipation (probably 5W for 300mA average at 8.7V to ensure enough headroom; 3W is cutting it too thin). [Or, add 2 more LED in series and use just a 1 ohm 1W resistor.] Also make sure the peak current through the transistor is within the time limits in the SOA curve for the PWM frequency and duty cycles you are using.

You do not need the two diodes anymore, since the transistor here is a switching device, and not limiting current (the resistor is doing that by itself). For faster switching you may place a base resistor (1K to 10K) to ground. If using BD139, make sure it has the required base current for saturation, and is not working in the linear region.


simulate this circuit – Schematic created using CircuitLab

[As mentioned, a mosfet like AO3400 is smaller, better and costs less (if you can wait getting it from China). However, the TIP122 is pretty common and usually available locally.]

  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$
    – Dave Tweed
    Commented Jan 13, 2019 at 21:55
  • \$\begingroup\$ If your LED doesn't like the voltage spikes, you could add an inductor and another diode and have a buck converter. \$\endgroup\$ Commented Feb 10, 2020 at 12:42
  • \$\begingroup\$ @user253751 I think that will complicate the circuit. switch will have to be moved upstream and probably changed to PNP with some driver. \$\endgroup\$
    – Indraneel
    Commented Feb 11, 2020 at 2:52
  • \$\begingroup\$ @Indraneel No, you could mostly leave it alone: Replace the resistor with an inductor then add a diode to complete the loop when the transistor is turned off. (Anode connected to the transistor's collector; cathode connected to 12V). (This would be an "upside down" buck converter since +12V is common, not 0V) \$\endgroup\$ Commented Feb 11, 2020 at 11:01

If you have a linear circuit you have to get rid of about 3W somewhere. There is no particular advantage to your "constant current" circuit- it's not a very good one at all, it depends on diode voltage as the reference, and as the transistor heats the current goes up since the diodes won't track with the Vbe junction temperature.

You can use a resistor, but it will dissipate about 3W and will have to be relatively bulky and will run very hot. You'll want to keep it away from other parts for reliability. Then you can switch the LED with a transistor or (better) a smallish MOSFET, even an SOT-23 type such as AO3404. The resistor will be a better constant current source than your transistor/diode thing.

If cost is not too important, you could use a small DC-DC converter to drop the +12 to +5 and then your power dissipation in the resistor would drop to 0.6W, so a 2512 resistor would work. The regulator + resistor is FAR smaller than a 3W heatsink suitable for a semiconductor. Total dissipation of the driver circuit should be < 1W.

Even better, most likely, would be a bespoke switching LED driver circuit with an inductor that could get the dissipation down to a few hundred mW. You can pick one that has a control input and avoid the MOSFET as well, probably.


In this case, especially since you claim that you have no available space on your pcb, is to suggest that you just brute-force it. Get a beefier NPN transistor in a TO220 package (which will have a slightly bigger footprint) and put a clip-on heat sink on it. Something like a TIP-31 will work in terms of voltage, current and gain, but its thermal resistance to ambient is about 62 degrees C per watt, so your nominal 2.5 watts will push it to 150 C above ambient and it won't survive any more than your current 2N2222. It will take a few seconds more to kill it, but I doubt that is much consolation. With a clip-on heat sink, though, you should be able to get the temperature down to something survivable. This will require that you have enough space available above the pcb to let the heat sink do its job. You'll also need to be sure that your shock and vibration levels are low enough the the heat sink won't get knocked around enough to contact other parts. The footprint of the leads for TO-220 is not enormously greater than a smaller part, and you can stand it up so that the body is above the neighboring parts.

If you can't find the extra space for a TO-220, I suspect you're hosed.

And don't even think about trying to put a heat sink on a plastic-bodied 2N2222.

PS - I do hope that you're aware that you need at least a 1/4 watt resistor for your 2.2 ohm resistor. Nominal power dissipation for that resistor is 0.2 watts.



simulate this circuit – Schematic created using CircuitLab

The design should be like this to work properly and not overheat. If the LED is a high wattage part, not a standard 20mA max current LED, then a better driver is needed that can actively control current.

  • \$\begingroup\$ "The circuit is set to obtain 300mA across the LED." I missed that part. Single channel constant current drivers, acting like switching DC-DC convertors, can actively limit the current with just a couple of external components. You need the active control to prevent current runaway as the LED heats up. \$\endgroup\$
    – CrossRoads
    Commented Jan 9, 2019 at 21:00
  • \$\begingroup\$ Example diodes.com/assets/Datasheets/AL8860.pdf \$\endgroup\$
    – CrossRoads
    Commented Jan 9, 2019 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.