I'm working on a project where I need to dim a 30 cm LED strip. I'm using a STM32 pin to drive the base of a NPN BJT-transistor. The pin is can source a maximum of 25mA. The LED strip consists of 12 parallel ordinary LEDs, each one in series with 1.4 kOhms resistance. The collector is connected to the LEDs, which in turn are connected to 8V Vcc. I have read that I should use a base resistor on the transistor, is it really necessary? And how do i proceed to select the right transistor?

  • \$\begingroup\$ 5 or 3,3V? On stm. \$\endgroup\$ – Tony Stewart EE75 Mar 9 '20 at 16:20
  • \$\begingroup\$ It's 3,3V output \$\endgroup\$ – ElecBaldwin Mar 10 '20 at 13:59

Yes, it is necessary to limit the base current for the transistor.

First, calculate the maximum collector current for the transistor. In your case, you need to know the maximum current that each LED will draw, which depends on the forward voltage of the LEDs (which you haven't told us). Make sure this is less than the specified maximum collector current for your transistor. If not, you need a different transistor.

Look in the datasheet for the specific NPN transistor (which you haven't told us) and find the minimum current gain (\$h_{FE}\$ or \$\beta\$) at a value of collector current equal to the collector current you need.

Divide the maximum collector current by the minimum current gain, and that tells you how much base current you need. Make sure this is less than the specified maximum base current for your transistor. If not, you need a different transistor.

Given the output voltage of your MCU and the \$V_{BE}\$ of the transistor calculate a resistor value that will result in the the desired base current. Select the nearest standard resistor value that is less than the calculated value.

  • \$\begingroup\$ Thanks for the answer! I dont know the forward voltages of the LEDs or what NPN transistor i will use, that's why i didnt tell you :) \$\endgroup\$ – ElecBaldwin Mar 10 '20 at 14:02
  • \$\begingroup\$ I'm glad I could help. The way things are supposed to work here is that you should "accept" the answer that helps you the most. If you want to wait a while and see if another answer comes in you can certainly do that. \$\endgroup\$ – Elliot Alderson Mar 10 '20 at 14:37
  • \$\begingroup\$ Just one more question. Could you have a quick look at my calculations to see if they make sense? The LED and resistor pictured are the 12 parallel ones that i mentioned. I just measured Ic right now. The calculations: imgur.com/fY8NYUL \$\endgroup\$ – ElecBaldwin Mar 10 '20 at 16:54
  • \$\begingroup\$ Looks reasonable to me. The assumption of 1V for \$V_{BE}\$ is somewhat high...we usually assume something like 0.7V. \$\endgroup\$ – Elliot Alderson Mar 11 '20 at 0:30
  • \$\begingroup\$ Thank you for the help :) \$\endgroup\$ – ElecBaldwin Mar 11 '20 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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