UNO controlled LEDs: Resistor Question

:smiley: My momma told me, "Never do math in public", so hopefully somebody will double-check me...

I tried using the calculator but I have no idea what I'm doing. If you could help me out and calculate this base resistor I would really appreciate it!

The gain of a transistor isn't something you can count-on. Usually, they will spec the minimum. So normally, we use resistors (which can have 1% or better tolerance) to "control" the gain, or to control how the circuit performs.

There is more than one way to make the calcuations, and I'm going to make some assumptions & approximations... Here's my approach:

With 8 Volts from the battery and assuming ~2V dropped across the LEDs, that leaves 6V across each 270 Ohm resistor. (There is also a small voltage-drop across the transistor's collector-emitter junction, but I'll ignore it.) Using Ohms Law, the current through each resistor (and LED) is 6/270 = 22.2mA (0.0222 Amps). Times 6 LEDs = 133mA total.

Let's assume a worst-case transistor gain (current gain) of 50. 133/50 = 2.67mA (into the base of the transistor).

There will be an approximate 1/2-Volt drop across the transistors, base-emitter junction. That's small enough that we could ignore it. But let's not ignore it, and assume we have 5V coming out of the Arduino with 4.5V across the base-resistor. We've got 4.5V across an unknown resistor, and we need 2.67mA (0.0267A). So, we calculate 4.5/.0267 = 1685 Ohms.

Since we made a worst-case assumption about the transistor gain and we intend to saturate the transistor (turn it all the way on), any resistor value between 1k and 2k should work. As long as the values are "close", changes in the base-resistor value or transistor gain won't affect LED brightness.