Sorry, but that is misinformation, and IMHO , its not good practice to give advice about things you dont know for sure..
There is no need to stress the GPIO with such high current and the BJT could be easily damaged with 20mA, BC337 have high hfe so there is no need for that.
Voltages and currents of simulated driver circuit in the attachment : (bjt saturated with <2mA base current)
hFE is irrelevant for switching.
Better look at the saturation graph in the datasheet.
2mA is indeed good enough for 100mA and saturation to 0.1volt.
But for 300mA you should use 20mA base current.
Leo..
@Bjerknez: now you can decide how much voltage drop across the BC337 you are willing to accept, i.e. and how much you want to drive the BC337 into saturation, and the Nano can deliver.
Please note: A relative reduction in voltage drop by 100mV, which is equal to 0.83% of the 12V for your LEDs, is costing you more the lower the total voltage drop shall be.
You can see on the schematic, I have ~0.2Vce and as you can see on the datasheet graph, for 200mA @ 0.2Vce you need 2mA base current. Anyway everyone can try this easy in real life and it will work..
For transistor switching, we use the BJT’s saturation graphs when these calculations are needed.
20mA base current will not stress the BJT, any other assertion is blatantly wrong.
Most (probably over 90%) of small BJTs use a factor of 10 (Darlingtons as high as 300) for a saturation Ic to Ib ratio.
Can you use less base current for actual Ic(sat) ? yes, however, we stay away from too small of values of Ib(sat) as HFE varies with temperature, we must stay away from the active region.
As mentioned, the OP should/must always confirm saturation with a Vce(sat) measurement.
When low power is a concern, a MOSFET should be used.
Yep, several posters will jump on your back when you mention transistor gain with a saturated switch. Because it doesn't apply when collector voltage drops below base voltage.
Schools apparently don't teach that, so we try here.
Leo..
Look at my post, I got pm in Arnold Sw. style OK, it was mistake about hfe but it will work well as in schematic I provided, that is the Main point! You can steer away with (in this case) non existing temperature problems and other things but that does not meter, it works wery good in practice..
That's why I say hi school, "who is wrong, I'm not" kids story...
People are just telling you that there is a difference between an optimal and a non-optimal working design. The range of applications, and safety margins, are wider for an optimal design.
People can get overly invested in stuff. But many people here, myself included, believe that it is important to promote best practices here. Pity that it devolved into a discussion of posting etiquette.
I think generally, it is not appropriate to post PM's publicly. Fortunate for a lot of people that have sent me PM's.
The appropriate way to deal with an unwelcome PM is to either ignore it, or report it to a moderator.