General base resistor transistor calculation

Hm, why are you asking?

Yes


The Arduino can safely supply 20mA to your load (circuit).

Keeping this output current low is done to reduce power consumption.

If your load needs only 1mA from the Arduino output to saturate the transistor, this is 1/20 smaller than the maximum safe value.


If the collector LED is bright enough at 5mA and the base current is 1mA (giving .7v Vce) your circuit is just fine.


You might find that lowering the base current to 100 µA starts raising Vce.
We want Vce to be less than .7v so we may need to raise the base current to greater than 500 µA to stay well above what is needed to get the transistor saturated.

Because it will save everyone a lot of time.

Missing info, What is the LEDs color? Or what is the LEDs forward voltage?

OP said:

I tried the 1kOhm resistor on a green 5mm led. It is still far too bright.

If the LED is too bright on 1-2mA you might as well drop the transistor and drive it directly from the I/O port.

Try a 1.8k or 2.2K. Put your voltmeter RED probe on LED + side, BLACK on LED - side, read the forward voltage, do the same with the resistor, then the transistor, RED on collector, BLACK on emitter.

The color is green (also red and yellow in other instances). I am using 5mm LEDs. I actually do not know the forward voltages. These are not specified. Therefore I am guessing...

I have a collection of high efficiency 3mm LEDs that I use for various purposes. The green ones are blindingly bright at 1.0mA. Try driving it from the Due output directly, with a 5k to 10k resistor.

Yes, I get 1mA at the green LED (2kOhm). Totally ok. But the base-emitter current is now 2.3mA (1kOhm). I gues this makes the transistor a bit useless.

Yes, my point exactly. The only worry would be if you were driving dozens of LEDs directly.

Alternatively, keep all resistor values the same and use PWM (pulse width modulation) to vary the brightness of the led.

1 Like

Yeah, some trivia, the onboard LED on the Due is capable of dimming because it's a PWM pin!

Then try 47k. Human vision has a logarithmic response, so "far too bright" might be 10x or 100x even. Just changing by small factors will lead to hardly detectable changes in brightness. For instance direct sunlight is several hundred times brighter than even good indoor lighting, yet we don't perceive the difference as hundreds of times brighter.
Another thing to try is adding a diffuser over the LED - when the source is close to being a point of light it will appear overly bright.

1 Like

Try powering the LED from the internal pullup resistor. Who knows? It might work.

1 Like

Would need a Dremel tool to get at the pullup. :wink: kidding .


Or


Toggle the pin from INPUT to INPUT_PULLUP

You can measure the LED forward voltage with a multimeter. Probably not so useful in this instance because it seems like your best solution is to use PWM to control the brightness.